From 7f06c06e84d2fcf261b45aeea000d9d3ed858ddb Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 22 Nov 2019 11:13:26 +0100 Subject: [PATCH] Popup displayed if the ACCESS module is not up to date --- radio/src/opentx.h | 6 ++++-- radio/src/pulses/pulses.cpp | 3 +++ radio/src/telemetry/frsky_pxx2.cpp | 10 ++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/radio/src/opentx.h b/radio/src/opentx.h index b8e551548..dd415ac24 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -569,8 +569,10 @@ void flightReset(uint8_t check=true); PACK(struct GlobalData { uint8_t unexpectedShutdown:1; - uint8_t externalAntennaEnabled: 1; - uint8_t spare:6; + uint8_t externalAntennaEnabled:1; + uint8_t authenticationCount:2; + uint8_t authenticationPopup:1; + uint8_t spare:3; }); extern GlobalData globalData; diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index 63b43943f..21c4d7eee 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -307,6 +307,9 @@ static void enablePulsesInternalModule(uint8_t protocol) #if defined(PXX2) case PROTOCOL_CHANNELS_PXX2_HIGHSPEED: intmoduleSerialStart(PXX2_HIGHSPEED_BAUDRATE, true, USART_Parity_No, USART_StopBits_1, USART_WordLength_8b); +#if defined(HARDWARE_INTERNAL_MODULE) && defined(INTERNAL_MODULE_PXX2) && defined(ACCESS_LIB) + globalData.authenticationCount = 0; +#endif break; #endif diff --git a/radio/src/telemetry/frsky_pxx2.cpp b/radio/src/telemetry/frsky_pxx2.cpp index bff29c315..933cdcdcc 100644 --- a/radio/src/telemetry/frsky_pxx2.cpp +++ b/radio/src/telemetry/frsky_pxx2.cpp @@ -239,6 +239,16 @@ void processAuthenticationFrame(uint8_t module, uint8_t * frame) intmoduleSendBuffer(pxx2.getData(), pxx2.getSize()); // we remain in AUTHENTICATION mode to avoid a CHANNELS frame is sent at the end of the mixing process } + + if (!globalData.authenticationPopup) { + if (globalData.authenticationCount >= 2) { + globalData.authenticationPopup = 1; + POPUP_WARNING(STR_MODULE_UPGRADE); + } + else { + globalData.authenticationCount += 1; + } + } } #else #define processAuthenticationFrame(module, frame)