mirror of
https://github.com/opentx/opentx.git
synced 2025-07-16 21:05:26 +03:00
Fixes #2519: removed telemetry values from available selection in Global Functions for "Play Value"
This commit is contained in:
parent
f845be683c
commit
841f11c21a
9 changed files with 32 additions and 14 deletions
|
@ -669,7 +669,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
|||
if (item == source) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
|
||||
if (model->sensorData[i].isAvailable()) {
|
||||
if (model && model->sensorData[i].isAvailable()) { //this conditon must be false if we populate Global Functions where model = 0
|
||||
for (int j=0; j<3; ++j) {
|
||||
item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i+j);
|
||||
b->addItem(item.toString(model), item.toValue());
|
||||
|
@ -681,7 +681,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
|
|||
}
|
||||
else {
|
||||
for (int i=0; i<(flags & POPULATE_TELEMETRYEXT ? TELEMETRY_SOURCES_STATUS_COUNT : TELEMETRY_SOURCES_COUNT); i++) {
|
||||
if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(board))
|
||||
if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(board)) // TODO this condition is never true since else clause is never taken for ARM boards!!!
|
||||
continue;
|
||||
if (i==TELEMETRY_SOURCE_TX_TIME && !GetCurrentFirmware()->getCapability(RtcTime))
|
||||
continue;
|
||||
|
|
|
@ -86,6 +86,14 @@ bool isSourceAvailable(int source)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool isSourceAvailableInGlobalFunctions(int source)
|
||||
{
|
||||
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
|
||||
return false;
|
||||
}
|
||||
return isSourceAvailable(source);
|
||||
}
|
||||
|
||||
bool isSourceAvailableInCustomSwitches(int source)
|
||||
{
|
||||
bool result = isSourceAvailable(source);
|
||||
|
|
|
@ -104,6 +104,6 @@ const MenuFuncP_PROGMEM menuTabGeneral[] PROGMEM = {
|
|||
void menuGeneralCustomFunctions(uint8_t event)
|
||||
{
|
||||
MENU(STR_MENUGLOBALFUNCS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/});
|
||||
return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext);
|
||||
return menuCustomFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -74,7 +74,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
|
|||
}
|
||||
#endif
|
||||
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext)
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
|
||||
{
|
||||
int8_t sub = m_posVert - 1;
|
||||
|
||||
|
@ -95,7 +95,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
|||
uint8_t active = (attr && (s_editMode>0 || p1valdiff));
|
||||
switch (j) {
|
||||
case 0:
|
||||
putsSwitches(MODEL_CUSTOM_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext.activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
|
||||
putsSwitches(MODEL_CUSTOM_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
|
||||
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
|
||||
break;
|
||||
|
||||
|
@ -278,7 +278,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
|||
else if (func == FUNC_PLAY_VALUE) {
|
||||
val_max = MIXSRC_FIRST_TELEM + TELEM_DISPLAY_MAX - 1;
|
||||
putsMixerSource(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr);
|
||||
INCDEC_ENABLE_CHECK(isSourceAvailable);
|
||||
INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalFunctions : isSourceAvailable);
|
||||
}
|
||||
#endif
|
||||
#if defined(SDCARD)
|
||||
|
@ -377,5 +377,5 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
|||
void menuModelCustomFunctions(uint8_t event)
|
||||
{
|
||||
MENU(STR_MENUCUSTOMFUNC, menuTabModel, e_CustomFunctions, NUM_CFN+1, {0, NAVIGATION_LINE_BY_LINE|4/*repeated*/});
|
||||
return menuCustomFunctions(event, g_model.customFn, modelFunctionsContext);
|
||||
return menuCustomFunctions(event, g_model.customFn, &modelFunctionsContext);
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ void menuTelemetryFrsky(uint8_t event);
|
|||
#endif
|
||||
void menuGeneralSetup(uint8_t event);
|
||||
void menuGeneralCalib(uint8_t event);
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext);
|
||||
|
||||
void menuModelSelect(uint8_t event);
|
||||
void menuModelCustomFunctions(uint8_t event);
|
||||
|
@ -253,6 +253,7 @@ int8_t checkIncDecMovedSwitch(int8_t val);
|
|||
#if defined(CPUARM)
|
||||
bool isInputAvailable(int input);
|
||||
bool isSourceAvailable(int source);
|
||||
bool isSourceAvailableInGlobalFunctions(int source);
|
||||
bool isSourceAvailableInCustomSwitches(int source);
|
||||
bool isInputSourceAvailable(int source);
|
||||
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
|
||||
|
|
|
@ -131,6 +131,14 @@ bool isSourceAvailable(int source)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool isSourceAvailableInGlobalFunctions(int source)
|
||||
{
|
||||
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
|
||||
return false;
|
||||
}
|
||||
return isSourceAvailable(source);
|
||||
}
|
||||
|
||||
bool isSourceAvailableInCustomSwitches(int source)
|
||||
{
|
||||
bool result = isSourceAvailable(source);
|
||||
|
|
|
@ -103,5 +103,5 @@ const MenuFuncP_PROGMEM menuTabGeneral[] PROGMEM = {
|
|||
void menuGeneralCustomFunctions(uint8_t event)
|
||||
{
|
||||
MENU(STR_MENUGLOBALFUNCS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
|
||||
return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext);
|
||||
return menuCustomFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext);
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ void onCustomFunctionsMenu(const char *result)
|
|||
}
|
||||
}
|
||||
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext)
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
|
||||
|
@ -158,7 +158,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
|||
uint8_t active = (attr && s_editMode>0);
|
||||
switch (j) {
|
||||
case 0:
|
||||
putsSwitches(MODEL_CUSTOM_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext.activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
|
||||
putsSwitches(MODEL_CUSTOM_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
|
||||
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
|
||||
if (func == FUNC_OVERRIDE_CHANNEL && functions != g_model.customFn) {
|
||||
func = CFN_FUNC(cfn) = func+1;
|
||||
|
@ -288,7 +288,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
|||
val_max = MIXSRC_LAST_TELEM;
|
||||
putsMixerSource(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr);
|
||||
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
|
||||
INCDEC_ENABLE_CHECK(isSourceAvailable);
|
||||
INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalFunctions : isSourceAvailable);
|
||||
}
|
||||
#endif
|
||||
else if (func == FUNC_VOLUME) {
|
||||
|
@ -390,5 +390,5 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
|||
void menuModelCustomFunctions(uint8_t event)
|
||||
{
|
||||
MENU(STR_MENUCUSTOMFUNC, menuTabModel, e_CustomFunctions, NUM_CFN, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
|
||||
return menuCustomFunctions(event, g_model.customFn, modelFunctionsContext);
|
||||
return menuCustomFunctions(event, g_model.customFn, &modelFunctionsContext);
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ void menuGeneralSetup(uint8_t event);
|
|||
void menuGeneralSdManager(uint8_t event);
|
||||
void menuGeneralCalib(uint8_t event);
|
||||
void menuGeneralVersion(uint8_t event);
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext);
|
||||
|
||||
void menuModelSelect(uint8_t event);
|
||||
void menuModelCustomFunctions(uint8_t event);
|
||||
|
@ -212,6 +212,7 @@ int getFirstAvailable(int min, int max, bool (*func)(int));
|
|||
|
||||
bool isInputAvailable(int input);
|
||||
bool isSourceAvailable(int source);
|
||||
bool isSourceAvailableInGlobalFunctions(int source);
|
||||
bool isSourceAvailableInCustomSwitches(int source);
|
||||
bool isInputSourceAvailable(int source);
|
||||
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue