fix(cpn): Only timers with active modes should be included in lists (#3956)
* disable timers with mode OFF * fix isModeOff to reference mode not switch * update model edit source lists when timer mode changed * add timer mode test to reset function * add timer mode test for Set and Reset functions * change yaml special source TIMERx to Tmrx
This commit is contained in:
@@ -240,7 +240,7 @@ QString CustomFunctionData::enabledToString() const
|
||||
}
|
||||
|
||||
// static
|
||||
bool CustomFunctionData::isFuncAvailable(const int index)
|
||||
bool CustomFunctionData::isFuncAvailable(const int index, const ModelData * model)
|
||||
{
|
||||
Firmware * fw = getCurrentFirmware();
|
||||
|
||||
@@ -250,7 +250,8 @@ bool CustomFunctionData::isFuncAvailable(const int index)
|
||||
((index == FuncPlayHaptic) && !fw->getCapability(Haptic)) ||
|
||||
((index == FuncPlayBoth) && !fw->getCapability(HasBeeper)) ||
|
||||
((index == FuncLogs) && !fw->getCapability(HasSDLogs)) ||
|
||||
((index >= FuncSetTimer1 && index <= FuncSetTimerLast) && index > FuncSetTimer1 + fw->getCapability(Timers)) ||
|
||||
((index >= FuncSetTimer1 && index <= FuncSetTimerLast) &&
|
||||
(index > FuncSetTimer1 + fw->getCapability(Timers) || model->timers[index - FuncSetTimer1].isModeOff())) ||
|
||||
((index == FuncScreenshot) && !IS_HORUS_OR_TARANIS(fw->getBoard())) ||
|
||||
((index >= FuncRangeCheckInternalModule && index <= FuncBindExternalModule) && !fw->getCapability(DangerousFunctions)) ||
|
||||
((index >= FuncAdjustGV1 && index <= FuncAdjustGVLast) && !fw->getCapability(Gvars)) ||
|
||||
@@ -312,7 +313,7 @@ bool CustomFunctionData::isResetParamAvailable(const int index, const ModelData
|
||||
Firmware * firmware = getCurrentFirmware();
|
||||
|
||||
if (index < CPN_MAX_TIMERS) {
|
||||
if (index < firmware->getCapability(Timers))
|
||||
if (index < firmware->getCapability(Timers) && !model->timers[index].isModeOff())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user