From c924a369d7eb2980afc5d13af46ccdffd5389e7b Mon Sep 17 00:00:00 2001 From: "bernet.andre@gmail.com" Date: Tue, 25 Jun 2013 10:45:10 +0000 Subject: [PATCH] [Taranis] Cleaner reboot on USB disconnect, longer LCD initialization delay to compensate for the time saved removing USB initialisation --- src/opentx.cpp | 2 +- src/targets/taranis/usbd_usr.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/opentx.cpp b/src/opentx.cpp index 9730ab73d..eb76b8e4e 100644 --- a/src/opentx.cpp +++ b/src/opentx.cpp @@ -4194,7 +4194,7 @@ inline void opentxInit(OPENTX_INIT_ARGS) { #if defined(PCBTARANIS) BACKLIGHT_ON(); - CoTickDelay(10); //20ms + CoTickDelay(50); //100ms Splash(); #endif diff --git a/src/targets/taranis/usbd_usr.cpp b/src/targets/taranis/usbd_usr.cpp index 32fedc43c..bf12deb9c 100644 --- a/src/targets/taranis/usbd_usr.cpp +++ b/src/targets/taranis/usbd_usr.cpp @@ -119,6 +119,12 @@ void USBD_USR_DeviceConnected (void) */ void USBD_USR_DeviceDisconnected (void) { + // TODO: Separate the shutdown operations in main() into a shutdown() function in opentx.cpp, + // and call that before the NVIC_SystemReset()? + g_eeGeneral.unexpectedShutdown = 0; + eeDirty(EE_GENERAL); + eeCheck(true); + NVIC_SystemReset(); }