diff --git a/radio/src/gui/128x64/radio_version.cpp b/radio/src/gui/128x64/radio_version.cpp index e3e0dfd64..f2af1a976 100644 --- a/radio/src/gui/128x64/radio_version.cpp +++ b/radio/src/gui/128x64/radio_version.cpp @@ -18,7 +18,6 @@ * GNU General Public License for more details. */ -#include #include "opentx.h" // TODO duplicated code @@ -33,6 +32,8 @@ #define MENU_BODY_TOP (FH + 1) #define MENU_BODY_BOTTOM (LCD_H) +constexpr uint8_t COLUMN2_X = 11 * FW; + #if defined(PXX2) void drawPXX2Version(coord_t x, coord_t y, PXX2Version version) { @@ -65,11 +66,11 @@ void menuRadioModulesVersion(event_t event) title(STR_MENU_MODULES_RX_VERSION); - if (event == EVT_ENTRY || get_tmr10ms() >= reusableBuffer.hardwareAndSettings.updateTime) { - // menuVerticalOffset = 0; - + if (event == EVT_ENTRY) { memclear(&reusableBuffer.hardwareAndSettings.modules, sizeof(reusableBuffer.hardwareAndSettings.modules)); + } + if (event == EVT_ENTRY || get_tmr10ms() >= reusableBuffer.hardwareAndSettings.updateTime) { if (isModulePXX2(INTERNAL_MODULE) && IS_INTERNAL_MODULE_ON()) { moduleState[INTERNAL_MODULE].readModuleInformation(&reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE], PXX2_HW_INFO_TX_ID, PXX2_MAX_RECEIVERS_PER_MODULE - 1); } @@ -108,7 +109,7 @@ 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; - lcdDrawText(12 * FW, y, PXX2modulesModels[modelId]); + lcdDrawText(COLUMN2_X, y, PXX2modulesModels[modelId]); } y += FH; @@ -116,25 +117,30 @@ void menuRadioModulesVersion(event_t event) if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) { lcdDrawText(INDENT_WIDTH, y, "Version"); if (reusableBuffer.hardwareAndSettings.modules[module].information.modelID) { - drawPXX2FullVersion(12 * FW, y, reusableBuffer.hardwareAndSettings.modules[module].information.hwVersion, reusableBuffer.hardwareAndSettings.modules[module].information.swVersion); + drawPXX2FullVersion(COLUMN2_X, y, reusableBuffer.hardwareAndSettings.modules[module].information.hwVersion, reusableBuffer.hardwareAndSettings.modules[module].information.swVersion); + static const char * variants[] = {"FCC", "EU", "FLEX"}; + uint8_t variant = reusableBuffer.hardwareAndSettings.modules[module].information.variant - 1; + if (variant < DIM(variants)) { + lcdDrawText(lcdNextPos + 1, y, variants[variant]); + } } } y += FH; for (uint8_t receiver=0; receiver= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) { lcdDrawText(INDENT_WIDTH, y, "Receiver"); lcdDrawNumber(lcdLastRightPos + 2, y, receiver + 1); uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID; - lcdDrawText(12 * FW, y, PXX2receiversModels[modelId]); + lcdDrawText(COLUMN2_X, y, PXX2receiversModels[modelId]); } y += FH; // Receiver version if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) { - drawPXX2FullVersion(12 * FW, y, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.hwVersion, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.swVersion); + drawPXX2FullVersion(COLUMN2_X, y, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.hwVersion, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.swVersion); } y += FH; } diff --git a/radio/src/pulses/pulses.h b/radio/src/pulses/pulses.h index 95f29544e..35c9a6cf1 100644 --- a/radio/src/pulses/pulses.h +++ b/radio/src/pulses/pulses.h @@ -103,6 +103,7 @@ PACK(struct ModuleInformation { PXX2HardwareInformation information; struct { PXX2HardwareInformation information; + tmr10ms_t timestamp; } receivers[PXX2_MAX_RECEIVERS_PER_MODULE]; }); diff --git a/radio/src/telemetry/frsky_pxx2.cpp b/radio/src/telemetry/frsky_pxx2.cpp index 3590c16e6..5e051a1b1 100644 --- a/radio/src/telemetry/frsky_pxx2.cpp +++ b/radio/src/telemetry/frsky_pxx2.cpp @@ -58,6 +58,7 @@ void processGetHardwareInfoFrame(uint8_t module, uint8_t * frame) } else if (index < PXX2_MAX_RECEIVERS_PER_MODULE && modelId < DIM(PXX2receiversModels)) { memcpy(&destination->receivers[index].information, &frame[4], sizeof(PXX2HardwareInformation)); + destination->receivers[index].timestamp = get_tmr10ms(); } }