Radio / Version: FCC / EU variant displayed
This commit is contained in:
@@ -18,7 +18,6 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <opentx.h>
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
// TODO duplicated code
|
// TODO duplicated code
|
||||||
@@ -33,6 +32,8 @@
|
|||||||
#define MENU_BODY_TOP (FH + 1)
|
#define MENU_BODY_TOP (FH + 1)
|
||||||
#define MENU_BODY_BOTTOM (LCD_H)
|
#define MENU_BODY_BOTTOM (LCD_H)
|
||||||
|
|
||||||
|
constexpr uint8_t COLUMN2_X = 11 * FW;
|
||||||
|
|
||||||
#if defined(PXX2)
|
#if defined(PXX2)
|
||||||
void drawPXX2Version(coord_t x, coord_t y, PXX2Version version)
|
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);
|
title(STR_MENU_MODULES_RX_VERSION);
|
||||||
|
|
||||||
if (event == EVT_ENTRY || get_tmr10ms() >= reusableBuffer.hardwareAndSettings.updateTime) {
|
if (event == EVT_ENTRY) {
|
||||||
// menuVerticalOffset = 0;
|
|
||||||
|
|
||||||
memclear(&reusableBuffer.hardwareAndSettings.modules, sizeof(reusableBuffer.hardwareAndSettings.modules));
|
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()) {
|
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);
|
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) {
|
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||||
lcdDrawText(INDENT_WIDTH, y, "Model");
|
lcdDrawText(INDENT_WIDTH, y, "Model");
|
||||||
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].information.modelID;
|
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].information.modelID;
|
||||||
lcdDrawText(12 * FW, y, PXX2modulesModels[modelId]);
|
lcdDrawText(COLUMN2_X, y, PXX2modulesModels[modelId]);
|
||||||
}
|
}
|
||||||
y += FH;
|
y += FH;
|
||||||
|
|
||||||
@@ -116,25 +117,30 @@ void menuRadioModulesVersion(event_t event)
|
|||||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||||
lcdDrawText(INDENT_WIDTH, y, "Version");
|
lcdDrawText(INDENT_WIDTH, y, "Version");
|
||||||
if (reusableBuffer.hardwareAndSettings.modules[module].information.modelID) {
|
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;
|
y += FH;
|
||||||
|
|
||||||
for (uint8_t receiver=0; receiver<PXX2_MAX_RECEIVERS_PER_MODULE; receiver++) {
|
for (uint8_t receiver=0; receiver<PXX2_MAX_RECEIVERS_PER_MODULE; receiver++) {
|
||||||
if (reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID) {
|
if (reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID && reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].timestamp < get_tmr10ms() + 2000) {
|
||||||
// Receiver model
|
// Receiver model
|
||||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||||
lcdDrawText(INDENT_WIDTH, y, "Receiver");
|
lcdDrawText(INDENT_WIDTH, y, "Receiver");
|
||||||
lcdDrawNumber(lcdLastRightPos + 2, y, receiver + 1);
|
lcdDrawNumber(lcdLastRightPos + 2, y, receiver + 1);
|
||||||
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID;
|
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;
|
y += FH;
|
||||||
|
|
||||||
// Receiver version
|
// Receiver version
|
||||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
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;
|
y += FH;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ PACK(struct ModuleInformation {
|
|||||||
PXX2HardwareInformation information;
|
PXX2HardwareInformation information;
|
||||||
struct {
|
struct {
|
||||||
PXX2HardwareInformation information;
|
PXX2HardwareInformation information;
|
||||||
|
tmr10ms_t timestamp;
|
||||||
} receivers[PXX2_MAX_RECEIVERS_PER_MODULE];
|
} receivers[PXX2_MAX_RECEIVERS_PER_MODULE];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ void processGetHardwareInfoFrame(uint8_t module, uint8_t * frame)
|
|||||||
}
|
}
|
||||||
else if (index < PXX2_MAX_RECEIVERS_PER_MODULE && modelId < DIM(PXX2receiversModels)) {
|
else if (index < PXX2_MAX_RECEIVERS_PER_MODULE && modelId < DIM(PXX2receiversModels)) {
|
||||||
memcpy(&destination->receivers[index].information, &frame[4], sizeof(PXX2HardwareInformation));
|
memcpy(&destination->receivers[index].information, &frame[4], sizeof(PXX2HardwareInformation));
|
||||||
|
destination->receivers[index].timestamp = get_tmr10ms();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user