From 6b5f6bc8170062982de57131140d3db440becb69 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 7 Mar 2020 10:47:10 +0100 Subject: [PATCH] Reset ISRM upgrade moduel counter reset when mode is changed (#7425) Reset authentication counter on ISRM mode change --- radio/src/gui/480x272/model_setup.cpp | 4 ++++ radio/src/gui/480x272/radio_power_meter.cpp | 4 ++++ radio/src/gui/480x272/radio_spectrum_analyser.cpp | 7 ++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/radio/src/gui/480x272/model_setup.cpp b/radio/src/gui/480x272/model_setup.cpp index 0b0554336..b8c01cbaa 100644 --- a/radio/src/gui/480x272/model_setup.cpp +++ b/radio/src/gui/480x272/model_setup.cpp @@ -1018,6 +1018,10 @@ bool menuModelSetup(event_t event) uint8_t moduleType = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_MAX, EE_MODEL, isInternalModuleAvailable); if (checkIncDec_Ret) { setModuleType(INTERNAL_MODULE, moduleType); +#if defined(ACCESS_LIB) + // the module will reset on mode switch, we need to reset the authentication counter + globalData.authenticationCount = 0; +#endif } } else if (isModuleXJT(INTERNAL_MODULE)) { diff --git a/radio/src/gui/480x272/radio_power_meter.cpp b/radio/src/gui/480x272/radio_power_meter.cpp index e20755ba9..f49eeb93c 100644 --- a/radio/src/gui/480x272/radio_power_meter.cpp +++ b/radio/src/gui/480x272/radio_power_meter.cpp @@ -50,6 +50,10 @@ bool menuRadioPowerMeter(event_t event) lcdDrawCenteredText(LCD_H/2, STR_STOPPING); lcdRefresh(); moduleState[g_moduleIdx].readModuleInformation(&reusableBuffer.moduleSetup.pxx2.moduleInformation, PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID); +#if defined(ACCESS_LIB) + // the module will reset on mode switch, we need to reset the authentication counter + globalData.authenticationCount = 0; +#endif /* wait 1s to resume normal operation before leaving */ watchdogSuspend(500 /*5s*/); RTOS_WAIT_MS(1000); diff --git a/radio/src/gui/480x272/radio_spectrum_analyser.cpp b/radio/src/gui/480x272/radio_spectrum_analyser.cpp index be26e58d3..39ff66e02 100644 --- a/radio/src/gui/480x272/radio_spectrum_analyser.cpp +++ b/radio/src/gui/480x272/radio_spectrum_analyser.cpp @@ -56,8 +56,13 @@ bool menuRadioSpectrumAnalyser(event_t event) if (menuEvent) { lcdDrawCenteredText(LCD_H / 2, STR_STOPPING); lcdRefresh(); - if (isModulePXX2(g_moduleIdx)) + if (isModulePXX2(g_moduleIdx)) { moduleState[g_moduleIdx].readModuleInformation(&reusableBuffer.moduleSetup.pxx2.moduleInformation, PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID); +#if defined(ACCESS_LIB) + // the module will reset on mode switch, we need to reset the authentication counter + globalData.authenticationCount = 0; +#endif + } else if (isModuleMultimodule(g_moduleIdx)) { if (reusableBuffer.spectrumAnalyser.moduleOFF) setModuleType(INTERNAL_MODULE, MODULE_TYPE_NONE);