diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index b0a8164d0..f8bff1dfd 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -330,7 +330,7 @@ int32_t GPS::runOnce() if(devicestate.did_gps_reset && (millis() > 60000) && !hasFlow()) { DEBUG_MSG("GPS is not communicating, trying factory reset on next bootup.\n"); devicestate.did_gps_reset = false; - nodeDB.saveToDisk(); + nodeDB.saveDeviceStateToDisk(); } #endif } diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 63d67871e..cb4c625db 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -435,6 +435,16 @@ void NodeDB::saveChannelsToDisk() } } +void NodeDB::saveDeviceStateToDisk() +{ + if (!devicestate.no_save) { +#ifdef FSCom + FSCom.mkdir("/prefs"); +#endif + saveProto(prefFileName, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate); + } +} + void NodeDB::saveToDisk() { if (!devicestate.no_save) { diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 0a2a5bdb7..a96fe22c2 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -44,7 +44,7 @@ class NodeDB void init(); /// write to flash - void saveToDisk(), saveChannelsToDisk(); + void saveToDisk(), saveChannelsToDisk(), saveDeviceStateToDisk(); /** Reinit radio config if needed, because either: * a) sometimes a buggy android app might send us bogus settings or