From 5e97d1d59bbdf26c0d5d327e42a25907fade8a10 Mon Sep 17 00:00:00 2001 From: philmoz Date: Fri, 10 Nov 2023 17:35:00 +1100 Subject: [PATCH] chore: Remove unused LS_FUNC_RANGE, TimersContext (#4267) --- companion/src/firmwares/rawswitch.h | 5 ++-- .../src/gui/128x64/model_logical_switches.cpp | 2 +- .../src/gui/212x64/model_logical_switches.cpp | 2 +- .../gui/colorlcd/model_logical_switches.cpp | 1 - radio/src/gui/gui_common.cpp | 23 ------------------- radio/src/gui/gui_common.h | 3 --- radio/src/lua/api_general.cpp | 1 - radio/src/myeeprom.h | 1 - .../storage/yaml/yaml_datastructs_128x64.cpp | 1 - .../storage/yaml/yaml_datastructs_nv14.cpp | 1 - .../src/storage/yaml/yaml_datastructs_t20.cpp | 1 - .../storage/yaml/yaml_datastructs_tpro.cpp | 1 - .../src/storage/yaml/yaml_datastructs_x10.cpp | 1 - .../storage/yaml/yaml_datastructs_x12s.cpp | 1 - .../src/storage/yaml/yaml_datastructs_x9d.cpp | 1 - .../src/storage/yaml/yaml_datastructs_x9e.cpp | 1 - .../storage/yaml/yaml_datastructs_x9lite.cpp | 1 - .../storage/yaml/yaml_datastructs_xlites.cpp | 1 - 18 files changed, 4 insertions(+), 44 deletions(-) diff --git a/companion/src/firmwares/rawswitch.h b/companion/src/firmwares/rawswitch.h index 2054eb7edc6..4943cc3d49b 100644 --- a/companion/src/firmwares/rawswitch.h +++ b/companion/src/firmwares/rawswitch.h @@ -60,10 +60,9 @@ class RawSwitch { LogicalSwitchesContext = 0x01, SpecialFunctionsContext = 0x02, GlobalFunctionsContext = 0x04, - TimersContext = 0x08, - MixesContext = 0x10, + MixesContext = 0x08, - AllModelContexts = SpecialFunctionsContext | LogicalSwitchesContext | TimersContext | MixesContext, + AllModelContexts = SpecialFunctionsContext | LogicalSwitchesContext | MixesContext, AllSwitchContexts = AllModelContexts | GlobalFunctionsContext }; diff --git a/radio/src/gui/128x64/model_logical_switches.cpp b/radio/src/gui/128x64/model_logical_switches.cpp index 08ad19270f9..bf70da064d5 100644 --- a/radio/src/gui/128x64/model_logical_switches.cpp +++ b/radio/src/gui/128x64/model_logical_switches.cpp @@ -81,7 +81,7 @@ void menuModelLogicalSwitchOne(event_t event) lcdDrawTextAlignedLeft(y, STR_FUNC); lcdDrawTextAtIndex(CSWONE_2ND_COLUMN, y, STR_VCSWFUNC, cs->func, attr); if (attr) { - cs->func = checkIncDec(event, cs->func, 0, LS_FUNC_MAX, EE_MODEL, isLogicalSwitchFunctionAvailable); + cs->func = checkIncDec(event, cs->func, 0, LS_FUNC_MAX, EE_MODEL); uint8_t new_cstate = lswFamily(cs->func); if (cstate != new_cstate) { if (new_cstate == LS_FAMILY_TIMER) { diff --git a/radio/src/gui/212x64/model_logical_switches.cpp b/radio/src/gui/212x64/model_logical_switches.cpp index 21cceeed5f9..35b6e6e2545 100644 --- a/radio/src/gui/212x64/model_logical_switches.cpp +++ b/radio/src/gui/212x64/model_logical_switches.cpp @@ -207,7 +207,7 @@ void menuModelLogicalSwitches(event_t event) switch (horz) { case LS_FIELD_FUNCTION: { - cs->func = checkIncDec(event, cs->func, 0, LS_FUNC_MAX, EE_MODEL, isLogicalSwitchFunctionAvailable); + cs->func = checkIncDec(event, cs->func, 0, LS_FUNC_MAX, EE_MODEL); uint8_t new_cstate = lswFamily(cs->func); if (cstate != new_cstate) { unsigned int save_func = cs->func; diff --git a/radio/src/gui/colorlcd/model_logical_switches.cpp b/radio/src/gui/colorlcd/model_logical_switches.cpp index eeea054919c..68de66052f7 100644 --- a/radio/src/gui/colorlcd/model_logical_switches.cpp +++ b/radio/src/gui/colorlcd/model_logical_switches.cpp @@ -263,7 +263,6 @@ class LogicalSwitchEditPage : public Page SET_DIRTY(); updateLogicalSwitchOneWindow(); }); - functionChoice->setAvailableHandler(isLogicalSwitchFunctionAvailable); logicalSwitchOneWindow = new FormWindow(window, rect_t{}); updateLogicalSwitchOneWindow(); diff --git a/radio/src/gui/gui_common.cpp b/radio/src/gui/gui_common.cpp index 741ccb19f87..1e8aa476be0 100644 --- a/radio/src/gui/gui_common.cpp +++ b/radio/src/gui/gui_common.cpp @@ -522,24 +522,6 @@ bool isSwitch2POSWarningStateAvailable(int state) } #endif // #if defined(COLORLCD) -//bool isSwitchAvailableInTimers(int swtch) -//{ -// if (swtch >= 0) { -// if (swtch < TMRMODE_COUNT) -// return true; -// else -// swtch -= TMRMODE_COUNT-1; -// } -// else { -// if (swtch > -TMRMODE_COUNT) -// return false; -// else -// swtch += TMRMODE_COUNT-1; -// } -// -// return isSwitchAvailable(swtch, TimersContext); -//} - bool isThrottleSourceAvailable(int src) { #if !defined(LIBOPENUI) @@ -551,11 +533,6 @@ bool isThrottleSourceAvailable(int src) ((src >= MIXSRC_FIRST_CH) && (src <= MIXSRC_LAST_CH))); } -bool isLogicalSwitchFunctionAvailable(int function) -{ - return function != LS_FUNC_RANGE; -} - bool isAssignableFunctionAvailable(int function, CustomFunctionData * functions) { #if defined(OVERRIDE_CHANNEL_FUNCTION) || defined(GVARS) diff --git a/radio/src/gui/gui_common.h b/radio/src/gui/gui_common.h index e213b4eb00e..5c79737ae10 100644 --- a/radio/src/gui/gui_common.h +++ b/radio/src/gui/gui_common.h @@ -64,7 +64,6 @@ enum SwitchContext LogicalSwitchesContext, ModelCustomFunctionsContext, GeneralCustomFunctionsContext, - TimersContext, MixesContext }; @@ -74,7 +73,6 @@ int getFirstAvailable(int min, int max, IsValueAvailable isValueAvailable); bool isInputAvailable(int input); bool isSourceAvailableInInputs(int source); bool isThrottleSourceAvailable(int source); -bool isLogicalSwitchFunctionAvailable(int function); bool isLogicalSwitchAvailable(int index); bool isAssignableFunctionAvailable(int function); bool isSourceAvailable(int source); @@ -89,7 +87,6 @@ int hasSerialMode(int mode); bool isSwitchAvailableInLogicalSwitches(int swtch); bool isSwitchAvailableInCustomFunctions(int swtch); bool isSwitchAvailableInMixes(int swtch); -bool isSwitchAvailableInTimers(int swtch); bool isPxx2IsrmChannelsCountAllowed(int channels); bool isModuleUsingSport(uint8_t moduleBay, uint8_t moduleType); bool isTrainerUsingModuleBay(); diff --git a/radio/src/lua/api_general.cpp b/radio/src/lua/api_general.cpp index 93af382f516..c0f9792c531 100644 --- a/radio/src/lua/api_general.cpp +++ b/radio/src/lua/api_general.cpp @@ -3038,7 +3038,6 @@ LROT_BEGIN(etxcst, NULL, 0) LROT_NUMENTRY( LS_FUNC_VALMOSTEQUAL, LS_FUNC_VALMOSTEQUAL ) LROT_NUMENTRY( LS_FUNC_VPOS, LS_FUNC_VPOS ) LROT_NUMENTRY( LS_FUNC_VNEG, LS_FUNC_VNEG ) - LROT_NUMENTRY( LS_FUNC_RANGE, LS_FUNC_RANGE ) LROT_NUMENTRY( LS_FUNC_APOS, LS_FUNC_APOS ) LROT_NUMENTRY( LS_FUNC_ANEG, LS_FUNC_ANEG ) LROT_NUMENTRY( LS_FUNC_AND, LS_FUNC_AND ) diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index 813b3e10d8f..ffda2b37870 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -210,7 +210,6 @@ enum LogicalSwitchesFunctions { LS_FUNC_VALMOSTEQUAL, // v~=offset LS_FUNC_VPOS, // v>offset LS_FUNC_VNEG, // voffset LS_FUNC_ANEG, // |v|