Multi : support SX1276 power indication and protect against unknown options coming from multi
This commit is contained in:
@@ -1544,7 +1544,9 @@ void menuModelSetup(event_t event)
|
||||
const uint8_t multi_proto = g_model.moduleData[moduleIdx].getMultiProtocol();
|
||||
|
||||
if (status.isValid()) {
|
||||
MultiModuleStatus &status = getMultiModuleStatus(moduleIdx);
|
||||
if (status.optionDisp >= getMaxMultiOptions()) {
|
||||
status.optionDisp = 1; // Unknown options are defaulted to type 1 (basic option)
|
||||
}
|
||||
lcdDrawText(INDENT_WIDTH, y, mm_options_strings::options[status.optionDisp]);
|
||||
if (attr && status.optionDisp == 2) {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN + 23, y, "RSSI(", LEFT);
|
||||
|
||||
@@ -1299,6 +1299,9 @@ void menuModelSetup(event_t event)
|
||||
MultiModuleStatus &status = getMultiModuleStatus(moduleIdx);
|
||||
const uint8_t multi_proto = g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol();
|
||||
if (status.isValid()) {
|
||||
if (status.optionDisp >= getMaxMultiOptions()) {
|
||||
status.optionDisp = 1; // Unknown options are defaulted to type 1 (basic option)
|
||||
}
|
||||
lcdDrawText(INDENT_WIDTH, y, mm_options_strings::options[status.optionDisp]);
|
||||
if (attr && status.optionDisp == 2) {
|
||||
lcdDrawText(MODEL_SETUP_3RD_COLUMN+22, y, "RSSI(", LEFT);
|
||||
|
||||
@@ -1681,6 +1681,9 @@ bool menuModelSetup(event_t event)
|
||||
MultiModuleStatus &status = getMultiModuleStatus(moduleIdx);
|
||||
const uint8_t multi_proto = g_model.moduleData[moduleIdx].getMultiProtocol();
|
||||
if (status.isValid()) {
|
||||
if (status.optionDisp >= getMaxMultiOptions()) {
|
||||
status.optionDisp = 1; // Unknown options are defaulted to type 1 (basic option)
|
||||
}
|
||||
lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, mm_options_strings::options[status.optionDisp]);
|
||||
if (attr && status.optionDisp == 2) {
|
||||
lcdDrawNumber(LCD_W - 10, y, TELEMETRY_RSSI(), RIGHT, 0, "RSSI(", ")");
|
||||
|
||||
@@ -997,6 +997,11 @@ const char* mm_options_strings::options[] = {
|
||||
STR_MULTI_RFPOWER
|
||||
};
|
||||
|
||||
const uint8_t getMaxMultiOptions()
|
||||
{
|
||||
return DIM(mm_options_strings::options);
|
||||
}
|
||||
|
||||
const mm_protocol_definition multi_protocols[] = {
|
||||
// Protocol as defined in pulses\modules_constants.h, number of sub_protocols - 1, Failsafe supported, Disable channel mapping supported, Subtype string, Option type
|
||||
{MODULE_SUBTYPE_MULTI_FLYSKY, 4, false, true, STR_SUBTYPE_FLYSKY, nullptr},
|
||||
|
||||
Reference in New Issue
Block a user