mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 14:12:05 +00:00
Merge 6bda1f8c34
into ba296db701
This commit is contained in:
commit
a49f817bca
@ -499,6 +499,23 @@ void NodeDB::installDefaultConfig(bool preserveKey = false)
|
|||||||
true; // FIXME: maybe false in the future, and setting region to enable it. (unset region forces it off)
|
true; // FIXME: maybe false in the future, and setting region to enable it. (unset region forces it off)
|
||||||
config.lora.override_duty_cycle = false;
|
config.lora.override_duty_cycle = false;
|
||||||
config.lora.config_ok_to_mqtt = false;
|
config.lora.config_ok_to_mqtt = false;
|
||||||
|
|
||||||
|
#ifdef USERPREFS_CONFIG_DEVICE_ROLE
|
||||||
|
// Restrict ROUTER*, LOST AND FOUND, and REPEATER roles for security reasons
|
||||||
|
if (IS_ONE_OF(USERPREFS_CONFIG_DEVICE_ROLE,
|
||||||
|
meshtastic_Config_DeviceConfig_Role_ROUTER,
|
||||||
|
meshtastic_Config_DeviceConfig_Role_ROUTER_LATE,
|
||||||
|
meshtastic_Config_DeviceConfig_Role_REPEATER,
|
||||||
|
meshtastic_Config_DeviceConfig_Role_LOST_AND_FOUND)) {
|
||||||
|
LOG_WARN("ROUTER roles are restricted, falling back to CLIENT role");
|
||||||
|
config.device.role = meshtastic_Config_DeviceConfig_Role_CLIENT;
|
||||||
|
} else {
|
||||||
|
config.device.role = USERPREFS_CONFIG_DEVICE_ROLE;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
config.device.role = meshtastic_Config_DeviceConfig_Role_CLIENT; // Default to client.
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USERPREFS_CONFIG_LORA_REGION
|
#ifdef USERPREFS_CONFIG_LORA_REGION
|
||||||
config.lora.region = USERPREFS_CONFIG_LORA_REGION;
|
config.lora.region = USERPREFS_CONFIG_LORA_REGION;
|
||||||
#else
|
#else
|
||||||
@ -671,6 +688,11 @@ void NodeDB::installDefaultConfig(bool preserveKey = false)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USERPREFS_CONFIG_DEVICE_ROLE
|
||||||
|
//Apply role-specific defaults when role is set via user preferences
|
||||||
|
installRoleDefaults(config.device.role);
|
||||||
|
#endif
|
||||||
|
|
||||||
initConfigIntervals();
|
initConfigIntervals();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1822,4 +1844,4 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co
|
|||||||
LOG_ERROR("A critical failure occurred, portduino is exiting");
|
LOG_ERROR("A critical failure occurred, portduino is exiting");
|
||||||
exit(2);
|
exit(2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user