Skip to content

Commit

Permalink
Publish fixed position updates and consider changes in only altitude …
Browse files Browse the repository at this point in the history
…as an updated point (#3758)

* AdminModule: Publish fixed position updates

Enabled GPS thread when fixed position is updated, to let the GPS thread run once and publish the new fixed position.

Signed-off-by: Andrew Yong <[email protected]>

* GPS: Consider changes in only altitude as an updated point

Signed-off-by: Andrew Yong <[email protected]>

---------

Signed-off-by: Andrew Yong <[email protected]>
  • Loading branch information
ndoo authored May 2, 2024
1 parent 4f54862 commit 5f929a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/gps/GPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ bool GPS::lookForLocation()
#endif // GPS_EXTRAVERBOSE

// Is this a new point or are we re-reading the previous one?
if (!reader.location.isUpdated())
if (!reader.location.isUpdated() && !reader.altitude.isUpdated())
return false;

// check if a complete GPS solution set is available for reading
Expand Down
8 changes: 8 additions & 0 deletions src/modules/AdminModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#include "mqtt/MQTT.h"
#endif

#if !MESHTASTIC_EXCLUDE_GPS
#include "GPS.h"
#endif

AdminModule *adminModule;
bool hasOpenEditTransaction;

Expand Down Expand Up @@ -217,6 +221,10 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
nodeDB->setLocalPosition(r->set_fixed_position);
config.position.fixed_position = true;
saveChanges(SEGMENT_DEVICESTATE | SEGMENT_CONFIG, false);
#if !MESHTASTIC_EXCLUDE_GPS
if (gps != nullptr)
gps->enable();
#endif
}
break;
}
Expand Down

0 comments on commit 5f929a8

Please sign in to comment.