fix(radio): YAML timer handling (#3949)

* fix: YAML timer handling

* chore: improve YAML set timer handling

* chore: improve timer handling

* feat: only offer defined timer for set and reset functions

* feat: only offer defined timer for set and reset functions (bw)

* chore: cosmetics
This commit is contained in:
3djc
2023-08-28 20:02:03 +10:00
committed by GitHub
parent e56cffafa9
commit 78aa381464
19 changed files with 61 additions and 82 deletions
+13 -9
View File
@@ -608,6 +608,12 @@ bool isAssignableFunctionAvailable(int function)
}
#endif
bool isTimerSourceAvailable(int index)
{
TimerData *timer = &g_model.timers[index];
return timer->mode != 0;
}
bool isSourceAvailableInGlobalResetSpecialFunction(int index)
{
if (index >= FUNC_RESET_PARAM_FIRST_TELEM)
@@ -622,16 +628,14 @@ bool isSourceAvailableInResetSpecialFunction(int index)
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[index-FUNC_RESET_PARAM_FIRST_TELEM];
return telemetrySensor.isAvailable();
}
#if TIMERS < 3
else if (index == FUNC_RESET_TIMER3) {
return false;
else if (index <= FUNC_RESET_TIMER3) {
if (index > (TIMERS - 1))
return false;
else {
TimerData *timer = &g_model.timers[index];
return timer->mode != 0;
}
}
#endif
#if TIMERS < 2
else if (index == FUNC_RESET_TIMER2) {
return false;
}
#endif
else {
return true;
}