feat(radio): refactor of switch handling to better support customisable switches (#6095)

Co-authored-by: philmoz <phil.a.mitchell@gmail.com>
Co-authored-by: 3djc <3djc@gh.com>
Co-authored-by: elecpower <elecpower@users.noreply.github.com>
This commit is contained in:
philmoz
2025-07-28 12:59:22 +10:00
committed by GitHub
co-authored by philmoz 3djc elecpower
parent 28833f42e6
commit 0c8c39b134
155 changed files with 4538 additions and 2306 deletions
+17 -1
View File
@@ -293,6 +293,22 @@ void setDefaultOwnerId()
}
#endif
void generalDefaultSwitches()
{
for (uint8_t sw = 0; sw < switchGetMaxSwitches(); sw += 1) {
g_eeGeneral.switchConfig[sw].type = switchGetDefaultConfig(sw);
g_eeGeneral.switchConfig[sw].name[0] = 0;
#if defined(FUNCTION_SWITCHES)
if (switchIsCustomSwitch(sw))
g_eeGeneral.switchConfig[sw].start = FS_START_PREVIOUS;
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
g_eeGeneral.switchConfig[sw].onColor.setColor(0xFFFFFF);
g_eeGeneral.switchConfig[sw].offColor.setColor(0);
#endif
#endif
}
}
void generalDefault()
{
memclear(&g_eeGeneral, sizeof(g_eeGeneral));
@@ -318,7 +334,7 @@ void generalDefault()
adcCalibDefaults();
g_eeGeneral.potsConfig = adcGetDefaultPotsConfig();
g_eeGeneral.switchConfig = switchGetDefaultConfig();
generalDefaultSwitches();
#if defined(STICK_DEAD_ZONE)
g_eeGeneral.stickDeadZone = DEFAULT_STICK_DEADZONE;