From 4a7ab715f7115460892927b998b2c45828f275d6 Mon Sep 17 00:00:00 2001 From: Mike Fiore Date: Tue, 1 Dec 2015 15:11:03 -0600 Subject: update progress and pass/fail for sweep --- Layout/LayoutSurveyFailure.cpp | 40 ++++++++++++++++++++++++++++++---------- Layout/LayoutSurveyFailure.h | 13 +++++++++---- Layout/LayoutSurveySuccess.cpp | 15 ++++++++++++++- Layout/LayoutSurveySuccess.h | 2 ++ Layout/LayoutSweepProgress.cpp | 15 ++++----------- Layout/LayoutSweepProgress.h | 4 +--- 6 files changed, 60 insertions(+), 29 deletions(-) (limited to 'Layout') diff --git a/Layout/LayoutSurveyFailure.cpp b/Layout/LayoutSurveyFailure.cpp index d443098..aa2ce7c 100644 --- a/Layout/LayoutSurveyFailure.cpp +++ b/Layout/LayoutSurveyFailure.cpp @@ -2,18 +2,19 @@ LayoutSurveyFailure::LayoutSurveyFailure(DOGS102* lcd) : Layout(lcd), - _lTitle(0, 2, "Survey Failed"), + _lTitle(0, 1, "Survey Failed"), _lId(0, 0, "ID"), _lDr(8, 0, "DR"), _lPwr(13, 0, "P"), - _lSw1(12, 7, "Power"), - _lSw2(0, 7, "Survey"), _fId(2, 0, 5), _fDr(10, 0, 2), _fPwr(14, 0, 2), - _fMsg1(0, 4, 17), - _fMsg2(0, 5, 17), - _fInfo(0, 6, 17) + _fMsg1(0, 2, 17), + _fMsg2(0, 3, 17), + _fInfo1(0, 5, 17), + _fInfo2(0, 6, 17), + _fSw1(9, 7, 8), + _fSw2(0, 7, 8) {} LayoutSurveyFailure::~LayoutSurveyFailure() {} @@ -26,8 +27,6 @@ void LayoutSurveyFailure::display() { writeLabel(_lId); writeLabel(_lDr); writeLabel(_lPwr); - writeLabel(_lSw1); - writeLabel(_lSw2); endUpdate(); } @@ -52,7 +51,28 @@ void LayoutSurveyFailure::updatePower(uint32_t power) { writeField(_fPwr, buf, size, true); } -void LayoutSurveyFailure::updateInfo(std::string info) { - writeField(_fInfo, info, true); +void LayoutSurveyFailure::updateInfo1(std::string info) { + writeField(_fInfo1, info, true); +} + +void LayoutSurveyFailure::updateInfo2(std::string info) { + writeField(_fInfo2, info, true); +} + +void LayoutSurveyFailure::updatePassFail(uint8_t pass, uint8_t fail) { + char buf[32]; + size_t size; + + memset(buf, 0, sizeof(buf)); + size = snprintf(buf, sizeof(buf), "Pass %u Fail %u", pass, fail); + writeField(_fInfo1, buf, size, true); +} + +void LayoutSurveyFailure::updateSw1(std::string sw1) { + writeField(_fSw1, sw1, true); +} + +void LayoutSurveyFailure::updateSw2(std::string sw2) { + writeField(_fSw2, sw2, true); } diff --git a/Layout/LayoutSurveyFailure.h b/Layout/LayoutSurveyFailure.h index 473fd9f..ca6aebd 100644 --- a/Layout/LayoutSurveyFailure.h +++ b/Layout/LayoutSurveyFailure.h @@ -12,22 +12,27 @@ class LayoutSurveyFailure : public Layout { void updateId(uint32_t id); void updateRate(std::string rate); void updatePower(uint32_t power); - void updateInfo(std::string msg); + void updateInfo1(std::string msg); + void updateInfo2(std::string msg); + void updatePassFail(uint8_t pass, uint8_t fail); + void updateSw1(std::string sw1); + void updateSw2(std::string sw2); private: Label _lTitle; Label _lId; Label _lDr; Label _lPwr; - Label _lSw1; - Label _lSw2; Field _fId; Field _fDr; Field _fPwr; Field _fMsg1; Field _fMsg2; - Field _fInfo; + Field _fInfo1; + Field _fInfo2; + Field _fSw1; + Field _fSw2; }; #endif diff --git a/Layout/LayoutSurveySuccess.cpp b/Layout/LayoutSurveySuccess.cpp index 68ef1dc..38edb5c 100644 --- a/Layout/LayoutSurveySuccess.cpp +++ b/Layout/LayoutSurveySuccess.cpp @@ -85,6 +85,10 @@ void LayoutSurveySuccess::updateStats(LoRaHandler::LoRaPing ping) { void LayoutSurveySuccess::updateGpsLatitude(GPSPARSER::latitude lat) { } +void LayoutSurveySuccess::updateGpsLatitude(std::string msg) { + writeField(_fGpsLat, msg, true); +} + void LayoutSurveySuccess::updateGpsLongitude(GPSPARSER::longitude lon) { } @@ -104,7 +108,7 @@ void LayoutSurveySuccess::updateSw2(std::string sw2) { } void LayoutSurveySuccess::updateCountdown(uint32_t seconds) { - char buf[16]; + char buf[32]; size_t size; memset(buf, 0, sizeof(buf)); @@ -115,3 +119,12 @@ void LayoutSurveySuccess::updateCountdown(uint32_t seconds) { writeField(_fSw2, buf, size, true); } +void LayoutSurveySuccess::updatePassFail(uint8_t pass, uint8_t fail) { + char buf[32]; + size_t size; + + memset(buf, 0, sizeof(buf)); + size = snprintf(buf, sizeof(buf), "Pass %u Fail %u", pass, fail); + writeField(_fGpsTime, buf, size, true); +} + diff --git a/Layout/LayoutSurveySuccess.h b/Layout/LayoutSurveySuccess.h index dd7e740..49113cb 100644 --- a/Layout/LayoutSurveySuccess.h +++ b/Layout/LayoutSurveySuccess.h @@ -16,12 +16,14 @@ class LayoutSurveySuccess : public Layout { void updatePower(uint32_t power); void updateStats(LoRaHandler::LoRaPing ping); void updateGpsLatitude(GPSPARSER::latitude lat); + void updateGpsLatitude(std::string msg); void updateGpsLongitude(GPSPARSER::longitude lon); void updateGpsTime(struct tm time); void updateInfo(std::string info); void updateSw1(std::string sw1); void updateSw2(std::string sw2); void updateCountdown(uint32_t seconds); + void updatePassFail(uint8_t pass, uint8_t fail); private: Label _lId; diff --git a/Layout/LayoutSweepProgress.cpp b/Layout/LayoutSweepProgress.cpp index 9ec77cc..ec4bbc9 100644 --- a/Layout/LayoutSweepProgress.cpp +++ b/Layout/LayoutSweepProgress.cpp @@ -2,12 +2,10 @@ LayoutSweepProgress::LayoutSweepProgress(DOGS102* lcd) : Layout(lcd), - _lSlash(8, 1, "/"), - _lMsg1(5, 2, "Sweep"), + _lMsg1(6, 2, "Sweep"), _lMsg2(7, 3, "in"), _lMsg3(4, 4, "Progress"), - _fComplete(6, 1, 2), - _fTotal(9, 1, 2), + _fProgress(6, 1, 5), _fCountdownLabel(0, 6, 17), _fCountdown(0, 7, 9) {} @@ -18,7 +16,6 @@ void LayoutSweepProgress::display() { clear(); startUpdate(); - writeLabel(_lSlash); writeLabel(_lMsg1); writeLabel(_lMsg2); writeLabel(_lMsg3); @@ -31,12 +28,8 @@ void LayoutSweepProgress::updateProgress(uint8_t complete, uint8_t total) { size_t size; memset(buf, 0, sizeof(buf)); - size = snprintf(buf, sizeof(buf), "%2u", complete); - writeField(_fComplete, buf, size, true); - - memset(buf, 0, sizeof(buf)); - size = snprintf(buf, sizeof(buf), "%u", total); - writeField(_fTotal, buf, size, true); + size = snprintf(buf, sizeof(buf), "%u/%u", complete, total); + writeField(_fProgress, buf, size, true); } void LayoutSweepProgress::updateCountdown(uint32_t seconds) { diff --git a/Layout/LayoutSweepProgress.h b/Layout/LayoutSweepProgress.h index 82c8081..d8e8720 100644 --- a/Layout/LayoutSweepProgress.h +++ b/Layout/LayoutSweepProgress.h @@ -14,13 +14,11 @@ class LayoutSweepProgress : public Layout { void updateCountdown(uint32_t seconds); private: - Label _lSlash; Label _lMsg1; Label _lMsg2; Label _lMsg3; - Field _fComplete; - Field _fTotal; + Field _fProgress; Field _fCountdownLabel; Field _fCountdown; }; -- cgit v1.2.3