Merge pull request #3936 from meshcore-dev/sensor-gps-movement

Sensor GPS telemetry push
This commit is contained in:
ripplebiz authored and GitHub committed 2026-11-29 10:51:44 +11:00
commit 8603065de7
3 files changed
+83 -12

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
#pragma once
class GPSLocHelper {
static constexpr double APPROX_RADIUS = 6371e3; // 6,371 km
static double toRadians(float degrees) {
return degrees * PI / 180;
}
public:
static float calcGreatArcMeters(float lat1, float lon1, float lat2, float lon2) {
double diffLati = toRadians(lat1 - lat2);
double diffLong = toRadians(lon1 - lon2);
double radiusStartLati = toRadians(lat2);
double radiusEndLati = toRadians(lat1);
// A and C are the 'sides' from the spherical triangle.
double sinLati = sin(diffLati / 2);
double sinLong = sin(diffLong / 2);
double a = sinLati*sinLati + sinLong*sinLong * cos(radiusStartLati) * cos(radiusEndLati);
double c = 2 * asin(sqrt(a));
return APPROX_RADIUS * c;
}
};
+6
View File
@@ -162,6 +162,12 @@ public:
return size;
}
static uint8_t readGPS(const uint8_t* _buf, float& lat, float& lon, float& alt) {
lat = getFloat(&_buf[0], 3, 10000, true);
lon = getFloat(&_buf[3], 3, 10000, true);
alt = getFloat(&_buf[6], 3, 100, true);
return 9;
}
};
class LPPReader {