From a683f4689264f85953c246ac15492bad25974197 Mon Sep 17 00:00:00 2001 From: Mike Fiore Date: Thu, 19 Nov 2015 09:16:44 -0600 Subject: use a single layout for help screens as they're basically all the same, misc tweaks and fixes --- Layout/LayoutDemoHelp.cpp | 28 ---------------------------- Layout/LayoutDemoHelp.h | 22 ---------------------- Layout/LayoutHelp.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ Layout/LayoutHelp.h | 28 ++++++++++++++++++++++++++++ Layout/LayoutJoin.cpp | 2 +- 5 files changed, 69 insertions(+), 51 deletions(-) delete mode 100644 Layout/LayoutDemoHelp.cpp delete mode 100644 Layout/LayoutDemoHelp.h create mode 100644 Layout/LayoutHelp.cpp create mode 100644 Layout/LayoutHelp.h (limited to 'Layout') diff --git a/Layout/LayoutDemoHelp.cpp b/Layout/LayoutDemoHelp.cpp deleted file mode 100644 index dab907e..0000000 --- a/Layout/LayoutDemoHelp.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "LayoutDemoHelp.h" - -LayoutDemoHelp::LayoutDemoHelp(DOGS102* lcd) - : Layout(lcd), - _lMode(0, 0, "LoRa Demo"), - _lDesc(0, 1, "Select TX Method"), - _lIns1(0, 4, "Hold SW1 any time"), - _lIns2(0, 5, "for Main Menu"), - _lSw1(10, 7, "Trigger"), - _lSw2(0, 7, "Interval") -{} - -LayoutDemoHelp::~LayoutDemoHelp() {} - -void LayoutDemoHelp::display() { - clear(); - startUpdate(); - - writeLabel(_lMode); - writeLabel(_lDesc); - writeLabel(_lIns1); - writeLabel(_lIns2); - writeLabel(_lSw1); - writeLabel(_lSw2); - - endUpdate(); -} - diff --git a/Layout/LayoutDemoHelp.h b/Layout/LayoutDemoHelp.h deleted file mode 100644 index 3e20df9..0000000 --- a/Layout/LayoutDemoHelp.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __LAYOUTDEMOHELP_H__ -#define __LAYOUTDEMOHELP_H__ - -#include "Layout.h" - -class LayoutDemoHelp : public Layout { - public: - LayoutDemoHelp(DOGS102* lcd); - ~LayoutDemoHelp(); - - void display(); - - private: - Label _lMode; - Label _lDesc; - Label _lIns1; - Label _lIns2; - Label _lSw1; - Label _lSw2; -}; - -#endif diff --git a/Layout/LayoutHelp.cpp b/Layout/LayoutHelp.cpp new file mode 100644 index 0000000..0e029de --- /dev/null +++ b/Layout/LayoutHelp.cpp @@ -0,0 +1,40 @@ +#include "LayoutHelp.h" + +LayoutHelp::LayoutHelp(DOGS102* lcd) + : Layout(lcd), + _lIns1(0, 4, "Hold SW1 any time"), + _lIns2(0, 5, "for Main Menu"), + _fMode(0, 0, 17), + _fDesc(0, 1, 17), + _fSw1(9, 7, 8), + _fSw2(0, 7, 8) +{} + +LayoutHelp::~LayoutHelp() {} + +void LayoutHelp::display() { + clear(); + startUpdate(); + + writeLabel(_lIns1); + writeLabel(_lIns2); + + endUpdate(); +} + +void LayoutHelp::updateMode(std::string mode) { + writeField(_fMode, mode); +} + +void LayoutHelp::updateDescription(std::string description) { + writeField(_fDesc, description); +} + +void LayoutHelp::updateSw1(std::string s) { + writeField(_fSw1, s); +} + +void LayoutHelp::updateSw2(std::string s) { + writeField(_fSw2, s); +} + diff --git a/Layout/LayoutHelp.h b/Layout/LayoutHelp.h new file mode 100644 index 0000000..58ddf7c --- /dev/null +++ b/Layout/LayoutHelp.h @@ -0,0 +1,28 @@ +#ifndef __LAYOUTHELP_H__ +#define __LAYOUTHELP_H__ + +#include "Layout.h" + +class LayoutHelp : public Layout { + public: + LayoutHelp(DOGS102* lcd); + ~LayoutHelp(); + + void display(); + void updateMode(std::string mode); + void updateDescription(std::string description); + void updateSw1(std::string s); + void updateSw2(std::string s); + + private: + Label _lIns1; + Label _lIns2; + + Field _fMode; + Field _fDesc; + Field _fSw1; + Field _fSw2; + +}; + +#endif diff --git a/Layout/LayoutJoin.cpp b/Layout/LayoutJoin.cpp index 3b67c28..6a2e3be 100644 --- a/Layout/LayoutJoin.cpp +++ b/Layout/LayoutJoin.cpp @@ -85,7 +85,7 @@ void LayoutJoin::updateCountdown(uint32_t seconds) { char buf[16]; size_t size; - writeField(_fCountdownLabel, "No Free Channel"); + writeField(_fCountdownLabel, "No Free Channel", true); size = snprintf(buf, sizeof(buf), "%lu", seconds); writeField(_fPower, buf, size, true); } -- cgit v1.2.3