From 5f929a80244e7f5d4fda0df4571ecb0edbe55950 Mon Sep 17 00:00:00 2001 From: Andrew Yong Date: Thu, 2 May 2024 20:13:36 +0800 Subject: [PATCH] Publish fixed position updates and consider changes in only altitude 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 * GPS: Consider changes in only altitude as an updated point Signed-off-by: Andrew Yong --------- Signed-off-by: Andrew Yong --- src/gps/GPS.cpp | 2 +- src/modules/AdminModule.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 17e35a4b3f..1c1aac7adc 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -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 diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 54eb577f7b..37e798b3c5 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -23,6 +23,10 @@ #include "mqtt/MQTT.h" #endif +#if !MESHTASTIC_EXCLUDE_GPS +#include "GPS.h" +#endif + AdminModule *adminModule; bool hasOpenEditTransaction; @@ -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; }