fix: 修复 NodeInfo 不广播节点名字和公钥问题
- AdminModule: 显式同步 owner.role = config.device.role - NodeDB: CLIENT/CLIENT_MUTE 切回后恢复广播间隔 修复从 CLIENT_HIDDEN 切换回 CLIENT 后 NodeInfo 永不广播的问题
This commit is contained in:
@@ -128,6 +128,10 @@
|
|||||||
- 修复:有 pending multi-tap 时 `displayCursor = cursor + 1`
|
- 修复:有 pending multi-tap 时 `displayCursor = cursor + 1`
|
||||||
- **T9 按 0 无法输出空格**:`multiTapKey` 用 `0` 表示"无 pending",与按键 0 的值冲突
|
- **T9 按 0 无法输出空格**:`multiTapKey` 用 `0` 表示"无 pending",与按键 0 的值冲突
|
||||||
- 修复:无效标记从 `0` 改为 `0xFF`
|
- 修复:无效标记从 `0` 改为 `0xFF`
|
||||||
|
- **NodeInfo 不广播节点名字和公钥**:从 CLIENT_HIDDEN 切回 CLIENT/CLIENT_MUTE 后,`owner.role` 仍保持原值导致 NodeInfo 广播使用错误的 role
|
||||||
|
- 修复:在 `AdminModule::handleSetConfig()` 末尾显式同步 `owner.role = config.device.role`
|
||||||
|
- **从 CLIENT_HIDDEN 切回 CLIENT 后 NodeInfo 永不广播**:`installRoleDefaults(CLIENT_HIDDEN)` 设置 `node_info_broadcast_secs = INT32_MAX`,但切回 CLIENT 时无对应恢复分支
|
||||||
|
- 修复:在 `NodeDB::installRoleDefaults()` 新增 CLIENT/CLIENT_MUTE 分支,恢复 `default_node_info_broadcast_secs` 和相关广播间隔
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -958,6 +958,20 @@ void NodeDB::installRoleDefaults(meshtastic_Config_DeviceConfig_Role role)
|
|||||||
moduleConfig.telemetry.environment_update_interval = MAX_INTERVAL;
|
moduleConfig.telemetry.environment_update_interval = MAX_INTERVAL;
|
||||||
moduleConfig.telemetry.air_quality_interval = MAX_INTERVAL;
|
moduleConfig.telemetry.air_quality_interval = MAX_INTERVAL;
|
||||||
moduleConfig.telemetry.health_update_interval = MAX_INTERVAL;
|
moduleConfig.telemetry.health_update_interval = MAX_INTERVAL;
|
||||||
|
} else if (role == meshtastic_Config_DeviceConfig_Role_CLIENT ||
|
||||||
|
role == meshtastic_Config_DeviceConfig_Role_CLIENT_MUTE) {
|
||||||
|
// Restore default broadcast intervals when switching back from a restrictive role
|
||||||
|
// (e.g. CLIENT_HIDDEN sets node_info_broadcast_secs = MAX_INTERVAL; without this
|
||||||
|
// reset the node would never send NodeInfo after being switched back to CLIENT).
|
||||||
|
config.device.node_info_broadcast_secs = default_node_info_broadcast_secs;
|
||||||
|
config.position.position_broadcast_smart_enabled = true;
|
||||||
|
config.position.position_broadcast_secs = default_broadcast_interval_secs;
|
||||||
|
moduleConfig.neighbor_info.update_interval = 0; // 0 → coalesces to default in Default.h
|
||||||
|
moduleConfig.telemetry.device_update_interval = MAX_INTERVAL; // coalesces to default
|
||||||
|
moduleConfig.telemetry.environment_update_interval = 0;
|
||||||
|
moduleConfig.telemetry.air_quality_interval = 0;
|
||||||
|
moduleConfig.telemetry.health_update_interval = 0;
|
||||||
|
config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_ALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -634,6 +634,10 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
|||||||
nodeDB->installRoleDefaults(c.payload_variant.device.role);
|
nodeDB->installRoleDefaults(c.payload_variant.device.role);
|
||||||
changes |= SEGMENT_NODEDATABASE | SEGMENT_DEVICESTATE; // Some role defaults affect owner
|
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) {
|
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);
|
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;
|
config.device.node_info_broadcast_secs = min_node_info_broadcast_secs;
|
||||||
|
|||||||
Reference in New Issue
Block a user