diff --git a/radio/src/main_arm.cpp b/radio/src/main_arm.cpp index 6e14734dc..4d945935d 100644 --- a/radio/src/main_arm.cpp +++ b/radio/src/main_arm.cpp @@ -48,7 +48,7 @@ void handleUsbConnection() */ #if defined(USB_MASS_STORAGE) - opentxClose(); + opentxClose(false); usbPluggedIn(); #endif } diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index b5163f532..e5660658d 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1951,33 +1951,31 @@ void opentxStart() } #if defined(CPUARM) || defined(CPUM2560) -void opentxClose() +void opentxClose(uint8_t shutdown) { TRACE("opentxClose()"); + if (shutdown) { #if defined(CPUARM) - watchdogSetTimeout(2000/*20s*/); + watchdogSetTimeout(2000/*20s*/); #endif - pausePulses(); // stop mixer task to disable trims processing while in shutdown - - AUDIO_BYE(); - + pausePulses(); // stop mixer task to disable trims processing while in shutdown + AUDIO_BYE(); #if defined(FRSKY) - // TODO needed? telemetryEnd(); + // TODO needed? telemetryEnd(); #endif - #if defined(LUA) - luaClose(); + luaClose(); #endif - +#if defined(HAPTIC) + hapticOff(); +#endif + } + #if defined(SDCARD) closeLogs(); #endif -#if defined(HAPTIC) - hapticOff(); -#endif - saveTimers(); #if defined(CPUARM) @@ -2023,7 +2021,6 @@ void opentxClose() while (IS_PLAYING(ID_PLAY_BYE)) { CoTickDelay(10); } - CoTickDelay(50); #endif diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 570c67772..857ac0b2a 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -1423,9 +1423,9 @@ extern uint8_t requiredSpeakerVolume; extern uint8_t requestScreenshot; #endif -extern void checkBattery(); -extern void opentxClose(); -extern void opentxInit(); +void checkBattery(); +void opentxClose(uint8_t shutdown=true); +void opentxInit(); #if defined(PCBHORUS) && !defined(SIMU) #define LED_ERROR_BEGIN() ledRed()