From 8c240b59f6f0a9f67f2d5662325dca2c6fc56bcb Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 16 Sep 2020 09:08:35 -0700 Subject: [PATCH] fix #393. immediately save node db to disk if user changes name --- src/mesh/MeshService.cpp | 7 +++++++ src/mesh/MeshService.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index f5d0ac173..4b75b4ee7 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -206,6 +206,13 @@ void MeshService::reloadConfig() nodeDB.saveToDisk(); } +/// The owner User record just got updated, update our node DB and broadcast the info into the mesh +void MeshService::reloadOwner() +{ + sendOurOwner(); + nodeDB.saveToDisk(); +} + /** * Given a ToRadio buffer parse it and properly handle it (setup radio, owner or send packet into the mesh) * Called by PhoneAPI.handleToRadio. Note: p is a scratch buffer, this function is allowed to write to it but it can not keep a diff --git a/src/mesh/MeshService.h b/src/mesh/MeshService.h index 7e8810778..a12f087b3 100644 --- a/src/mesh/MeshService.h +++ b/src/mesh/MeshService.h @@ -67,7 +67,7 @@ class MeshService void reloadConfig(); /// The owner User record just got updated, update our node DB and broadcast the info into the mesh - void reloadOwner() { sendOurOwner(); } + void reloadOwner(); /// Called when the user wakes up our GUI, normally sends our latest location to the mesh (if we have it), otherwise at least /// sends our owner