diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 9ce05fba1..7d6447ade 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -663,7 +663,7 @@ void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, uint function, unsi } if (IS_ARM(firmware->getBoard())) { for (int i=0; isensorData[i].isAvailable()) { + if (model && model->sensorData[i].isAvailable()) { RawSource item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i); qs.append(item.toString(model)); } diff --git a/radio/src/gui/Taranis/helpers.cpp b/radio/src/gui/Taranis/helpers.cpp index 86e7dabee..d60934a3c 100755 --- a/radio/src/gui/Taranis/helpers.cpp +++ b/radio/src/gui/Taranis/helpers.cpp @@ -353,7 +353,15 @@ bool isAssignableFunctionAvailable(int function) } } -bool isAvailableInResetSpecialFunction(int index) +bool isSourceAvailableInGlobalResetSpecialFunction(int index) +{ + if (index >= FUNC_RESET_PARAM_FIRST_TELEM) + return false; + else + return isSourceAvailableInResetSpecialFunction(index); +} + +bool isSourceAvailableInResetSpecialFunction(int index) { if (index >= FUNC_RESET_PARAM_FIRST_TELEM) { TelemetrySensor & telemetrySensor = g_model.telemetrySensors[index-FUNC_RESET_PARAM_FIRST_TELEM]; diff --git a/radio/src/gui/Taranis/menu_model_custom_functions.cpp b/radio/src/gui/Taranis/menu_model_custom_functions.cpp index c3f55f83d..3c59042d4 100644 --- a/radio/src/gui/Taranis/menu_model_custom_functions.cpp +++ b/radio/src/gui/Taranis/menu_model_custom_functions.cpp @@ -231,7 +231,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu TelemetrySensor * sensor = & g_model.telemetrySensors[param-FUNC_RESET_PARAM_FIRST_TELEM]; lcd_putsnAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, sensor->label, TELEM_LABEL_LEN, attr|ZCHAR); } - INCDEC_ENABLE_CHECK(isAvailableInResetSpecialFunction); + INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalResetSpecialFunction : isSourceAvailableInResetSpecialFunction); } #if defined(OVERRIDE_CHANNEL_FUNCTION) else if (func == FUNC_OVERRIDE_CHANNEL) { diff --git a/radio/src/gui/Taranis/menus.h b/radio/src/gui/Taranis/menus.h index 8283b6a25..489777aa2 100755 --- a/radio/src/gui/Taranis/menus.h +++ b/radio/src/gui/Taranis/menus.h @@ -196,7 +196,8 @@ int8_t checkIncDecMovedSwitch(int8_t val); bool isThrottleSourceAvailable(int source); bool isLogicalSwitchFunctionAvailable(int function); bool isAssignableFunctionAvailable(int function); -bool isAvailableInResetSpecialFunction(int index); +bool isSourceAvailableInResetSpecialFunction(int index); +bool isSourceAvailableInGlobalResetSpecialFunction(int index); bool isLogicalSwitchAvailable(int index); bool isSwitchAvailableInLogicalSwitches(int swtch); bool isSwitchAvailableInCustomFunctions(int swtch);