Bsongis/access registration id reinit when zero (#6700)

ACCESS registration ID reinitialized when zero (coming from Companion)
Fix incorrect module settings on model load
This commit is contained in:
Bertrand Songis
2019-09-02 17:04:25 +02:00
committed by GitHub
parent 0fe2b8918b
commit 02d07c4d2d
5 changed files with 29 additions and 19 deletions
+22 -8
View File
@@ -53,20 +53,34 @@ void preModelLoad()
pauseMixerCalculations();
}
#if defined(PCBTARANIS) || defined(PCBHORUS)
static void fixUpModel()
void postRadioSettingsLoad()
{
// Ensure that when rfProtocol is MODULE_SUBTYPE_PXX1_OFF the type of the module is MODULE_TYPE_NONE
if (g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_XJT_PXX1 && g_model.moduleData[INTERNAL_MODULE].rfProtocol == MODULE_SUBTYPE_PXX1_OFF)
g_model.moduleData[INTERNAL_MODULE].type = MODULE_TYPE_NONE;
}
#if defined(PXX2)
if (is_memclear(g_eeGeneral.ownerRegistrationID, PXX2_LEN_REGISTRATION_ID)) {
setDefaultOwnerId();
}
#endif
}
void postModelLoad(bool alarms)
{
#if defined(PCBTARANIS) || defined(PCBHORUS)
fixUpModel();
#if defined(PXX2)
if (is_memclear(g_model.modelRegistrationID, PXX2_LEN_REGISTRATION_ID)) {
memcpy(g_model.modelRegistrationID, g_eeGeneral.ownerRegistrationID, PXX2_LEN_REGISTRATION_ID);
}
#endif
#if defined(HARDWARE_INTERNAL_MODULE)
if (!isInternalModuleAvailable(g_model.moduleData[INTERNAL_MODULE].type)) {
memclear(&g_model.moduleData[INTERNAL_MODULE], sizeof(ModuleData));
}
#endif
if (!isExternalModuleAvailable(g_model.moduleData[EXTERNAL_MODULE].type)) {
memclear(&g_model.moduleData[EXTERNAL_MODULE], sizeof(ModuleData));
}
AUDIO_FLUSH();
flightReset(false);