diff --git a/docs/software/TODO.md b/docs/software/TODO.md index e879c577..57c99e50 100644 --- a/docs/software/TODO.md +++ b/docs/software/TODO.md @@ -4,12 +4,14 @@ You probably don't care about this section - skip to the next one. ## before next release -* TEST THIS! changing channels requires a reboot to take effect https://github.com/meshtastic/Meshtastic-device/issues/752 +* DONE firmware OTA updates of is_router true nodes fails? * add UI in android app to reset to defaults https://github.com/meshtastic/Meshtastic-Android/issues/263 +* TEST THIS! changing channels requires a reboot to take effect https://github.com/meshtastic/Meshtastic-device/issues/752 * bug report with remote info request timing out -* firmware OTA updates of is_router true nodes fails? -* move remote admin doc from forum into git -* ask for a documentation czar +* retest channel changing in android (using sim?) +* DONE move remote admin doc from forum into git +* DONE check crashlytics +* DONE ask for a documentation czar * DONE timestamps on oled screen are wrong - don't seem to be updating based on message rx (actually: this is expected behavior when no node on the mesh has GPS time) * DONE add ch-del * DONE channel hash suffixes are wrong on android diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 1303329e..86bc9163 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -97,7 +97,8 @@ static void lsIdle() static void lsExit() { // setGPSPower(true); // restore GPS power - if (gps) gps->forceWake(true); + if (gps) + gps->forceWake(true); } static void nbEnter() @@ -172,7 +173,7 @@ Fsm powerFSM(&stateBOOT); void PowerFSM_setup() { bool isRouter = radioConfig.preferences.is_router; - + // If we are not a router and we already have AC power go to POWER state after init, otherwise go to ON // We assume routers might be powered all the time, but from a low current (solar) source bool isLowPower = radioConfig.preferences.is_low_power || isRouter; @@ -180,7 +181,7 @@ void PowerFSM_setup() /* To determine if we're externally powered, assumptions 1) If we're powered up and there's no battery, we must be getting power externally. (because we'd be dead otherwise) - 2) If we detect USB power from the power management chip, we must be getting power externally. + 2) If we detect USB power from the power management chip, we must be getting power externally. */ bool hasPower = !isLowPower && powerStatus && (!powerStatus->getHasBattery() || powerStatus->getHasUSB()); @@ -249,6 +250,11 @@ void PowerFSM_setup() powerFSM.add_transition(&stateDARK, &stateDARK, EVENT_CONTACT_FROM_PHONE, NULL, "Contact from phone"); + // each time we get a new update packet make sure we are staying in the ON state so the screen stays awake (also we don't + // shutdown bluetooth if is_router) + powerFSM.add_transition(&stateDARK, &stateON, EVENT_FIRMWARE_UPDATE, NULL, "Got firmware update"); + powerFSM.add_transition(&stateON, &stateON, EVENT_FIRMWARE_UPDATE, NULL, "Got firmware update"); + powerFSM.add_transition(&stateNB, &stateDARK, EVENT_PACKET_FOR_PHONE, NULL, "Packet for phone"); powerFSM.add_timed_transition(&stateON, &stateDARK, getPref_screen_on_secs() * 1000, NULL, "Screen-on timeout"); diff --git a/src/PowerFSM.h b/src/PowerFSM.h index 4af62040..e48b55d8 100644 --- a/src/PowerFSM.h +++ b/src/PowerFSM.h @@ -18,6 +18,7 @@ #define EVENT_SERIAL_DISCONNECTED 12 #define EVENT_POWER_CONNECTED 13 #define EVENT_POWER_DISCONNECTED 14 +#define EVENT_FIRMWARE_UPDATE 15 // We just received a new firmware update packet from the phone extern Fsm powerFSM; extern State statePOWER, stateSERIAL; diff --git a/src/esp32/BluetoothSoftwareUpdate.cpp b/src/esp32/BluetoothSoftwareUpdate.cpp index 33707c57..843b14cf 100644 --- a/src/esp32/BluetoothSoftwareUpdate.cpp +++ b/src/esp32/BluetoothSoftwareUpdate.cpp @@ -1,14 +1,14 @@ #include #include "../concurrency/LockGuard.h" +#include "../graphics/Screen.h" +#include "../main.h" #include "BluetoothSoftwareUpdate.h" +#include "NodeDB.h" #include "PowerFSM.h" #include "RadioLibInterface.h" #include "configuration.h" #include "nimble/BluetoothUtil.h" -#include "NodeDB.h" -#include "../graphics/Screen.h" -#include "../main.h" #include #include @@ -51,8 +51,8 @@ int update_size_callback(uint16_t conn_handle, uint16_t attr_handle, struct ble_ screen->startFirmwareUpdateScreen(); if (RadioLibInterface::instance) - RadioLibInterface::instance->disable(); // FIXME, nasty hack - the RF95 ISR/SPI code on ESP32 can fail while we are - // writing flash - shut the radio off during updates + RadioLibInterface::instance->disable(); // FIXME, nasty hack - the RF95 ISR/SPI code on ESP32 can fail while we + // are writing flash - shut the radio off during updates } } @@ -78,7 +78,7 @@ int update_data_callback(uint16_t conn_handle, uint16_t attr_handle, struct ble_ crc.update(data, len); Update.write(data, len); updateActualSize += len; - powerFSM.trigger(EVENT_CONTACT_FROM_PHONE); + powerFSM.trigger(EVENT_FIRMWARE_UPDATE); return 0; } @@ -107,8 +107,7 @@ int update_crc32_callback(uint16_t conn_handle, uint16_t attr_handle, struct ble if (update_region == U_SPIFFS) { DEBUG_MSG("SPIFFS updated!\n"); nodeDB.saveToDisk(); // Since we just wiped spiffs, we need to save our current state - } - else { + } else { DEBUG_MSG("Appload updated, rebooting in 5 seconds!\n"); rebootAtMsec = millis() + 5000; }