From 37260f2ccff2793f54bfd291169d2c8d879bbc15 Mon Sep 17 00:00:00 2001 From: Mike Fiore Date: Mon, 30 Nov 2015 15:50:22 -0600 Subject: start work on survey sweep - currently determines rates and power levels to use and prints them out --- Layout/LayoutSweepComplete.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++ Layout/LayoutSweepComplete.h | 29 ++++++++++++++++++++++ Layout/LayoutSweepProgress.cpp | 53 ++++++++++++++++++++++++++++++++++++++++ Layout/LayoutSweepProgress.h | 28 +++++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 Layout/LayoutSweepComplete.cpp create mode 100644 Layout/LayoutSweepComplete.h create mode 100644 Layout/LayoutSweepProgress.cpp create mode 100644 Layout/LayoutSweepProgress.h (limited to 'Layout') diff --git a/Layout/LayoutSweepComplete.cpp b/Layout/LayoutSweepComplete.cpp new file mode 100644 index 0000000..ab44b7b --- /dev/null +++ b/Layout/LayoutSweepComplete.cpp @@ -0,0 +1,55 @@ +#include "LayoutSweepComplete.h" + +LayoutSweepComplete::LayoutSweepComplete(DOGS102* lcd) + : Layout(lcd), + _lId(0, 0, "ID"), + _lInfo(0, 1, "Sweep Finished"), + _lPass(0, 5, "Pass"), + _lFail(9, 5, "Fail"), + _lSw1(11, 7, "Cancel"), + _lSw2(0, 7, "Sweep"), + _fId(2, 0, 5), + _fPass(5, 5, 2), + _fFail(14, 5, 2) +{} + +LayoutSweepComplete::~LayoutSweepComplete() {} + +void LayoutSweepComplete::display() { + clear(); + startUpdate(); + + writeLabel(_lId); + writeLabel(_lInfo); + writeLabel(_lPass); + writeLabel(_lFail); + writeLabel(_lSw1); + writeLabel(_lSw2); + + endUpdate(); +} + +void LayoutSweepComplete::updateId(uint32_t id) { + char buf[16]; + size_t size; + + size = snprintf(buf, sizeof(buf), "%lu", id); + writeField(_fId, buf, size, true); +} + +void LayoutSweepComplete::updatePass(uint8_t pass) { + char buf[8]; + size_t size; + + size = snprintf(buf, sizeof(buf), "%u", pass); + writeField(_fPass, buf, size, true); +} + +void LayoutSweepComplete::updateFail(uint8_t fail) { + char buf[8]; + size_t size; + + size = snprintf(buf, sizeof(buf), "%u", fail); + writeField(_fFail, buf, size, true); +} + diff --git a/Layout/LayoutSweepComplete.h b/Layout/LayoutSweepComplete.h new file mode 100644 index 0000000..82cf008 --- /dev/null +++ b/Layout/LayoutSweepComplete.h @@ -0,0 +1,29 @@ +#ifndef __LAYOUTSWEEPCOMPLETE_H__ +#define __LAYOUTSWEEPCOMPLETE_H__ + +#include "Layout.h" + +class LayoutSweepComplete : public Layout { + public: + LayoutSweepComplete(DOGS102* lcd); + ~LayoutSweepComplete(); + + void display(); + void updateId(uint32_t id); + void updatePass(uint8_t pass); + void updateFail(uint8_t fail); + + private: + Label _lId; + Label _lInfo; + Label _lPass; + Label _lFail; + Label _lSw1; + Label _lSw2; + + Field _fId; + Field _fPass; + Field _fFail; +}; + +#endif diff --git a/Layout/LayoutSweepProgress.cpp b/Layout/LayoutSweepProgress.cpp new file mode 100644 index 0000000..9ec77cc --- /dev/null +++ b/Layout/LayoutSweepProgress.cpp @@ -0,0 +1,53 @@ +#include "LayoutSweepProgress.h" + +LayoutSweepProgress::LayoutSweepProgress(DOGS102* lcd) + : Layout(lcd), + _lSlash(8, 1, "/"), + _lMsg1(5, 2, "Sweep"), + _lMsg2(7, 3, "in"), + _lMsg3(4, 4, "Progress"), + _fComplete(6, 1, 2), + _fTotal(9, 1, 2), + _fCountdownLabel(0, 6, 17), + _fCountdown(0, 7, 9) +{} + +LayoutSweepProgress::~LayoutSweepProgress() {} + +void LayoutSweepProgress::display() { + clear(); + startUpdate(); + + writeLabel(_lSlash); + writeLabel(_lMsg1); + writeLabel(_lMsg2); + writeLabel(_lMsg3); + + endUpdate(); +} + +void LayoutSweepProgress::updateProgress(uint8_t complete, uint8_t total) { + char buf[8]; + 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); +} + +void LayoutSweepProgress::updateCountdown(uint32_t seconds) { + char buf[16]; + size_t size; + + memset(buf, 0, sizeof(buf)); + // for some reason, there's a % character that gets displayed in the last column + // add the extra spaces to wipe it out + writeField(_fCountdownLabel, "No Free Channel ", true); + size = snprintf(buf, sizeof(buf), "%lu s", seconds); + writeField(_fCountdown, buf, size, true); +} + diff --git a/Layout/LayoutSweepProgress.h b/Layout/LayoutSweepProgress.h new file mode 100644 index 0000000..82c8081 --- /dev/null +++ b/Layout/LayoutSweepProgress.h @@ -0,0 +1,28 @@ +#ifndef __LAYOUTSWEEPPROGRESS_H__ +#define __LAYOUTSWEEPPROGRESS_H__ + +#include "Layout.h" + +class LayoutSweepProgress : public Layout { + public: + LayoutSweepProgress(DOGS102* lcd); + ~LayoutSweepProgress(); + + void display(); + + void updateProgress(uint8_t complete, uint8_t total); + void updateCountdown(uint32_t seconds); + + private: + Label _lSlash; + Label _lMsg1; + Label _lMsg2; + Label _lMsg3; + + Field _fComplete; + Field _fTotal; + Field _fCountdownLabel; + Field _fCountdown; +}; + +#endif -- cgit v1.2.3