From 1b4b46ac9f3272908b7bc5c7f21e087b0e5f8084 Mon Sep 17 00:00:00 2001 From: Ted Timmons Date: Mon, 11 Apr 2016 22:35:32 -0700 Subject: [PATCH] calculate distance with one known point First, apologies because I'm not equipped to test this, nor am I sure it's correct, but I hope it's close. The idea is to create a helper method for gps.location.distanceBetween(). That way the object's location can be used instead of needing to pass it back in: gps.distanceBetween(otherLat, otherLng, gps.location.lat(), gps.location.lng()) Here's the helper method: gps.location.distanceBetween(otherLat, otherLng) --- firmware/TinyGPS++.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/firmware/TinyGPS++.cpp b/firmware/TinyGPS++.cpp index 12560bc..06925ce 100755 --- a/firmware/TinyGPS++.cpp +++ b/firmware/TinyGPS++.cpp @@ -374,6 +374,12 @@ double TinyGPSLocation::lng() return rawLngData.negative ? -ret : ret; } +double TinyGPSLocation::distanceBetween(double lat1, double long1) +{ + return TinyGPSPlus::distanceBetween(double lat1, double long1, lat(), lng()); +} + + void TinyGPSDate::commit() { date = newDate;