1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 16:55:20 +03:00

REGISTER fixed (no 0 hardcoded)

This commit is contained in:
Bertrand Songis 2019-02-12 14:01:59 +01:00
parent b8410c24ba
commit 4755899d24
2 changed files with 6 additions and 7 deletions

View file

@ -1118,6 +1118,7 @@ union ReusableBuffer
char msg[64];
uint8_t r9mPower;
uint8_t pxx2_register_or_bind_step;
uint8_t pxx2_register_rx_id[PXX2_LEN_RX_ID];
char pxx2_bind_candidate_receivers_ids[PXX2_MAX_RECEIVERS_PER_MODULE][PXX2_LEN_RX_ID];
char pxx2_bind_candidate_receivers_names[PXX2_MAX_RECEIVERS_PER_MODULE][3*PXX2_LEN_RX_ID+1];
uint8_t pxx2_bind_candidate_receivers_count;

View file

@ -78,16 +78,14 @@ void processRegisterFrame(uint8_t module, uint8_t * frame)
}
if (frame[3] == 0x00) {
// RX_ID follows, we discard it for now
// RX_ID follows, we store it for the next step
memcpy(reusableBuffer.modelsetup.pxx2_register_rx_id, &frame[4], PXX2_LEN_RX_ID);
reusableBuffer.modelsetup.pxx2_register_or_bind_step = REGISTER_COUNTER_ID_RECEIVED;
}
else if (frame[3] == 0x01) {
// RX_ID follows, we check it is good
if (1) {
}
// PASSWORD follows, we check it is good
if (memcmp(&frame[12], g_model.modelRegistrationID, PXX2_LEN_REGISTRATION_ID) == 0) {
// RX_ID + PASSWORD follow, we check they are good
if (memcmp(&frame[4], reusableBuffer.modelsetup.pxx2_register_rx_id, PXX2_LEN_RX_ID) == 0 &&
memcmp(&frame[12], g_model.modelRegistrationID, PXX2_LEN_REGISTRATION_ID) == 0) {
reusableBuffer.modelsetup.pxx2_register_or_bind_step = REGISTER_OK;
moduleSettings[module].mode = MODULE_MODE_NORMAL;
POPUP_INFORMATION(STR_REG_OK);