diff --git a/src/main.cpp b/src/main.cpp index ddc1df28c..fbdbf641a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1430,6 +1430,9 @@ void setup() LOG_DEBUG("Free heap : %7d bytes", ESP.getFreeHeap()); LOG_DEBUG("Free PSRAM : %7d bytes", ESP.getFreePsram()); #endif + + // We manually run this to update the NodeStatus + nodeDB->notifyObservers(true); } #endif diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 8cf0c78b3..845f42c76 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -285,6 +285,14 @@ class NodeDB bool restorePreferences(meshtastic_AdminMessage_BackupLocation location, int restoreWhat = SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS); + /// Notify observers of changes to the DB + void notifyObservers(bool forceUpdate = false) + { + // Notify observers of the current node state + const meshtastic::NodeStatus status = meshtastic::NodeStatus(getNumOnlineMeshNodes(), getNumMeshNodes(), forceUpdate); + newStatus.notifyObservers(&status); + } + private: bool duplicateWarned = false; uint32_t lastNodeDbSave = 0; // when we last saved our db to flash @@ -301,14 +309,6 @@ class NodeDB /// pick a provisional nodenum we hope no one is using void pickNewNodeNum(); - /// Notify observers of changes to the DB - void notifyObservers(bool forceUpdate = false) - { - // Notify observers of the current node state - const meshtastic::NodeStatus status = meshtastic::NodeStatus(getNumOnlineMeshNodes(), getNumMeshNodes(), forceUpdate); - newStatus.notifyObservers(&status); - } - /// read our db from flash void loadFromDisk();