mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-31 23:21:06 +00:00
Unmessagable implementation and defaults (#6811)
* Unmessagable implementation and defaults * Router and router late are unmessagable by default * Update src/modules/AdminModule.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -504,6 +504,12 @@ void AdminModule::handleSetOwner(const meshtastic_User &o)
|
||||
sendWarning(licensedModeMessage);
|
||||
}
|
||||
}
|
||||
if (owner.has_is_unmessagable != o.has_is_unmessagable ||
|
||||
(o.has_is_unmessagable && owner.is_unmessagable != o.is_unmessagable)) {
|
||||
changed = 1;
|
||||
owner.has_is_unmessagable = o.has_is_unmessagable || o.has_is_unmessagable;
|
||||
owner.is_unmessagable = o.is_unmessagable;
|
||||
}
|
||||
|
||||
if (changed) { // If nothing really changed, don't broadcast on the network or write to flash
|
||||
service->reloadOwner(!hasOpenEditTransaction);
|
||||
@@ -553,8 +559,10 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
||||
sendWarning(warning);
|
||||
}
|
||||
// If we're setting router role for the first time, install its intervals
|
||||
if (existingRole != c.payload_variant.device.role)
|
||||
if (existingRole != c.payload_variant.device.role) {
|
||||
nodeDB->installRoleDefaults(c.payload_variant.device.role);
|
||||
changes |= SEGMENT_NODEDATABASE | SEGMENT_DEVICESTATE; // Some role defaults affect owner
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -86,6 +86,11 @@ meshtastic_MeshPacket *NodeInfoModule::allocReply()
|
||||
u.public_key.bytes[0] = 0;
|
||||
u.public_key.size = 0;
|
||||
}
|
||||
// Coerce unmessagable for Repeater role
|
||||
if (u.role == meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||
u.has_is_unmessagable = true;
|
||||
u.is_unmessagable = true;
|
||||
}
|
||||
|
||||
LOG_INFO("Send owner %s/%s/%s", u.id, u.long_name, u.short_name);
|
||||
lastSentToMesh = millis();
|
||||
|
||||
Reference in New Issue
Block a user