From d2c2fd6426f32d55bd3bb096456cd70cb984d0aa Mon Sep 17 00:00:00 2001 From: 3djc Date: Tue, 15 Aug 2023 02:17:09 +0200 Subject: [PATCH] fix: EM when LUA script is running and radio is turned off (#3926) * fix: EM when LUA script is running and radio is turned off * Improve sequencing --- radio/src/opentx.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 736eaf557..40fdf6f42 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1171,6 +1171,10 @@ void opentxClose(uint8_t shutdown) #endif } +#if defined(LUA) + luaClose(&lsScripts); +#endif + #if defined(SDCARD) logsClose(); #endif @@ -1209,11 +1213,6 @@ void opentxClose(uint8_t shutdown) lsWidgets = 0; #endif #endif -#if defined(LUA) - // the script context needs to be closed *after* - // the widgets, as it has been the first to be opened - luaClose(&lsScripts); -#endif #if defined(SDCARD) sdDone();