Skip to content

Commit 25ef5fe

Browse files
author
philmoz
committed
Rename function and cleanup code.
1 parent 7f20153 commit 25ef5fe

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

radio/src/gui/128x64/radio_setup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ void menuRadioSetup(event_t event)
403403
if (attr)
404404
g_eeGeneral.volumeSrc = checkIncDec(event, g_eeGeneral.volumeSrc,
405405
MIXSRC_NONE, MIXSRC_LAST_SWITCH, EE_MODEL|INCDEC_SOURCE|INCDEC_SOURCE_INVERT|NO_INCDEC_MARKS,
406-
isSourceSwitchOrPotAvailable);
406+
isSourceAvailableForBacklightOrVolume);
407407
break;
408408

409409
case ITEM_RADIO_SETUP_VOLUME_SOURCE_OVRRIDE:
@@ -593,7 +593,7 @@ void menuRadioSetup(event_t event)
593593
if (attr)
594594
g_eeGeneral.backlightSrc = checkIncDec(event, g_eeGeneral.backlightSrc,
595595
MIXSRC_NONE, MIXSRC_LAST_SWITCH, EE_MODEL|INCDEC_SOURCE|INCDEC_SOURCE_INVERT|NO_INCDEC_MARKS,
596-
isSourceSwitchOrPotAvailable);
596+
isSourceAvailableForBacklightOrVolume);
597597
break;
598598

599599
case ITEM_RADIO_SETUP_BACKLIGHT_SOURCE_OVERRIDE:

radio/src/gui/212x64/radio_setup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ void menuRadioSetup(event_t event)
423423
if (attr)
424424
g_eeGeneral.volumeSrc = checkIncDec(event, g_eeGeneral.volumeSrc,
425425
MIXSRC_NONE, MIXSRC_LAST_SWITCH, EE_MODEL|INCDEC_SOURCE|INCDEC_SOURCE_INVERT|NO_INCDEC_MARKS,
426-
isSourceSwitchOrPotAvailable);
426+
isSourceAvailableForBacklightOrVolume);
427427
break;
428428

429429
case ITEM_RADIO_SETUP_VOLUME_SOURCE_OVRRIDE:
@@ -591,7 +591,7 @@ void menuRadioSetup(event_t event)
591591
if (attr)
592592
g_eeGeneral.backlightSrc = checkIncDec(event, g_eeGeneral.backlightSrc,
593593
MIXSRC_NONE, MIXSRC_LAST_SWITCH, EE_MODEL|INCDEC_SOURCE|INCDEC_SOURCE_INVERT|NO_INCDEC_MARKS,
594-
isSourceSwitchOrPotAvailable);
594+
isSourceAvailableForBacklightOrVolume);
595595
break;
596596

597597
case ITEM_RADIO_SETUP_BACKLIGHT_SOURCE_OVERRIDE:

radio/src/gui/colorlcd/radio/radio_setup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static SetupLineDef soundPageSetupLines[] = {
282282
[](Window* parent, coord_t x, coord_t y) {
283283
auto choice = new SourceChoice(parent, {x, y, 0, 0}, MIXSRC_NONE, MIXSRC_LAST_SWITCH,
284284
GET_SET_DEFAULT(g_eeGeneral.volumeSrc), true);
285-
choice->setAvailableHandler(isSourceSwitchOrPotAvailable);
285+
choice->setAvailableHandler(isSourceAvailableForBacklightOrVolume);
286286
new ControlTextOverride(parent, x, y, FUNCTION_VOLUME);
287287
}
288288
},
@@ -520,7 +520,7 @@ class BacklightPage : public SubPage
520520
setupLine(STR_CONTROL, [=](Window* parent, coord_t x, coord_t y) {
521521
auto choice = new SourceChoice(parent, {x, y, 0, 0}, MIXSRC_NONE, MIXSRC_LAST_SWITCH,
522522
GET_SET_DEFAULT(g_eeGeneral.backlightSrc), true);
523-
choice->setAvailableHandler(isSourceSwitchOrPotAvailable);
523+
choice->setAvailableHandler(isSourceAvailableForBacklightOrVolume);
524524
new ControlTextOverride(parent, x, y, FUNCTION_BACKLIGHT);
525525
});
526526

radio/src/gui/gui_common.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,9 @@ bool isSourceAvailable(int source)
308308
);
309309
}
310310

311-
bool isSourceSwitchOrPotAvailable(int source)
311+
bool isSourceAvailableForBacklightOrVolume(int source)
312312
{
313-
if (source == MIXSRC_NONE) return true;
314-
return checkSourceAvailable(source, SRC_SWITCH | SRC_POT);
313+
return checkSourceAvailable(source, SRC_SWITCH | SRC_POT | SRC_NONE);
315314
}
316315

317316
bool isLogicalSwitchAvailable(int index)

radio/src/gui/gui_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ bool isInputAvailable(int input);
6060
bool isThrottleSourceAvailable(int source);
6161
bool isLogicalSwitchAvailable(int index);
6262
bool isAssignableFunctionAvailable(int function);
63-
bool isSourceSwitchOrPotAvailable(int source);
63+
bool isSourceAvailableForBacklightOrVolume(int source);
6464
bool isSourceAvailable(int source);
6565
int timersSetupCount();
6666
bool isTimerSourceAvailable(int source);

0 commit comments

Comments
 (0)