fix: apply LoRa config changes live without rebooting - #9931
Conversation
|
|
@Elwimen, Welcome to Meshtastic!Thanks for opening your first pull request. We really appreciate it. We discuss work as a team in discord, please join us in the #firmware channel. Welcome to the team 😄 |
There was a problem hiding this comment.
Pull request overview
Removes unnecessary reboot after saving LoRa configuration by relying on the existing configChanged → RadioInterface::reconfigure() live-apply path, and improves the on-device display string for custom modem parameters.
Changes:
- Update
AdminModule::handleSetConfig()to reboot only whensx126x_rx_boosted_gainchanges. - Update
DisplayFormatters::getModemPresetDisplayName()to show BW/SF/CR when not using a preset (for non-short names).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/modules/AdminModule.cpp |
Changes reboot decision logic for LoRa config updates to prefer live reconfigure. |
src/DisplayFormatters.cpp |
Formats a detailed “custom” modem string for display when not using a preset. |
You can also share your feedback on Copilot code review. Take the survey.
72cdf24 to
3fe8cee
Compare
|
@Copilot review |
There was a problem hiding this comment.
Pull request overview
This PR updates Meshtastic’s configuration-application path so LoRa modem/radio parameter changes take effect immediately via the existing configChanged → RadioInterface::reloadConfig() → reconfigure() observer chain, avoiding unnecessary device reboots, and improves how custom modem settings are displayed in the debug UI.
Changes:
- Avoid blanket reboot on LoRa config changes; reboot only for
sx126x_rx_boosted_gainchanges. - Reject
LORA_24region at runtime when the active radio hardware cannot do 2.4 GHz. - Improve debug display of custom modem settings while keeping
DisplayFormatters’ “Custom” string stable for non-display callers.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/modules/AdminModule.cpp |
Removes most LoRa-config reboots; adds runtime LORA_24 rejection logic. |
src/graphics/draw/DebugRenderer.cpp |
Displays custom modem parameters (BW/SF/CR) instead of a generic “Custom”. |
src/DisplayFormatters.cpp |
Documents that “Custom” must remain stable for non-display callers. |
You can also share your feedback on Copilot code review. Take the survey.
The configChanged observer already calls reconfigure() on all radio interfaces when LoRa config is saved, which puts the radio in standby, reprograms all modem parameters (SF, BW, CR, freq, power), and restarts receive. The reboot was therefore redundant. This commit: - Removes the reboot trigger for LoRa config changes in AdminModule - Rejects LORA_24 region at runtime with BAD_REQUEST if the active radio does not support 2.4 GHz, replacing the startup-only reboot-based check - Moves the BW/SF/CR display formatting into DebugRenderer, keeping getModemPresetDisplayName() semantics stable for non-display callers (RadioInterface frequency slot hashing, Channels default-channel detection) Portduino with SimRadio already skipped the reboot via the same reasoning.
3fe8cee to
d63bba3
Compare
|
@Copilot review |
There was a problem hiding this comment.
Pull request overview
Removes unnecessary reboots when applying LoRa configuration changes by relying on the existing configChanged → RadioInterface::reconfigure() live-reload path, while keeping a targeted reboot for the sx126x_rx_boosted_gain init-only setting. Also improves how custom modem settings are displayed, and adds runtime rejection for unsupported LORA_24 on non-2.4GHz-capable hardware.
Changes:
- Apply most LoRa config changes live (reboot only for
sx126x_rx_boosted_gainchanges). - Reject
LORA_24at runtime when the active radio cannot do 2.4GHz. - Improve display of custom modem params without changing non-display callers’ stable
"Custom"semantics.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/modules/AdminModule.cpp | Removes blanket reboot on LoRa changes; adds runtime LORA_24 hardware-capability validation. |
| src/graphics/draw/DebugRenderer.cpp | Renders custom modem parameters (BW/SF/CR) directly for display. |
| src/DisplayFormatters.cpp | Documents and preserves stable "Custom" return for non-preset mode. |
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@Copilot Addressed in latest commit:
|
e5cddad to
529ebcd
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates Meshtastic’s configuration flow so LoRa modem changes apply immediately (via the existing configChanged → RadioInterface::reconfigure() path) instead of forcing a reboot, while preserving compatibility for the sx126x_rx_boosted_gain init-only setting. It also improves how “custom” modem settings are presented on-device without changing non-display semantics used elsewhere.
Changes:
- Remove the blanket reboot after LoRa config updates; reboot only when
sx126x_rx_boosted_gainchanges. - Reject
LORA_24region changes at runtime on hardware that doesn’t support wide/2.4 GHz LoRa. - Improve debug display formatting for custom modem settings while keeping
"Custom"stable for non-display callers.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/modules/AdminModule.cpp | Applies LoRa config changes live (no reboot) except boosted-gain; adds runtime LORA_24 capability validation. |
| src/graphics/draw/DebugRenderer.cpp | Displays BW/SF/CR for non-preset configurations without altering shared formatter behavior. |
| src/DisplayFormatters.cpp | Documents and preserves "Custom" as a stable literal for non-preset mode to avoid affecting non-display logic. |
You can also share your feedback on Copilot code review. Take the survey.
…heck - DebugRenderer: use %u instead of %d for uint32_t bandwidth/SF/CR fields - AdminModule: extract LORA_24 check into named bools for readability; fail closed when RadioLibInterface::instance is null
529ebcd to
c245412
Compare
|
@Copilot review |
|
@thebentern Is there anything else that needs to be done? Can we merge this thing? |
|
Closing in favour of a consolidated PR that also includes live apply of sx126x_rx_boosted_gain changes and LORA_24 hardware validation. |
Summary
When LoRa configuration is saved,
AdminModule::saveChanges()callsservice->reloadConfig()which firesconfigChanged.notifyObservers(). This observer is already wired toRadioInterface::reloadConfig()→reconfigure(), which puts the radio in standby, reprograms all modem parameters (SF, BW, CR, frequency, power), and restarts receive — all without a reboot. The reboot that followed was therefore redundant.sx126x_rx_boosted_gainexception: this flag is applied duringinit()vialora.begin()and the retention memory writes involved are part of the chip initialization sequence (per SX1261/2 datasheet section 9.6). Register0x08ACis preserved through STDBY mode, so it remains correctly set acrossreconfigure()calls. A reboot is still triggered only when that specific flag changes.Prior art:
ARCH_PORTDUINOwithSimRadioalready skipped the reboot for this exact reason.Bonus: custom modem config display now shows
EU_868/BW125-SF7-CR5instead ofEU_868/Custom.Changes
src/modules/AdminModule.cpp— remove blanket reboot for LoRa config changes; reboot only whensx126x_rx_boosted_gainchanges; rejectLORA_24region at runtime withBAD_REQUESTif the active radio hardware does not support 2.4 GHz (replaces the startup-only validation that previously required a reboot to enforce)src/DisplayFormatters.cpp— keep"Custom"return value stable for non-preset mode (used byRadioInterfaceforuses_default_frequency_slothashing and byChannelsfor default-channel detection)src/graphics/draw/DebugRenderer.cpp— formatBW/SF/CRdirectly in the display renderer when not using a preset, keeping the display improvement without affecting any non-display callersTest plan
LORA_24region on SX1262 hardware returnsBAD_REQUESTand logs a warning; config is not applied