mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 00:35:18 +03:00
1 byte flash saved :)
This commit is contained in:
parent
e6961585d7
commit
ed1d01e33a
3 changed files with 11 additions and 3 deletions
|
@ -1040,13 +1040,13 @@ void menuModelSetup(event_t event)
|
|||
lcdDrawTextAlignedLeft(y, "Receiver");
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, "[Add]", attr);
|
||||
if (attr && s_editMode>0) {
|
||||
if(g_model.moduleData[INTERNAL_MODULE].pxx2.receivers[0].enabled) {
|
||||
if (g_model.moduleData[INTERNAL_MODULE].pxx2.receivers[0].enabled) {
|
||||
g_model.moduleData[INTERNAL_MODULE].pxx2.receivers[1].enabled = 0x01;
|
||||
memcpy(&g_model.moduleData[INTERNAL_MODULE].pxx2.receivers[1].channelMapping, "\x01\x23\x45\x67\x89\xAB\xCD\xEF", 8); //default map 1-1 16-16
|
||||
memcpy(&g_model.moduleData[INTERNAL_MODULE].pxx2.receivers[1].channelMapping, DEFAULT_CHANNEL_MAPPING, sizeof(uint64_t));
|
||||
}
|
||||
else {
|
||||
g_model.moduleData[INTERNAL_MODULE].pxx2.receivers[0].enabled = 0x01;
|
||||
memcpy(&g_model.moduleData[INTERNAL_MODULE].pxx2.receivers[0].channelMapping, "\x01\x23\x45\x67\x89\xAB\xCD\xEF", 8); //default map 1-1 16-16
|
||||
memcpy(&g_model.moduleData[INTERNAL_MODULE].pxx2.receivers[0].channelMapping, DEFAULT_CHANNEL_MAPPING, sizeof(uint64_t));
|
||||
}
|
||||
s_editMode = 0;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
|
||||
#define PXX2_FLAG0_FAILSAFE (1 << 6)
|
||||
|
||||
const uint8_t DEFAULT_CHANNEL_MAPPING[] = {0x12, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF};
|
||||
|
||||
class ModuleFifo : public Fifo<uint8_t, 32> {
|
||||
public:
|
||||
bool getFrame(uint8_t * frame)
|
||||
|
|
|
@ -77,6 +77,12 @@ void processRegisterFrame(uint8_t module, uint8_t * frame)
|
|||
// RX_ID follows, we discard it for now
|
||||
moduleSettings[module].counter = REGISTER_COUNTER_ID_RECEIVED;
|
||||
}
|
||||
else if (frame[3] == 0x01) {
|
||||
// PASSWORD follows, we check it is good
|
||||
if (memcmp(&frame[4], g_model.modelRegistrationID, LEN_REGISTRATION_ID) == 0) {
|
||||
moduleSettings[module].counter = REGISTER_COUNTER_PASSWORD_RECEIVED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void processRadioFrame(uint8_t module, uint8_t * frame)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue