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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user