From 685911efab486b2551cd14a619d8fd85465614ff Mon Sep 17 00:00:00 2001 From: 3djc Date: Wed, 6 Feb 2019 10:42:26 +0100 Subject: [PATCH] For channel mapping testing --- radio/src/gui/128x64/model_setup.cpp | 17 +++++++++++++++-- radio/src/pulses/pxx2.h | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index 0b60c85b4..25651de8a 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -1065,8 +1065,21 @@ void menuModelSetup(event_t event) case ITEM_MODEL_INTERNAL_MODULE_RECEIVER_1_RANGE: case ITEM_MODEL_INTERNAL_MODULE_RECEIVER_2_RANGE: { - lcdDrawTextAlignedLeft(y, TR_CHANNELRANGE); - lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, "Ch 1 - 8",0); + //TODO have a proper channel assignement screen, section bellow is just for tests + uint8_t useUpperChannels; + uint8_t receiverIdx = CURRENT_RECEIVER_EDITED(k); + + if (memcmp(&g_model.moduleData[INTERNAL_MODULE].pxx2.receivers[receiverIdx].channelMapping, DEFAULT_CHANNEL_MAPPING, sizeof(uint64_t)) == 0) + useUpperChannels = 0; + else + useUpperChannels = 1; + + useUpperChannels = editCheckBox(useUpperChannels, MODEL_SETUP_2ND_COLUMN, y, INDENT "Use CH9-16", attr, event); + + if (useUpperChannels) + memcpy(&g_model.moduleData[INTERNAL_MODULE].pxx2.receivers[receiverIdx].channelMapping, CH9TO16_CHANNEL_MAPPING, sizeof(uint64_t)); + else + memcpy(&g_model.moduleData[INTERNAL_MODULE].pxx2.receivers[receiverIdx].channelMapping, DEFAULT_CHANNEL_MAPPING, sizeof(uint64_t)); } break; diff --git a/radio/src/pulses/pxx2.h b/radio/src/pulses/pxx2.h index 077bac050..fc5ac6ddd 100644 --- a/radio/src/pulses/pxx2.h +++ b/radio/src/pulses/pxx2.h @@ -39,6 +39,7 @@ #define PXX2_FLAG0_FAILSAFE (1 << 6) const uint8_t DEFAULT_CHANNEL_MAPPING[] = {0x12, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; +const uint8_t CH9TO16_CHANNEL_MAPPING[] = {0x89, 0xAB, 0xCD, 0xEF, 0x12, 0x23, 0x45, 0x67}; class ModuleFifo : public Fifo { public: