Sanity check

This commit is contained in:
Bertrand Songis
2019-04-29 12:21:25 +02:00
parent 957b6ed5e3
commit fef6e80f4a
3 changed files with 6 additions and 7 deletions
@@ -85,7 +85,7 @@ void menuModelModuleOptions(event_t event)
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.modelID;
// uint8_t variant = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.variant;
uint8_t optionsAvailable = moduleOptions[g_moduleIdx] & ((1 << MODULE_OPTION_RF_PROTOCOL) | (1 << MODULE_OPTION_RF_PROTOCOL) | (1 << MODULE_OPTION_RF_PROTOCOL));
uint8_t optionsAvailable = moduleOptions[modelId] & ((1 << MODULE_OPTION_RF_PROTOCOL) | (1 << MODULE_OPTION_RF_PROTOCOL) | (1 << MODULE_OPTION_RF_PROTOCOL));
SUBMENU_NOTITLE(ITEM_MODULE_SETTINGS_COUNT, {
!optionsAvailable ? (uint8_t)0 : IF_MODULE_OPTIONS(MODULE_OPTION_RF_PROTOCOL, 0),
-4
View File
@@ -108,8 +108,6 @@ void menuRadioModulesVersion(event_t event)
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
lcdDrawText(INDENT_WIDTH, y, "Model");
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].information.modelID;
if (modelId >= DIM(PXX2modulesModels))
modelId = 0;
lcdDrawText(12 * FW, y, PXX2modulesModels[modelId]);
}
y += FH;
@@ -130,8 +128,6 @@ void menuRadioModulesVersion(event_t event)
lcdDrawText(INDENT_WIDTH, y, "Receiver");
lcdDrawNumber(lcdLastRightPos + 2, y, receiver + 1);
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID;
if (modelId >= DIM(PXX2receiversModels))
modelId = 0;
lcdDrawText(12 * FW, y, PXX2receiversModels[modelId]);
}
y += FH;
+5 -2
View File
@@ -52,10 +52,13 @@ void processGetHardwareInfoFrame(uint8_t module, uint8_t * frame)
ModuleInformation * destination = moduleState[module].moduleInformation;
uint8_t index = frame[3];
if (index == 0xFF)
uint8_t modelId = frame[4];
if (index == PXX2_HW_INFO_TX_ID && modelId < DIM(PXX2modulesModels)) {
memcpy(&destination->information, &frame[4], sizeof(PXX2HardwareInformation));
else if (index < PXX2_MAX_RECEIVERS_PER_MODULE)
}
else if (index < PXX2_MAX_RECEIVERS_PER_MODULE && modelId < DIM(PXX2receiversModels)) {
memcpy(&destination->receivers[index].information, &frame[4], sizeof(PXX2HardwareInformation));
}
}
void processModuleSettingsFrame(uint8_t module, uint8_t * frame)