fix: 修复 NodeInfo 不广播节点名字和公钥问题

- AdminModule: 显式同步 owner.role = config.device.role
- NodeDB: CLIENT/CLIENT_MUTE 切回后恢复广播间隔

修复从 CLIENT_HIDDEN 切换回 CLIENT 后 NodeInfo 永不广播的问题
This commit is contained in:
2026-03-30 16:49:13 +08:00
parent a2b612f7d6
commit 449d14ef64
3 changed files with 22 additions and 0 deletions
@@ -634,6 +634,10 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
nodeDB->installRoleDefaults(c.payload_variant.device.role);
changes |= SEGMENT_NODEDATABASE | SEGMENT_DEVICESTATE; // Some role defaults affect owner
}
// Always keep owner.role in sync with config.device.role so that outgoing NodeInfo
// broadcasts reflect the actual current role immediately (owner is loaded from devicestate
// at boot but never re-synced afterwards without this explicit assignment).
owner.role = config.device.role;
if (config.device.node_info_broadcast_secs < min_node_info_broadcast_secs) {
LOG_DEBUG("Tried to set node_info_broadcast_secs too low, setting to %d", min_node_info_broadcast_secs);
config.device.node_info_broadcast_secs = min_node_info_broadcast_secs;