1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 01:35:21 +03:00

Revert "If modelRegistrationID is default it will be kept the same than ownerRegistrationID"

This reverts commit b1ea16c3
This commit is contained in:
Bertrand Songis 2019-04-18 21:50:36 +02:00
parent a721e8d7be
commit 1ab95c6665
5 changed files with 6 additions and 12 deletions

View file

@ -377,10 +377,6 @@ void runPopupRegister(event_t event)
}
else if (reusableBuffer.moduleSetup.pxx2.registerStep >= REGISTER_RX_NAME_RECEIVED && menuHorizontalPosition == 0) {
// [Enter] pressed
if (memcmp(reusableBuffer.moduleSetup.pxx2.registrationId, g_eeGeneral.ownerRegistrationID, PXX2_LEN_REGISTRATION_ID) == 0)
memclear(g_model.modelRegistrationID, PXX2_LEN_REGISTRATION_ID);
else
memcpy(g_model.modelRegistrationID, reusableBuffer.moduleSetup.pxx2.registrationId, PXX2_LEN_REGISTRATION_ID);
reusableBuffer.moduleSetup.pxx2.registerStep = REGISTER_RX_NAME_SELECTED;
backupEditMode = EDIT_MODIFY_FIELD; // so that the [Register] button blinks and the REGISTER process can continue
}
@ -405,7 +401,7 @@ void runPopupRegister(event_t event)
// registration password
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y - 4, STR_REG_ID);
editName(WARNING_LINE_X + 8*FW, WARNING_LINE_Y - 4, reusableBuffer.moduleSetup.pxx2.registrationId, PXX2_LEN_REGISTRATION_ID, event, menuVerticalPosition == ITEM_REGISTER_PASSWORD);
editName(WARNING_LINE_X + 8*FW, WARNING_LINE_Y - 4, g_model.modelRegistrationID, PXX2_LEN_REGISTRATION_ID, event, menuVerticalPosition == ITEM_REGISTER_PASSWORD);
// loop index (will be removed in future)
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y - 4 + FH, "UID");
@ -440,7 +436,6 @@ void runPopupRegister(event_t event)
void startRegisterDialog(uint8_t module)
{
memclear(&reusableBuffer.moduleSetup.pxx2, sizeof(reusableBuffer.moduleSetup.pxx2));
memcpy(reusableBuffer.moduleSetup.pxx2.registrationId, currentRegistrationID(), PXX2_LEN_REGISTRATION_ID);
moduleSettings[module].mode = MODULE_MODE_REGISTER;
s_editMode = 0;
POPUP_INPUT("", runPopupRegister);

View file

@ -461,6 +461,8 @@ void modelDefault(uint8_t id)
applyDefaultTemplate();
memcpy(g_model.modelRegistrationID, g_eeGeneral.ownerRegistrationID, PXX2_LEN_REGISTRATION_ID);
#if defined(LUA) && defined(PCBTARANIS) //Horus uses menuModelWizard() for wizard
if (isFileAvailable(WIZARD_PATH "/" WIZARD_NAME)) {
f_chdir(WIZARD_PATH);

View file

@ -1134,7 +1134,6 @@ union ReusableBuffer
uint8_t bindStep;
uint8_t resetStep;
};
char registrationId[PXX2_LEN_REGISTRATION_ID];
uint32_t bindWaitTimeout;
uint8_t registerPopupVerticalPosition;
uint8_t registerPopupHorizontalPosition;

View file

@ -157,9 +157,8 @@ void Pxx2Pulses::setupRegisterFrame(uint8_t module)
for (uint8_t i=0; i<PXX2_LEN_RX_NAME; i++) {
Pxx2Transport::addByte(zchar2char(reusableBuffer.moduleSetup.pxx2.registerRxName[i]));
}
const char * registrationID = currentRegistrationID();
for (uint8_t i=0; i<PXX2_LEN_REGISTRATION_ID; i++) {
Pxx2Transport::addByte(zchar2char(registrationID[i]));
Pxx2Transport::addByte(zchar2char(g_model.modelRegistrationID[i]));
}
Pxx2Transport::addByte(reusableBuffer.moduleSetup.pxx2.registerLoopIndex);
}
@ -240,9 +239,8 @@ void Pxx2Pulses::setupBindFrame(uint8_t module)
}
else {
Pxx2Transport::addByte(0x00);
const char * registrationID = currentRegistrationID();
for (uint8_t i=0; i<PXX2_LEN_REGISTRATION_ID; i++) {
Pxx2Transport::addByte(zchar2char(registrationID[i]));
Pxx2Transport::addByte(zchar2char(g_model.modelRegistrationID[i]));
}
}
}

View file

@ -118,7 +118,7 @@ void processRegisterFrame(uint8_t module, uint8_t * frame)
if (reusableBuffer.moduleSetup.pxx2.registerStep == REGISTER_RX_NAME_SELECTED) {
// RX_NAME + PASSWORD follow, we check they are good
if (cmpStrWithZchar((char *)&frame[4], reusableBuffer.moduleSetup.pxx2.registerRxName, PXX2_LEN_RX_NAME) &&
cmpStrWithZchar((char *)&frame[12], currentRegistrationID(), PXX2_LEN_REGISTRATION_ID)) {
cmpStrWithZchar((char *)&frame[12], g_model.modelRegistrationID, PXX2_LEN_REGISTRATION_ID)) {
reusableBuffer.moduleSetup.pxx2.registerStep = REGISTER_OK;
moduleSettings[module].mode = MODULE_MODE_NORMAL;
POPUP_INFORMATION(STR_REG_OK);