chore(bw): tidy up Radio Setup menu (#4939)

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
philmoz
2024-05-30 15:59:15 +10:00
committed by GitHub
co-authored by Peter Feerick
parent e1b1b88f01
commit 9bdd5664a0
58 changed files with 1282 additions and 1587 deletions
+20 -14
View File
@@ -63,17 +63,12 @@ void drawStick(coord_t centrex, int16_t xval, int16_t yval)
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
{
#if defined(GRAPHICS)
if (value)
lcdDrawChar(x+1, y, '#');
if (attr)
lcdDrawSolidFilledRect(x, y, 7, 7);
else
lcdDrawSquare(x, y, 7);
#else
/* ON / OFF version */
lcdDrawTextAtIndex(x, y, STR_OFFON, value, attr ? INVERS:0) ;
#endif
}
void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
@@ -114,29 +109,40 @@ void title(const char * s)
lcdDrawText(0, 0, s, INVERS);
}
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *const *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event, IsValueAvailable isValueAvailable)
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *const *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event, coord_t lblX, IsValueAvailable isValueAvailable)
{
if (label) {
drawFieldLabel(x, y, label);
lcdDrawText(lblX, y, label);
}
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL, isValueAvailable);
return value;
}
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char *label, LcdFlags attr, event_t event )
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *const *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event, coord_t lblX)
{
return editChoice(x, y, label, values, value, min, max, attr, event, lblX, nullptr);
}
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *const *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event)
{
return editChoice(x, y, label, values, value, min, max, attr, event, 0, nullptr);
}
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char *label, LcdFlags attr, event_t event, coord_t lblX)
{
#if defined(GRAPHICS)
drawCheckBox(x, y, value, attr);
return editChoice(x, y, label, nullptr, value, 0, 1, attr, event);
#else
return editChoice(x, y, label, STR_OFFON, value, 0, 1, attr, event);
#endif
return editChoice(x, y, label, nullptr, value, 0, 1, attr, event, lblX);
}
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char *label, LcdFlags attr, event_t event)
{
return editCheckBox(value, x, y, label, attr, event, 0);
}
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event)
{
drawFieldLabel(x, y, STR_SWITCH);
lcdDrawTextAlignedLeft(y, STR_SWITCH);
drawSwitch(x, y, value, attr);
if (attr & (~RIGHT)) CHECK_INCDEC_MODELSWITCH(event, value, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
return value;