Trigger a NodeStatus update at the end of setup() to get fresh data on display at boot.

This commit is contained in:
Jonathan Bennett 2025-07-01 10:58:43 -05:00
parent ef28f4ef3f
commit aaf78d829f
2 changed files with 11 additions and 8 deletions

View File

@ -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

View File

@ -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();