mirror of
https://github.com/meshtastic/firmware.git
synced 2025-07-30 02:15:41 +00:00
Clear position on GPS deactivation, unless using fixed position
As reported by @dreimal8 , and confirmed by @tuxmobil , when using and then subsequently disabling GPS the last position retrieved from the GPS was stored and continued to be broadcast. This change introduces a check to see if we are transitioning from GPS Enabled to GPS Disabled or Not Present. If we are, and fixed position is not in use, then we clear the local position. This will prevent inaccurate and undesired position broadcasts for those who disable their GPS. Fixes https://github.com/meshtastic/firmware/issues/7228
This commit is contained in:
parent
bbc638ab82
commit
bbe4dd49e9
@ -638,7 +638,16 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
||||
case meshtastic_Config_position_tag:
|
||||
LOG_INFO("Set config: Position");
|
||||
config.has_position = true;
|
||||
// If we have turned off the GPS (disabled or not present) and we're not using fixed position,
|
||||
// clear the stored position since it may not get updated
|
||||
if (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED &&
|
||||
c.payload_variant.position.gps_mode != meshtastic_Config_PositionConfig_GpsMode_ENABLED &&
|
||||
config.position.fixed_position == false && c.payload_variant.position.fixed_position == false) {
|
||||
nodeDB->clearLocalPosition();
|
||||
saveChanges(SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false);
|
||||
}
|
||||
config.position = c.payload_variant.position;
|
||||
|
||||
// Save nodedb as well in case we got a fixed position packet
|
||||
break;
|
||||
case meshtastic_Config_power_tag:
|
||||
|
Loading…
Reference in New Issue
Block a user