diff options
author | Mike Fiore <mfiore@multitech.com> | 2015-12-02 15:51:43 -0600 |
---|---|---|
committer | Mike Fiore <mfiore@multitech.com> | 2015-12-02 15:51:43 -0600 |
commit | f78db641192b31a3453591ae6a56a29c3a0d77e8 (patch) | |
tree | b79d654ec55361819e40fc4e523d13e2e21a909c /Layout/LayoutSurveySuccess.cpp | |
parent | 10a50c37dfa08f0355ceb5664b92f50b4aba9fd2 (diff) | |
download | mtdot-box-evb-factory-firmware-f78db641192b31a3453591ae6a56a29c3a0d77e8.tar.gz mtdot-box-evb-factory-firmware-f78db641192b31a3453591ae6a56a29c3a0d77e8.tar.bz2 mtdot-box-evb-factory-firmware-f78db641192b31a3453591ae6a56a29c3a0d77e8.zip |
update success and failure layouts and modes to display GPS data when available
Diffstat (limited to 'Layout/LayoutSurveySuccess.cpp')
-rw-r--r-- | Layout/LayoutSurveySuccess.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
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) { |