From 6685dcfdcdf8b3a72502ad65e95c02ca6b6a0e98 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 20 Feb 2019 18:04:18 +0100 Subject: [PATCH] Device update through S.PORT port now OK --- radio/src/io/frsky_device_firmware_update.cpp | 17 ++++++----------- radio/src/io/io_arm.h | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/radio/src/io/frsky_device_firmware_update.cpp b/radio/src/io/frsky_device_firmware_update.cpp index 53e5a8fce..66b005a17 100644 --- a/radio/src/io/frsky_device_firmware_update.cpp +++ b/radio/src/io/frsky_device_firmware_update.cpp @@ -72,21 +72,21 @@ void DeviceFirmwareUpdate::startup() switch(module) { case INTERNAL_MODULE: #if defined(INTMODULE_USART) - return intmoduleSerialStart(57600); + intmoduleSerialStart(57600); + break; #endif default: - return telemetryInit(PROTOCOL_TELEMETRY_FRSKY_SPORT); + telemetryInit(PROTOCOL_TELEMETRY_FRSKY_SPORT); + break; } -#if defined(PCBTARANIS) || defined(PCBHORUS) if (module == INTERNAL_MODULE) INTERNAL_MODULE_ON(); else if (module == EXTERNAL_MODULE) EXTERNAL_MODULE_ON(); else SPORT_UPDATE_POWER_ON(); -#endif watchdogSuspend(50); RTOS_WAIT_MS(50); @@ -117,7 +117,7 @@ bool DeviceFirmwareUpdate::waitState(State state, uint32_t timeout) uint8_t len = 0; while (len < 10) { uint32_t elapsed = 0; - while (!intmoduleFifo.pop(frame[len])) { + while (!readByte(frame[len])) { RTOS_WAIT_MS(1); if (elapsed++ >= timeout) { return false; @@ -275,9 +275,9 @@ void DeviceFirmwareUpdate::flashFile(const char * filename) { pausePulses(); -#if defined(PCBTARANIS) || defined(PCBHORUS) uint8_t intPwr = IS_INTERNAL_MODULE_ON(); uint8_t extPwr = IS_EXTERNAL_MODULE_ON(); + INTERNAL_MODULE_OFF(); EXTERNAL_MODULE_OFF(); SPORT_UPDATE_POWER_OFF(); @@ -285,7 +285,6 @@ void DeviceFirmwareUpdate::flashFile(const char * filename) /* wait 2s off */ watchdogSuspend(2000); RTOS_WAIT_MS(2000); -#endif startup(); @@ -302,20 +301,16 @@ void DeviceFirmwareUpdate::flashFile(const char * filename) POPUP_INFORMATION(STR_FIRMWARE_UPDATE_SUCCESS); } -#if defined(PCBTARANIS) || defined(PCBHORUS) INTERNAL_MODULE_OFF(); EXTERNAL_MODULE_OFF(); SPORT_UPDATE_POWER_OFF(); -#endif waitState(SPORT_IDLE, 500); // Clear the fifo -#if defined(PCBTARANIS) || defined(PCBHORUS) if (intPwr) INTERNAL_MODULE_ON(); if (extPwr) EXTERNAL_MODULE_ON(); -#endif state = SPORT_IDLE; diff --git a/radio/src/io/io_arm.h b/radio/src/io/io_arm.h index 3ee05ab3b..2a929d86e 100644 --- a/radio/src/io/io_arm.h +++ b/radio/src/io/io_arm.h @@ -66,7 +66,7 @@ class DeviceFirmwareUpdate { void flashFile(const char * filename); protected: - uint8_t state = SPORT_IDLE; + uint8_t state = SPORT_IDLE; uint32_t address = 0; ModuleIndex module; uint8_t frame[12];