feat(gps): Do not start gps if lora region is unset#10386
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce unnecessary power usage by preventing the GPS subsystem from being initialized when the device’s LoRa region is still UNSET (since radio operation is blocked until a valid region is configured).
Changes:
- Gate GPS creation during boot on
config.lora.region != UNSET. - Add logic to create/attach GPS when a region is set later via Admin config updates.
- Add logic to create/attach GPS when a region is set via the on-device region picker UI.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/main.cpp |
Prevents GPS initialization at boot when LoRa region is UNSET. |
src/modules/AdminModule.cpp |
Attempts to start GPS after a LoRa region is configured via Admin set-config flow. |
src/graphics/draw/MenuHandler.cpp |
Attempts to start GPS after a LoRa region is selected in the device UI. |
There is little reason to waste battery on the gps if the data cannot yet be used.
|
I have changed the concept of this change a bit, to avoid the ai reported concerns. Instead of not creating the gps object at all, this now does not stop object creation, but will disable the thread if the lora region is unset. |
|
@thebentern Any thoughts on this revision? |
|
It's been another three weeks since any response. Is there any further concerns? If not, this appears to have necessary approvals, so can it be merged? |
Refactor GPS enabling logic and remove duplicate code.
Firmware Size Report22 targets | vs
Show 17 more target(s)
Updated for a128563 |
There is little reason to waste battery on the gps if the data cannot yet be used.
🤝 Attestations