mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-09 11:27:29 +00:00
Implement rebroadcast mode NONE (#5040)
* Implement rebroadcast mode none * Correct debug message
This commit is contained in:
@@ -451,6 +451,14 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
||||
requiresReboot = false;
|
||||
}
|
||||
config.device = c.payload_variant.device;
|
||||
if (config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_NONE &&
|
||||
IS_ONE_OF(config.device.role, meshtastic_Config_DeviceConfig_Role_ROUTER,
|
||||
meshtastic_Config_DeviceConfig_Role_REPEATER)) {
|
||||
config.device.rebroadcast_mode = meshtastic_Config_DeviceConfig_RebroadcastMode_ALL;
|
||||
const char *warning = "Rebroadcast mode can't be set to NONE for a router or repeater\n";
|
||||
LOG_WARN(warning);
|
||||
sendWarning(warning);
|
||||
}
|
||||
// If we're setting router role for the first time, install its intervals
|
||||
if (existingRole != c.payload_variant.device.role)
|
||||
nodeDB->installRoleDefaults(c.payload_variant.device.role);
|
||||
@@ -1064,6 +1072,15 @@ bool AdminModule::messageIsRequest(const meshtastic_AdminMessage *r)
|
||||
return false;
|
||||
}
|
||||
|
||||
void AdminModule::sendWarning(const char *message)
|
||||
{
|
||||
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
|
||||
cn->level = meshtastic_LogRecord_Level_WARNING;
|
||||
cn->time = getValidTime(RTCQualityFromNet);
|
||||
strncpy(cn->message, message, sizeof(cn->message));
|
||||
service->sendClientNotification(cn);
|
||||
}
|
||||
|
||||
void disableBluetooth()
|
||||
{
|
||||
#if HAS_BLUETOOTH
|
||||
|
||||
@@ -57,6 +57,7 @@ class AdminModule : public ProtobufModule<meshtastic_AdminMessage>, public Obser
|
||||
|
||||
bool messageIsResponse(const meshtastic_AdminMessage *r);
|
||||
bool messageIsRequest(const meshtastic_AdminMessage *r);
|
||||
void sendWarning(const char *message);
|
||||
};
|
||||
|
||||
extern AdminModule *adminModule;
|
||||
|
||||
Reference in New Issue
Block a user