From ae905930c5b812e2acca2440c11b1f0c50a2c5f0 Mon Sep 17 00:00:00 2001 From: Jonathan Hudson Date: Sun, 29 Dec 2024 12:57:55 +0000 Subject: [PATCH] generic improvement in position difference checks, part deux. --- src/mwp/mwp-flysky_processing.vala | 6 +++--- src/mwp/mwp-ltm_message.vala | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mwp/mwp-flysky_processing.vala b/src/mwp/mwp-flysky_processing.vala index 59213f1c..c358df27 100644 --- a/src/mwp/mwp-flysky_processing.vala +++ b/src/mwp/mwp-flysky_processing.vala @@ -68,14 +68,14 @@ namespace Flysky { var cse = Mwp.calc_cse_dist_delta(dlat, dlon, out ddm); var spd = (double)(rg.gps_speed/100.0); - - if(Math.fabs(ser.td.gps.lat - dlat) > 1e-6) { + var pdiff = Mwp.pos_diff(dlat, dlon, ser.td.gps.lat, ser.td.gps.lon); + if (Mwp.PosDiff.LAT in pdiff) { fvup |= FlightBox.Update.LAT; ttup |= TelemTracker.Fields.LAT; ser.td.gps.lat = dlat; } - if (Math.fabs(ser.td.gps.lon - dlon) > 1e-6) { + if (Mwp.PosDiff.LON in pdiff) { fvup |= FlightBox.Update.LON; ttup |= TelemTracker.Fields.LON; ser.td.gps.lon = dlon; diff --git a/src/mwp/mwp-ltm_message.vala b/src/mwp/mwp-ltm_message.vala index d31c603a..3d512709 100644 --- a/src/mwp/mwp-ltm_message.vala +++ b/src/mwp/mwp-ltm_message.vala @@ -103,7 +103,7 @@ namespace Mwp { ttup |= TelemTracker.Fields.LAT; ser.td.gps.lat = lat; } - if (PosDiff.LAT in pdiff) { + if (PosDiff.LON in pdiff) { fvup |= FlightBox.Update.LON; ttup |= TelemTracker.Fields.LON; ser.td.gps.lon = lon;