feat(bw): make source selection consistent with color screen radios (#6685)

This commit is contained in:
philmoz
2025-10-19 12:58:30 +10:00
committed by GitHub
parent 75e8566623
commit fe919c0b31
9 changed files with 8 additions and 45 deletions
+2 -3
View File
@@ -588,9 +588,8 @@ enum SrcTypes {
SRC_TX = 1 << 16,
SRC_TIMER = 1 << 17,
SRC_TELEM = 1 << 18,
SRC_TELEM_COMP = 1 << 19,
SRC_NONE = 1 << 20,
SRC_INVERT = 1 << 21,
SRC_NONE = 1 << 19,
SRC_INVERT = 1 << 20,
};
enum BacklightMode {
+1 -1
View File
@@ -100,7 +100,7 @@ void menuModelExpoOne(event_t event)
lcdDrawTextAlignedLeft(y, STR_SOURCE);
drawSource(EXPO_ONE_2ND_COLUMN, y, ed->srcRaw, STREXPANDED|attr);
if (attr)
ed->srcRaw = checkIncDec(event, ed->srcRaw, INPUTSRC_FIRST, INPUTSRC_LAST, EE_MODEL|INCDEC_SOURCE|INCDEC_SOURCE_INVERT|NO_INCDEC_MARKS, isSourceAvailableInInputs);
ed->srcRaw = checkIncDec(event, ed->srcRaw, INPUTSRC_FIRST, INPUTSRC_LAST, EE_MODEL|INCDEC_SOURCE|INCDEC_SOURCE_INVERT|NO_INCDEC_MARKS, isSourceAvailable);
break;
case EXPO_FIELD_SCALE:
@@ -385,7 +385,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN - (val_displayed == 0 ? 0 : 2 * FW), y, val_displayed, attr);
if (active) {
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE | INCDEC_SOURCE_INVERT);
INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalFunctions : isSourceAvailable);
INCDEC_ENABLE_CHECK(isSourceAvailable);
}
}
else if (func == FUNC_VOLUME) {
+1 -1
View File
@@ -102,7 +102,7 @@ void menuModelExpoOne(event_t event)
lcdDrawTextAlignedLeft(y, STR_SOURCE);
drawSource(EXPO_ONE_2ND_COLUMN, y, ed->srcRaw, STREXPANDED|attr);
if (attr && menuHorizontalPosition==0)
ed->srcRaw = checkIncDec(event, ed->srcRaw, INPUTSRC_FIRST, INPUTSRC_LAST, EE_MODEL|INCDEC_SOURCE|INCDEC_SOURCE_INVERT|NO_INCDEC_MARKS, isSourceAvailableInInputs);
ed->srcRaw = checkIncDec(event, ed->srcRaw, INPUTSRC_FIRST, INPUTSRC_LAST, EE_MODEL|INCDEC_SOURCE|INCDEC_SOURCE_INVERT|NO_INCDEC_MARKS, isSourceAvailable);
if (abs(ed->srcRaw) >= MIXSRC_FIRST_TELEM) {
drawSensorCustomValue(EXPO_ONE_2ND_COLUMN+30, y, (abs(ed->srcRaw) - MIXSRC_FIRST_TELEM)/3, getValue(ed->srcRaw), LEFT|(menuHorizontalPosition==1?attr:0));
if (attr && menuHorizontalPosition == 1) ed->scale = checkIncDec(event, ed->scale, 0, maxTelemValue(abs(ed->srcRaw) - MIXSRC_FIRST_TELEM + 1), EE_MODEL);
@@ -166,7 +166,7 @@ void menuModelLogicalSwitches(event_t event)
drawSource(CSW_2ND_COLUMN, y, v1_val, attr1);
if (horz == 1) {
INCDEC_SET_FLAG(EE_MODEL | INCDEC_SOURCE | INCDEC_SOURCE_INVERT);
INCDEC_ENABLE_CHECK(isSourceAvailableInCustomSwitches);
INCDEC_ENABLE_CHECK(isSourceAvailable);
}
else {
INCDEC_SET_FLAG(EE_MODEL);
@@ -358,7 +358,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr);
if (active) {
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE | INCDEC_SOURCE_INVERT);
INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalFunctions : isSourceAvailable);
INCDEC_ENABLE_CHECK(isSourceAvailable);
}
}
else if (func == FUNC_VOLUME) {
+1 -1
View File
@@ -64,7 +64,7 @@ void insertExpo(uint8_t idx)
} else {
expo->srcRaw = MIXSRC_FIRST_STICK + inputMappingChannelOrder(i - 1);
}
if (isSourceAvailableInInputs(expo->srcRaw)) {
if (isSourceAvailable(expo->srcRaw)) {
break;
}
}
-33
View File
@@ -247,13 +247,6 @@ static bool isSourceTelemAvailable(int source) {
return isTelemetryFieldComparisonAvailable(qr.quot);
}
static bool isSourceTelemCompAvailable(int source) {
if (!modelTelemetryEnabled())
return false;
div_t qr = div(source, 3);
return isTelemetryFieldComparisonAvailable(qr.quot);
}
struct sourceAvailableCheck {
uint16_t first;
uint16_t last;
@@ -287,7 +280,6 @@ static struct sourceAvailableCheck sourceChecks[] = {
{ MIXSRC_TX_VOLTAGE, MIXSRC_TX_GPS, SRC_TX, sourceIsAvailable },
{ MIXSRC_FIRST_TIMER, MIXSRC_LAST_TIMER, SRC_TIMER, isSourceTimerAvailable },
{ MIXSRC_FIRST_TELEM, MIXSRC_LAST_TELEM, SRC_TELEM, isSourceTelemAvailable },
{ MIXSRC_FIRST_TELEM, MIXSRC_LAST_TELEM, SRC_TELEM_COMP, isSourceTelemCompAvailable },
{ MIXSRC_NONE, MIXSRC_NONE, SRC_NONE, sourceIsAvailable },
};
@@ -316,31 +308,6 @@ bool isSourceAvailable(int source)
);
}
// Used only in B&W radios for Global Functions when funcion is FUNC_PLAY_VALUE
bool isSourceAvailableInGlobalFunctions(int source)
{
return checkSourceAvailable(source,
SRC_COMMON | SRC_INPUT | SRC_LUA | SRC_HELI | SRC_CHANNEL | SRC_TX | SRC_TIMER | SRC_NONE
);
}
// Used only in B&W radios with wide screen LCD (212x64) for logical switches
// V1 parameter when LS function is LS_FAMILY_OFS or LS_FAMILY_DIFF
bool isSourceAvailableInCustomSwitches(int source)
{
return checkSourceAvailable(source,
SRC_COMMON | SRC_INPUT | SRC_LUA | SRC_HELI | SRC_CHANNEL | SRC_TX | SRC_TIMER | SRC_TELEM_COMP | SRC_NONE
);
}
// Only used for B&W radios for Input source (color radios use isSourceAvailable)
bool isSourceAvailableInInputs(int source)
{
return checkSourceAvailable(source,
SRC_COMMON | SRC_CHANNEL_ALL | SRC_TELEM_COMP
);
}
bool isLogicalSwitchAvailable(int index)
{
LogicalSwitchData * lsw = lswAddress(index);
-3
View File
@@ -56,15 +56,12 @@ int getFirstAvailable(int min, int max, IsValueAvailable isValueAvailable);
bool checkSourceAvailable(int source, uint32_t sourceTypes);
bool checkSwitchAvailable(int swtch, uint32_t swtchTypes);
bool isInputAvailable(int input);
bool isSourceAvailableInInputs(int source);
bool isThrottleSourceAvailable(int source);
bool isLogicalSwitchAvailable(int index);
bool isAssignableFunctionAvailable(int function);
bool isSourceAvailable(int source);
int timersSetupCount();
bool isTimerSourceAvailable(int source);
bool isSourceAvailableInGlobalFunctions(int source);
bool isSourceAvailableInCustomSwitches(int source);
bool isSourceAvailableInResetSpecialFunction(int index);
bool isSourceAvailableInGlobalResetSpecialFunction(int index);
bool isSwitchAvailable(int swtch, SwitchContext context);