diff --git a/src/MessageStore.cpp b/src/MessageStore.cpp index a7e6c5662..32e78f400 100644 --- a/src/MessageStore.cpp +++ b/src/MessageStore.cpp @@ -354,6 +354,7 @@ void MessageStore::clearAllMessages() resetMessagePool(); #ifdef FSCom + concurrency::LockGuard guard(spiLock); SafeFile f(filename.c_str(), false); uint8_t count = 0; f.write(&count, 1); // write "0 messages" diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 2481eb8ca..01d554ab8 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -9,6 +9,7 @@ #include "FSCommon.h" #include "MeshRadio.h" #include "MeshService.h" +#include "MessageStore.h" #include "NodeDB.h" #include "PacketHistory.h" #include "PowerFSM.h" @@ -727,6 +728,9 @@ bool NodeDB::factoryReset(bool eraseBleBonds) if (transmitHistory) { transmitHistory->clear(); } +#if HAS_SCREEN + messageStore.clearAllMessages(); +#endif // second, install default state (this will deal with the duplicate mac address issue) installDefaultNodeDatabase(); installDefaultDeviceState(); diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 1dbc3a668..5fde2b047 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -84,7 +84,11 @@ void CannedMessageModule::LaunchWithDestination(NodeNum newDest, uint8_t newChan // Do NOT override explicit broadcast replies // Only reuse lastDest in LaunchRepeatDestination() - dest = newDest; + if (newDest == 0) { + dest = NODENUM_BROADCAST; + } else { + dest = newDest; + } channel = newChannel; lastDest = dest; @@ -124,7 +128,11 @@ void CannedMessageModule::LaunchFreetextWithDestination(NodeNum newDest, uint8_t // Do NOT override explicit broadcast replies // Only reuse lastDest in LaunchRepeatDestination() - dest = newDest; + if (newDest == 0) { + dest = NODENUM_BROADCAST; + } else { + dest = newDest; + } channel = newChannel; lastDest = dest; diff --git a/src/modules/StatusLEDModule.cpp b/src/modules/StatusLEDModule.cpp index 72aed21ff..353317d25 100644 --- a/src/modules/StatusLEDModule.cpp +++ b/src/modules/StatusLEDModule.cpp @@ -131,6 +131,12 @@ int32_t StatusLEDModule::runOnce() CHARGE_LED_state = LED_STATE_OFF; } } + } else { +#if defined(LED_HEARTBEAT) + // If we are using the heartbeat, as in the Thinknode M4, we need to explicitly turn off the charge LED + // This probably implies that in the future we need to stop re-using this bool for multiple purposes. + CHARGE_LED_state = LED_STATE_OFF; +#endif } // If we want a LED to be dedicated to the simple hearbeat, we can use that instead of the charge LED #if defined(LED_HEARTBEAT) @@ -158,6 +164,7 @@ int32_t StatusLEDModule::runOnce() } } #endif +#ifdef LED_PAIRING if (!config.bluetooth.enabled || PAIRING_LED_starttime + 30 * 1000 < millis() || doing_fast_blink) { PAIRING_LED_state = LED_STATE_OFF; } else if (ble_state == unpaired) { @@ -172,6 +179,7 @@ int32_t StatusLEDModule::runOnce() } else { PAIRING_LED_state = LED_STATE_ON; } +#endif // Override if disabled in config if (config.device.led_heartbeat_disabled) { diff --git a/variants/esp32s3/ELECROW-ThinkNode-M5/variant.h b/variants/esp32s3/ELECROW-ThinkNode-M5/variant.h index 55bcd0dc7..2d0b413fe 100644 --- a/variants/esp32s3/ELECROW-ThinkNode-M5/variant.h +++ b/variants/esp32s3/ELECROW-ThinkNode-M5/variant.h @@ -18,7 +18,9 @@ #define BATTERY_PIN 8 #define ADC_CHANNEL ADC_CHANNEL_7 -#define ADC_MULTIPLIER 2.0 // 2.0 + 10% for correction of display undervoltage. +#define ADC_MULTIPLIER 2.0 + +#define OCV_ARRAY 4180, 4050, 3990, 3890, 3800, 3720, 3630, 3530, 3420, 3300, 3100 #define PIN_BUZZER 9