Fixed persistence stragglers from NodeDB / Device State divorce (#6059)

This commit is contained in:
Ben Meadors 2025-02-15 07:56:04 -06:00 committed by GitHub
parent 431b067f30
commit bdf60d8e4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -283,7 +283,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->set_favorite_node);
if (node != NULL) {
node->is_favorite = true;
saveChanges(SEGMENT_DEVICESTATE, false);
saveChanges(SEGMENT_NODEDATABASE, false);
}
break;
}
@ -292,7 +292,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_favorite_node);
if (node != NULL) {
node->is_favorite = false;
saveChanges(SEGMENT_DEVICESTATE, false);
saveChanges(SEGMENT_NODEDATABASE, false);
}
break;
}
@ -305,7 +305,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
node->has_position = false;
node->user.public_key.size = 0;
node->user.public_key.bytes[0] = 0;
saveChanges(SEGMENT_DEVICESTATE, false);
saveChanges(SEGMENT_NODEDATABASE, false);
}
break;
}
@ -314,7 +314,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(r->remove_ignored_node);
if (node != NULL) {
node->is_ignored = false;
saveChanges(SEGMENT_DEVICESTATE, false);
saveChanges(SEGMENT_NODEDATABASE, false);
}
break;
}
@ -325,7 +325,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
node->position = TypeConversions::ConvertToPositionLite(r->set_fixed_position);
nodeDB->setLocalPosition(r->set_fixed_position);
config.position.fixed_position = true;
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false);
#if !MESHTASTIC_EXCLUDE_GPS
if (gps != nullptr)
gps->enable();
@ -338,7 +338,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
LOG_INFO("Client received remove_fixed_position command");
nodeDB->clearLocalPosition();
config.position.fixed_position = false;
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false);
break;
}
case meshtastic_AdminMessage_set_time_only_tag: {
@ -452,7 +452,7 @@ void AdminModule::handleSetOwner(const meshtastic_User &o)
if (changed) { // If nothing really changed, don't broadcast on the network or write to flash
service->reloadOwner(!hasOpenEditTransaction);
saveChanges(SEGMENT_DEVICESTATE);
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_NODEDATABASE);
}
}
@ -1160,4 +1160,4 @@ void disableBluetooth()
nrf52Bluetooth->shutdown();
#endif
#endif
}
}