From 1f59156f25a8e23cd2d9bfec7d7ec121539e95d5 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Fri, 14 Aug 2026 14:32:26 +0200 Subject: cleanup --- makefile | 4 ++-- src/main.cpp | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/makefile b/makefile index a8742bf..8830136 100644 --- a/makefile +++ b/makefile @@ -13,13 +13,13 @@ minmea.tgz: curl -s -o $@ https://codeload.github.com/kosma/minmea/tar.gz/refs/tags/v1.0.0 src/.minmea.stamp: minmea.tgz | src - tar -xzvf $< --strip-components=1 -C src/ minmea-1.0.0/minmea.h minmea-1.0.0/minmea.c + tar -xzf $< --strip-components=1 -C src/ minmea-1.0.0/minmea.h minmea-1.0.0/minmea.c touch $@ src/minmea.h src/minmea.c: src/.minmea.stamp clean: - rm -rf bin obj minmea.tgz + rm -rf bin obj minmea.tgz src/minmea.h src/minmea.c src/.minmea.stamp bin obj: mkdir -p $@ diff --git a/src/main.cpp b/src/main.cpp index ed98cb4..7297703 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,7 +39,7 @@ read_line(asio::serial_port& com) } string -get_gps_datetime(const minmea_time& time, const minmea_date& date) +get_gps_datetime(const minmea_date& date, const minmea_time& time) { tm tm_utc{}; ::minmea_getdatetime(&tm_utc, &date, &time); @@ -80,13 +80,16 @@ main() continue; } - auto timestamp = get_gps_datetime(frame.time, frame.date); + const auto latitude = ::minmea_tocoord(&frame.latitude); + const auto longitude = ::minmea_tocoord(&frame.longitude); + const auto speed = ::minmea_tofloat(&frame.speed) * KNOTS_TO_KMH; + const auto timestamp = get_gps_datetime(frame.date, frame.time); cout << format("{}: $RMC floating point degree coordinates and speed: ({},{}) {} km/h\n", timestamp, - ::minmea_tocoord(&frame.latitude), - ::minmea_tocoord(&frame.longitude), - ::minmea_tofloat(&frame.speed) * KNOTS_TO_KMH); + latitude, + longitude, + speed); } } catch ( exception& e ) { -- cgit v1.3