feat(radio): Disable Special Functions when feature turned off (#4116)
This commit is contained in:
@@ -631,8 +631,12 @@ static bool luaLoadFunctionScript(uint8_t ref)
|
|||||||
CustomFunctionData * fn;
|
CustomFunctionData * fn;
|
||||||
|
|
||||||
if (ref <= SCRIPT_FUNC_LAST) {
|
if (ref <= SCRIPT_FUNC_LAST) {
|
||||||
idx = ref - SCRIPT_FUNC_FIRST;
|
if (modelSFEnabled()) {
|
||||||
fn = &g_model.customFn[idx];
|
idx = ref - SCRIPT_FUNC_FIRST;
|
||||||
|
fn = &g_model.customFn[idx];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (radioGFEnabled()) {
|
else if (radioGFEnabled()) {
|
||||||
idx = ref - SCRIPT_GFUNC_FIRST;
|
idx = ref - SCRIPT_GFUNC_FIRST;
|
||||||
@@ -1101,10 +1105,12 @@ static bool resumeLua(bool init, bool allowLcdUsage)
|
|||||||
CustomFunctionsContext * functionsContext;
|
CustomFunctionsContext * functionsContext;
|
||||||
|
|
||||||
if (ref <= SCRIPT_FUNC_LAST) {
|
if (ref <= SCRIPT_FUNC_LAST) {
|
||||||
|
if (!modelSFEnabled()) continue;
|
||||||
idx = ref - SCRIPT_FUNC_FIRST;
|
idx = ref - SCRIPT_FUNC_FIRST;
|
||||||
fn = &g_model.customFn[idx];
|
fn = &g_model.customFn[idx];
|
||||||
functionsContext = &modelFunctionsContext;
|
functionsContext = &modelFunctionsContext;
|
||||||
} else {
|
} else {
|
||||||
|
if (!radioGFEnabled()) continue;
|
||||||
idx = ref - SCRIPT_GFUNC_FIRST;
|
idx = ref - SCRIPT_GFUNC_FIRST;
|
||||||
fn = &g_eeGeneral.customFn[idx];
|
fn = &g_eeGeneral.customFn[idx];
|
||||||
functionsContext = &globalFunctionsContext;
|
functionsContext = &globalFunctionsContext;
|
||||||
|
|||||||
+5
-1
@@ -1079,7 +1079,11 @@ void evalMixes(uint8_t tick10ms)
|
|||||||
} else {
|
} else {
|
||||||
globalFunctionsContext.reset();
|
globalFunctionsContext.reset();
|
||||||
}
|
}
|
||||||
evalFunctions(g_model.customFn, modelFunctionsContext);
|
if (modelSFEnabled()) {
|
||||||
|
evalFunctions(g_model.customFn, modelFunctionsContext);
|
||||||
|
} else {
|
||||||
|
modelFunctionsContext.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//========== LIMITS ===============
|
//========== LIMITS ===============
|
||||||
|
|||||||
Reference in New Issue
Block a user