From f78db641192b31a3453591ae6a56a29c3a0d77e8 Mon Sep 17 00:00:00 2001 From: Mike Fiore Date: Wed, 2 Dec 2015 15:51:43 -0600 Subject: update success and failure layouts and modes to display GPS data when available --- Layout/LayoutSurveySuccess.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'Layout/LayoutSurveySuccess.cpp') diff --git a/Layout/LayoutSurveySuccess.cpp b/Layout/LayoutSurveySuccess.cpp index 38edb5c..01a0c94 100644 --- a/Layout/LayoutSurveySuccess.cpp +++ b/Layout/LayoutSurveySuccess.cpp @@ -83,6 +83,17 @@ void LayoutSurveySuccess::updateStats(LoRaHandler::LoRaPing ping) { } void LayoutSurveySuccess::updateGpsLatitude(GPSPARSER::latitude lat) { + char buf[32]; + size_t size; + + memset(buf, 0, sizeof(buf)); + size = snprintf(buf, sizeof(buf), "%d %d %d.%03d %c", + abs(lat.degrees), + lat.minutes, + (lat.seconds * 6) / 1000, + (lat.seconds * 6) % 1000, + (lat.degrees > 0) ? 'N' : 'S'); + writeField(_fGpsLat, buf, size, true); } void LayoutSurveySuccess::updateGpsLatitude(std::string msg) { @@ -90,9 +101,31 @@ void LayoutSurveySuccess::updateGpsLatitude(std::string msg) { } void LayoutSurveySuccess::updateGpsLongitude(GPSPARSER::longitude lon) { + char buf[32]; + size_t size; + + memset(buf, 0, sizeof(buf)); + size = snprintf(buf, sizeof(buf), "%d %d %d.%03d %c", + abs(lon.degrees), + lon.minutes, + (lon.seconds * 6) / 1000, + (lon.seconds * 6) % 1000, + (lon.degrees > 0) ? 'E' : 'W'); + writeField(_fGpsLon, buf, size, true); } void LayoutSurveySuccess::updateGpsTime(struct tm time) { + char buf[32]; + size_t size; + + memset(buf, 0, sizeof(buf)); + size = snprintf(buf, sizeof(buf), "%02d:%02d %02d/%02d/%04d", + time.tm_hour, + time.tm_min, + time.tm_mon + 1, + time.tm_mday, + time.tm_year + 1900); + writeField(_fGpsTime, buf, size, true); } void LayoutSurveySuccess::updateInfo(std::string info) { -- cgit v1.2.3