MASSIVE rework of the menu structure
This commit is contained in:
parent
a7348fdbf5
commit
d563cb0c8a
|
@ -315,7 +315,7 @@ void setup() {
|
|||
bESP32PowerUpInit = true;
|
||||
// bForceInit = false;
|
||||
}
|
||||
|
||||
|
||||
// initially, ensure the GPIO outputs are not activated during startup
|
||||
// (GPIO2 tends to be one with default chip startup)
|
||||
pinMode(GPIOout1_pin, OUTPUT);
|
||||
|
|
|
@ -365,8 +365,8 @@ CBluetoothHC05::decodeMACresponse(char* pResponse, int len)
|
|||
char* pDest = _MAC;
|
||||
char* pSrc = MACdecode;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
*pDest++ = *pSrc++;
|
||||
*pDest++ = *pSrc++;
|
||||
*pDest++ = toupper(*pSrc++);
|
||||
*pDest++ = toupper(*pSrc++);
|
||||
*pDest++ = ':';
|
||||
}
|
||||
*--pDest = 0; // step back and replace last colon with the null terminator!
|
||||
|
|
|
@ -70,16 +70,15 @@ CFuelCalScreen::show()
|
|||
if(!CPasswordScreen::show()) { // for showing "saving settings"
|
||||
|
||||
if(_rowSel == 4) {
|
||||
_printInverted(_display.xCentre(), 0, " Saving Settings ", true, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 35, "Press UP to", false, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 43, "confirm save", false, eCentreJustify);
|
||||
_showConfirmMessage();
|
||||
}
|
||||
else {
|
||||
if(_animateCount < 0) {
|
||||
_display.clearDisplay();
|
||||
_animateCount = 0;
|
||||
}
|
||||
_printInverted(_display.xCentre(), 0, " Special Features ", true, eCentreJustify);
|
||||
// _printInverted(_display.xCentre(), 0, " Special Features ", true, eCentreJustify);
|
||||
_showTitle("Special Features");
|
||||
// fuel calibration
|
||||
int yPos = Line1;
|
||||
_printMenuText(col, yPos, "mL/stroke : ", false, eRightJustify);
|
||||
|
@ -125,34 +124,34 @@ CFuelCalScreen::animate()
|
|||
if(_animateCount >= 0) {
|
||||
switch(_animateCount) {
|
||||
case 0:
|
||||
_display.fillRect(0, Line3-4, BatteryIconInfo.width, 40, BLACK);
|
||||
_display.fillRect(0, Line3-3, BatteryIconInfo.width, 40, BLACK);
|
||||
_drawBitmap(6, Line1-3, FuelIconSmallInfo);
|
||||
_drawBitmap(0, Line2-1 , BatteryIconInfo);
|
||||
_drawBitmap(5, Line3-4, miniThermoIconInfo);
|
||||
_drawBitmap(5, Line3-3, miniThermoIconInfo);
|
||||
break;
|
||||
case 2:
|
||||
_display.fillRect(6, Line1-3, FuelIconSmallInfo.width, FuelIconSmallInfo.height, BLACK); // scrub prior drip
|
||||
_drawBitmap(6, Line1-2, FuelIconSmallInfo); // drip fuel
|
||||
_display.fillRect(BatteryIconInfo.width - 4, Line2+2, 2, 5, BLACK); // deplete battery
|
||||
_display.fillRect(7, Line3+2, 2, 2, WHITE); // grow thermometer
|
||||
_display.fillRect(7, Line3+3, 2, 2, WHITE); // grow thermometer
|
||||
break;
|
||||
case 4:
|
||||
_display.fillRect(6, Line1-2, FuelIconSmallInfo.width, FuelIconSmallInfo.height, BLACK); // scrub prior drip
|
||||
_drawBitmap(6, Line1-1, FuelIconSmallInfo); // drip fuel
|
||||
_display.fillRect(BatteryIconInfo.width - 7, Line2+2, 2, 5, BLACK); // deplete battery
|
||||
_display.fillRect(7, Line3+1, 2, 1, WHITE); // grow thermometer
|
||||
_display.fillRect(7, Line3+2, 2, 1, WHITE); // grow thermometer
|
||||
break;
|
||||
case 6:
|
||||
_display.fillRect(6, Line1-1, FuelIconSmallInfo.width, FuelIconSmallInfo.height, BLACK); // scrub prior drip
|
||||
_drawBitmap(6, Line1, FuelIconSmallInfo); // drip fuel
|
||||
_display.fillRect(BatteryIconInfo.width - 10, Line2+2, 2, 5, BLACK); // deplete battery
|
||||
_display.fillRect(7, Line3, 2, 1, WHITE); // grow thermometer
|
||||
_display.fillRect(7, Line3+1, 2, 1, WHITE); // grow thermometer
|
||||
break;
|
||||
case 8:
|
||||
_display.fillRect(6, Line1, FuelIconSmallInfo.width, FuelIconSmallInfo.height, BLACK); // scrub prior drip
|
||||
_drawBitmap(6, Line1+1, FuelIconSmallInfo); // drip fuel
|
||||
_display.fillRect(BatteryIconInfo.width - 13, Line2+2, 2, 5, BLACK); // deplete battery
|
||||
_display.fillRect(7, Line3-1, 2, 1, WHITE); // grow thermometer
|
||||
_display.fillRect(7, Line3, 2, 1, WHITE); // grow thermometer
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,12 +75,10 @@ CGPIOScreen::show()
|
|||
if(!CPasswordScreen::show()) { // for showing "saving settings"
|
||||
|
||||
if(_rowSel == 4) {
|
||||
_printInverted(_display.xCentre(), 0, " Saving Settings ", true, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 35, "Press UP to", false, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 43, "confirm save", false, eCentreJustify);
|
||||
_showConfirmMessage();
|
||||
}
|
||||
else {
|
||||
_printInverted(_display.xCentre(), 0, " GPIO Settings ", true, eCentreJustify);
|
||||
_showTitle("GPIO Settings");
|
||||
_drawBitmap(10, 14, GPIOIconInfo);
|
||||
{
|
||||
const char* msgText = NULL;
|
||||
|
@ -125,48 +123,50 @@ CGPIOScreen::animate()
|
|||
{
|
||||
CPasswordScreen::animate();
|
||||
|
||||
if(_rowSel != 4) {
|
||||
int yPos = 53;
|
||||
int xPos = _display.xCentre();
|
||||
const char* pMsg = NULL;
|
||||
switch(_rowSel) {
|
||||
case 0:
|
||||
_printMenuText(xPos, yPos, " \021 \030Edit Exit \020 ", true, eCentreJustify);
|
||||
break;
|
||||
case 1:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
switch(_GPIOparams.algMode) {
|
||||
case GPIOalgNone: pMsg = " Analogue input is ignored. "; break;
|
||||
case GPIOalgHeatDemand: pMsg = " Input 1 enables reading of analogue input to set temperature. "; break;
|
||||
}
|
||||
if(pMsg)
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
if(!CPasswordScreen::_busy()) {
|
||||
if(_rowSel != 4) {
|
||||
int yPos = 53;
|
||||
int xPos = _display.xCentre();
|
||||
const char* pMsg = NULL;
|
||||
switch(_rowSel) {
|
||||
case 0:
|
||||
_printMenuText(xPos, yPos, " \021 \030Edit Exit \020 ", true, eCentreJustify);
|
||||
break;
|
||||
case 1:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
switch(_GPIOparams.algMode) {
|
||||
case GPIOalgNone: pMsg = " Analogue input is ignored. "; break;
|
||||
case GPIOalgHeatDemand: pMsg = " Input 1 enables reading of analogue input to set temperature. "; break;
|
||||
}
|
||||
if(pMsg)
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
switch(_GPIOparams.outMode) {
|
||||
case GPIOoutNone: pMsg = " Digital outputs are disabled. "; break;
|
||||
case GPIOoutStatus: pMsg = " Output1: LED status indicator. "; break;
|
||||
case GPIOoutUser: pMsg = " Output 1&2: User controlled. "; break;
|
||||
}
|
||||
if(pMsg)
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 2:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
switch(_GPIOparams.outMode) {
|
||||
case GPIOoutNone: pMsg = " Digital outputs are disabled. "; break;
|
||||
case GPIOoutStatus: pMsg = " Output1: LED status indicator. "; break;
|
||||
case GPIOoutUser: pMsg = " Output 1&2: User controlled. "; break;
|
||||
}
|
||||
if(pMsg)
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
switch(_GPIOparams.inMode) {
|
||||
case GPIOinNone: pMsg = " Digital inputs are disabled. "; break;
|
||||
case GPIOinOn1Off2: pMsg = " Input 1: Starts upon closure. Input 2: Stops upon closure. "; break;
|
||||
case GPIOinOnHold1: pMsg = " Input 1: Starts when held closed, stops when opened. Input2: Max fuel when closed, min fuel when open. "; break;
|
||||
case GPIOinOn1Off1: pMsg = " Input 1: Starts or Stops upon closure. "; break;
|
||||
}
|
||||
if(pMsg)
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 3:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
switch(_GPIOparams.inMode) {
|
||||
case GPIOinNone: pMsg = " Digital inputs are disabled. "; break;
|
||||
case GPIOinOn1Off2: pMsg = " Input 1: Starts upon closure. Input 2: Stops upon closure. "; break;
|
||||
case GPIOinOnHold1: pMsg = " Input 1: Starts when held closed, stops when opened. Input2: Max fuel when closed, min fuel when open. "; break;
|
||||
case GPIOinOn1Off1: pMsg = " Input 1: Starts or Stops upon closure. "; break;
|
||||
}
|
||||
if(pMsg)
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -243,7 +243,8 @@ CGPIOScreen::keyHandler(uint8_t event)
|
|||
if(event & key_Centre) {
|
||||
switch(_rowSel) {
|
||||
case 0:
|
||||
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop, CScreenManager::GPIOInfoUI); // force return to main menu GPIO view
|
||||
// _ScreenManager.selectMenu(CScreenManager::RootMenuLoop, CScreenManager::GPIOInfoUI); // force return to main menu GPIO view
|
||||
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop); // force return to main menu
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -346,7 +347,7 @@ CGPIOInfoScreen::show()
|
|||
_printMenuText(58, Line1, msg);
|
||||
}
|
||||
|
||||
_printMenuText(_display.xCentre(), 53, " \021 \020 ", true, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 53, " \021 \020 ", true, eCentreJustify);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,12 +77,11 @@ CHeaterSettingsScreen::show()
|
|||
if(!CPasswordScreen::show()) { // for showing "saving settings"
|
||||
|
||||
if(_rowSel == 4) {
|
||||
_printInverted(_display.xCentre(), 0, " Saving Settings ", true, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 35, "Press UP to", false, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 43, "confirm save", false, eCentreJustify);
|
||||
_showConfirmMessage();
|
||||
}
|
||||
else {
|
||||
_printInverted(_display.xCentre(), 0, " Heater Settings ", true, eCentreJustify);
|
||||
// _printInverted(_display.xCentre(), 0, " Heater Settings ", true, eCentreJustify);
|
||||
_showTitle("Heater Settings");
|
||||
_printMenuText(97, Line3, "System voltage:", false, eRightJustify);
|
||||
_printMenuText(97, Line2, "Fan sensor:", false, eRightJustify);
|
||||
_printMenuText(97, Line1, "Glowplug power:", false, eRightJustify);
|
||||
|
|
|
@ -53,12 +53,10 @@ CHomeMenuSelScreen::show()
|
|||
if(!CPasswordScreen::show()) { // for showing "saving settings"
|
||||
|
||||
if(_rowSel == 4) {
|
||||
_printInverted(_display.xCentre(), 0, " Saving Settings ", true, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 35, "Press UP to", false, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 43, "confirm save", false, eCentreJustify);
|
||||
_showConfirmMessage();
|
||||
}
|
||||
else {
|
||||
_printInverted(_display.xCentre(), 0, " Home Menu Actions ", true, eCentreJustify);
|
||||
_showTitle("Home Menu Actions");
|
||||
|
||||
_drawBitmap(30, 14, TimeoutIconInfo);
|
||||
switch(_action.onTimeout) {
|
||||
|
@ -95,31 +93,33 @@ CHomeMenuSelScreen::show()
|
|||
bool
|
||||
CHomeMenuSelScreen::animate()
|
||||
{
|
||||
if(_rowSel != 4) {
|
||||
int yPos = 53;
|
||||
int xPos = _display.xCentre();
|
||||
const char* pMsg = NULL;
|
||||
switch(_rowSel) {
|
||||
case 0:
|
||||
_printMenuText(xPos, yPos, " \021 \030Edit Exit \020 ", true, eCentreJustify);
|
||||
break;
|
||||
case 1:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " Menu to switch to when the heater stops. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 2:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " Menu to switch to when the heater starts. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 3:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " Menu to return to after no keypad activity. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
if(!CPasswordScreen::_busy()) {
|
||||
if(_rowSel != 4) {
|
||||
int yPos = 53;
|
||||
int xPos = _display.xCentre();
|
||||
const char* pMsg = NULL;
|
||||
switch(_rowSel) {
|
||||
case 0:
|
||||
_printMenuText(xPos, yPos, " \021 \030Edit Exit \020 ", true, eCentreJustify);
|
||||
break;
|
||||
case 1:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " Menu to switch to when the heater stops. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 2:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " Menu to switch to when the heater starts. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 3:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " Menu to return to after no keypad activity. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "KeyPad.h"
|
||||
#include "../Utility/helpers.h"
|
||||
#include "../Utility/HourMeter.h"
|
||||
#include "fonts/Arial.h"
|
||||
|
||||
|
||||
CHourMeterScreen::CHourMeterScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreen(display, mgr)
|
||||
|
@ -58,7 +59,7 @@ CHourMeterScreen::show()
|
|||
|
||||
// standard version information screens,
|
||||
// animation of update available via animate() if firmware update is available on web server
|
||||
_printInverted(_display.xCentre(), 0, " Hour Meters ", true, eCentreJustify);
|
||||
_showTitle("Hour Meters");
|
||||
|
||||
makeHourMeter(hrs, msg, pHourMeter->getRunTime());
|
||||
_printMenuText(38, 14, "Run", false, eRightJustify);
|
||||
|
@ -73,7 +74,8 @@ CHourMeterScreen::show()
|
|||
_printMenuText(colon, 38, hrs, false, eRightJustify);
|
||||
_printMenuText(colon, 38, msg);
|
||||
|
||||
_printMenuText(_display.xCentre(), 53, " \021 Exit \020 ", true, eCentreJustify); // " < Exit > "
|
||||
_printMenuText(_display.xCentre(), 53, " \021 \020 ", true, eCentreJustify); // " < > "
|
||||
_printMenuText(_display.xCentre(), 53, "Exit", false, eCentreJustify); // " < Exit > "
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,12 +57,10 @@ COtherOptionsScreen::show()
|
|||
if(!CPasswordScreen::show()) { // for showing "saving settings"
|
||||
|
||||
if(_rowSel == 4) {
|
||||
_printInverted(_display.xCentre(), 0, " Saving Settings ", true, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 35, "Press UP to", false, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 43, "confirm save", false, eCentreJustify);
|
||||
_showConfirmMessage();
|
||||
}
|
||||
else {
|
||||
_printInverted(_display.xCentre(), 0, " Time Intervals ", true, eCentreJustify);
|
||||
_showTitle("Time Intervals");
|
||||
|
||||
// data frame refresh rate
|
||||
_drawBitmap(15, 13, RefreshIconInfo);
|
||||
|
@ -104,31 +102,33 @@ COtherOptionsScreen::show()
|
|||
bool
|
||||
COtherOptionsScreen::animate()
|
||||
{
|
||||
if(_rowSel != 4) {
|
||||
int yPos = 53;
|
||||
int xPos = _display.xCentre();
|
||||
const char* pMsg = NULL;
|
||||
switch(_rowSel) {
|
||||
case 0:
|
||||
_printMenuText(xPos, yPos, " \021 \030Edit Exit \020 ", true, eCentreJustify);
|
||||
break;
|
||||
case 1:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " No keypad activity returns to the home menu. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 2:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " No keypad activity either dims or blanks the display. Hold Left or Right to toggle Dim/Blank mode. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 3:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " Define the polling rate of the bluewire communications. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
if(!CPasswordScreen::_busy()) {
|
||||
if(_rowSel != 4) {
|
||||
int yPos = 53;
|
||||
int xPos = _display.xCentre();
|
||||
const char* pMsg = NULL;
|
||||
switch(_rowSel) {
|
||||
case 0:
|
||||
_printMenuText(xPos, yPos, " \021 \030Edit Exit \020 ", true, eCentreJustify);
|
||||
break;
|
||||
case 1:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " No keypad activity returns to the home menu. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 2:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " No keypad activity either dims or blanks the display. Hold Left or Right to toggle Dim/Blank mode. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 3:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " Define the polling rate of the bluewire communications. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "PasswordScreen.h"
|
||||
#include "KeyPad.h"
|
||||
#include "../Utility/macros.h"
|
||||
#include "fonts/Arial.h"
|
||||
|
||||
|
||||
CPasswordScreen::CPasswordScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreenHeader(display, mgr)
|
||||
|
@ -62,13 +63,20 @@ CPasswordScreen::show()
|
|||
CPasswordScreen::animate(); // precautionary, in case derived class forgets to call
|
||||
|
||||
if(_SaveTime) {
|
||||
_printInverted(_display.xCentre(), 28, " ", true, eCentreJustify);
|
||||
_printInverted(_display.xCentre(), 39, " ", true, eCentreJustify);
|
||||
_printInverted(_display.xCentre(), 34, " STORING ", true, eCentreJustify);
|
||||
_display.clearDisplay();
|
||||
// _printInverted(_display.xCentre(), 28, " ", true, eCentreJustify);
|
||||
// _printInverted(_display.xCentre(), 39, " ", true, eCentreJustify);
|
||||
_display.writeFillRect(34, 26, 60, 26, WHITE);
|
||||
CTransientFont AF(_display, &arial_8ptBoldFontInfo);
|
||||
_printInverted(_display.xCentre(), 32, " STORING ", true, eCentreJustify);
|
||||
return true;
|
||||
}
|
||||
else if(_bGetPassword) {
|
||||
_printMenuText(_display.xCentre(), 34, "Enter password...", false, eCentreJustify);
|
||||
_display.clearDisplay();
|
||||
/* {
|
||||
CTransientFont AF(_display, &arial_8ptBoldFontInfo);
|
||||
_printMenuText(_display.xCentre(), 32, "Enter password...", false, eCentreJustify);
|
||||
}*/
|
||||
_showPassword();
|
||||
return true;
|
||||
}
|
||||
|
@ -90,6 +98,12 @@ CPasswordScreen::animate()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
CPasswordScreen::_busy()
|
||||
{
|
||||
return _SaveTime != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
CPasswordScreen::keyHandler(uint8_t event)
|
||||
{
|
||||
|
@ -147,18 +161,20 @@ bool
|
|||
CPasswordScreen::_showPassword()
|
||||
{
|
||||
if(_bGetPassword) {
|
||||
_printMenuText(_display.xCentre(), 34, "Enter password...", false, eCentreJustify);
|
||||
_showTitle("Enter password");
|
||||
|
||||
// determine metrics of character sizing
|
||||
CTransientFont AF(_display, &arialBlack_12ptFontInfo);
|
||||
|
||||
CRect extents;
|
||||
_display.getTextExtents("X", extents);
|
||||
_display.getTextExtents("8", extents);
|
||||
int charWidth = extents.width;
|
||||
_display.getTextExtents(" ", extents);
|
||||
|
||||
for(int idx =0 ; idx < 4; idx++) {
|
||||
|
||||
extents.xPos = _display.xCentre() - (2 - idx) * (charWidth * 1.5);
|
||||
extents.yPos = 50;
|
||||
extents.yPos = 30;
|
||||
|
||||
char str[8];
|
||||
|
||||
|
@ -193,3 +209,11 @@ CPasswordScreen::_showStoringMessage()
|
|||
_SaveTime = millis() + 1500;
|
||||
_ScreenManager.reqUpdate();
|
||||
}
|
||||
|
||||
void
|
||||
CPasswordScreen::_showConfirmMessage()
|
||||
{
|
||||
_showTitle("Saving Settings");
|
||||
_printMenuText(_display.xCentre(), 35, "Press UP to", false, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 43, "confirm save", false, eCentreJustify);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ protected:
|
|||
bool _isPasswordOK() { return _bPasswordOK; };
|
||||
void _showStoringMessage();
|
||||
void _initUI();
|
||||
bool _busy();
|
||||
void _showConfirmMessage();
|
||||
public:
|
||||
CPasswordScreen(C128x64_OLED& display, CScreenManager& mgr);
|
||||
void onSelect();
|
||||
|
|
|
@ -80,7 +80,8 @@ CPrimingScreen::show()
|
|||
// show next/prev menu navigation line
|
||||
switch(_paramSel) {
|
||||
case 0:
|
||||
_printMenuText(_display.xCentre(), yPos, " \021 \030Edit \020 ", _paramSel == 0, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 53, " \021 \020 ", _paramSel == 0, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), yPos, "\030Edit", false, eCentreJustify);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
|
@ -296,7 +297,7 @@ CPrimingScreen::keyHandler(uint8_t event)
|
|||
// press DOWN
|
||||
if(event & key_Down) {
|
||||
if(_paramSel == 0) {
|
||||
_ScreenManager.selectMenu(CScreenManager::UserSettingsLoop, CScreenManager::VersionUI); // force return to main menu
|
||||
_ScreenManager.selectMenu(CScreenManager::SystemSettingsLoop, CScreenManager::SysVerUI); // force return to main menu
|
||||
}
|
||||
else {
|
||||
switch(_paramSel) {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <Arduino.h>
|
||||
#include "Screen.h"
|
||||
#include "fonts/Arial.h"
|
||||
|
||||
// base class functionality for screens
|
||||
|
||||
|
@ -178,6 +179,15 @@ CScreen::_drawBitmap(int x, int y, const BITMAP_INFO& info, uint16_t colour, uin
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
CScreen::_showTitle(const char* title)
|
||||
{
|
||||
CTransientFont AF(_display, &arial_8ptBoldFontInfo);
|
||||
_printMenuText(_display.xCentre(), -2, title, false, eCentreJustify);
|
||||
_display.drawFastHLine(0, 10, 128, WHITE);
|
||||
}
|
||||
|
||||
|
||||
// a class used for temporary alternate fonts usage
|
||||
// Reverts to standard inbuilt font when the instance falls out of scope
|
||||
CTransientFont::CTransientFont(C128x64_OLED& disp, const FONT_INFO* pFont) :
|
||||
|
|
|
@ -56,6 +56,7 @@ protected:
|
|||
void _scrollMessage(int y, const char* str, int& charOffset);
|
||||
void _reqOEMWarning();
|
||||
void _drawBitmap(int x, int y, const BITMAP_INFO& info, uint16_t color = WHITE, uint16_t bg = 0xffff);
|
||||
void _showTitle(const char* title);
|
||||
public:
|
||||
CScreen(C128x64_OLED& disp, CScreenManager& mgr);
|
||||
virtual ~CScreen();
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
#include "HomeMenuSelScreen.h"
|
||||
#include "OtherOptionsScreen.h"
|
||||
#include "HourMeterScreen.h"
|
||||
#include "BTScreen.h"
|
||||
#include "MenuTrunkScreen.h"
|
||||
#include <Wire.h>
|
||||
#include "../cfg/pins.h"
|
||||
#include "../cfg/BTCConfig.h"
|
||||
|
@ -266,9 +268,9 @@ CScreenManager::begin(bool bNoClock)
|
|||
if(!bNoClock)
|
||||
menuloop.push_back(new CClockScreen(*_pDisplay, *this)); // clock
|
||||
menuloop.push_back(new CPrimingScreen(*_pDisplay, *this)); // mode / priming
|
||||
menuloop.push_back(new CWiFiScreen(*_pDisplay, *this)); // comms info
|
||||
// menuloop.push_back(new CWiFiScreen(*_pDisplay, *this)); // comms info
|
||||
menuloop.push_back(new CGPIOInfoScreen(*_pDisplay, *this)); // GPIO info
|
||||
menuloop.push_back(new CSettingsScreen(*_pDisplay, *this)); // Tuning info
|
||||
menuloop.push_back(new CMenuTrunkScreen(*_pDisplay, *this));
|
||||
_Screens.push_back(menuloop);
|
||||
|
||||
// create timer screens loop
|
||||
|
@ -299,12 +301,18 @@ CScreenManager::begin(bool bNoClock)
|
|||
|
||||
// create User Settings screens loop
|
||||
menuloop.clear();
|
||||
menuloop.push_back(new CGPIOScreen(*_pDisplay, *this)); // GPIO settings screen
|
||||
menuloop.push_back(new CThermostatModeScreen(*_pDisplay, *this)); // thermostat settings screen
|
||||
menuloop.push_back(new CVersionInfoScreen(*_pDisplay, *this)); // GPIO settings screen
|
||||
menuloop.push_back(new CHourMeterScreen(*_pDisplay, *this)); // Hour Meter screen
|
||||
menuloop.push_back(new CHomeMenuSelScreen(*_pDisplay, *this)); // Home menu settings screen
|
||||
menuloop.push_back(new COtherOptionsScreen(*_pDisplay, *this)); // Other options screen
|
||||
menuloop.push_back(new CGPIOScreen(*_pDisplay, *this)); // GPIO settings screen
|
||||
_Screens.push_back(menuloop);
|
||||
|
||||
// create System Settings screens loop
|
||||
menuloop.clear();
|
||||
menuloop.push_back(new CVersionInfoScreen(*_pDisplay, *this)); // GPIO settings screen
|
||||
menuloop.push_back(new CHourMeterScreen(*_pDisplay, *this)); // Hour Meter screen
|
||||
menuloop.push_back(new CWiFiScreen(*_pDisplay, *this));
|
||||
menuloop.push_back(new CBTScreen(*_pDisplay, *this));
|
||||
_Screens.push_back(menuloop);
|
||||
|
||||
// create branch screens
|
||||
|
@ -312,6 +320,7 @@ CScreenManager::begin(bool bNoClock)
|
|||
menuloop.push_back(new CSetClockScreen(*_pDisplay, *this)); // clock set branch screen
|
||||
menuloop.push_back(new CInheritSettingsScreen(*_pDisplay, *this)); // inherit OEM settings branch screen
|
||||
menuloop.push_back(new CFontDumpScreen(*_pDisplay, *this)); // font dump branch screen
|
||||
menuloop.push_back(new CSettingsScreen(*_pDisplay, *this)); // Tuning info
|
||||
_Screens.push_back(menuloop);
|
||||
|
||||
_menu = 0;
|
||||
|
|
|
@ -45,13 +45,14 @@ class CScreenManager {
|
|||
void _changeSubMenu(int dir);
|
||||
void _dim(bool state);
|
||||
public:
|
||||
enum eUIMenuSets { RootMenuLoop, TimerMenuLoop, TuningMenuLoop, UserSettingsLoop, BranchMenu };
|
||||
enum eUIRootMenus { DetailedControlUI, BasicControlUI, ClockUI, ModeUI, CommsUI, GPIOInfoUI, SettingsUI };
|
||||
enum eUIMenuSets { RootMenuLoop, TimerMenuLoop, TuningMenuLoop, UserSettingsLoop, SystemSettingsLoop, BranchMenu };
|
||||
enum eUIRootMenus { DetailedControlUI, BasicControlUI, ClockUI, ModeUI, /* CommsUI,*/ GPIOInfoUI, TrunkUI };
|
||||
enum eUITimerMenus { TimerOverviewUI, Timer1UI, Timer2UI, Timer3UI, Timer4UI, Timer5UI, Timer6UI, Timer7UI,
|
||||
Timer8UI, Timer9UI, Timer10UI, Timer11UI, Timer12UI, Timer13UI, Timer14UI };
|
||||
enum eUITuningMenus { MixtureUI, HeaterSettingsUI, FuelCalUI };
|
||||
enum eUIUserSettingsMenus { GPIOUI, ExThermostatUI, VersionUI, HomeMenuUI, TimeIntervalsUI };
|
||||
enum eUIBranchMenus { SetClockUI, InheritSettingsUI, FontDumpUI };
|
||||
enum eUIUserSettingsMenus { ExThermostatUI, HomeMenuUI, TimeIntervalsUI, GPIOUI };
|
||||
enum eUIBranchMenus { SetClockUI, InheritSettingsUI, FontDumpUI, HtrSettingsUI };
|
||||
enum eUISystemSettingsMenus { SysVerUI, SysHoursUI, SysWifiUI, SysBTUI };
|
||||
public:
|
||||
CScreenManager();
|
||||
~CScreenManager();
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "../Utility/helpers.h"
|
||||
#include "../Utility/macros.h"
|
||||
#include "../Protocol/Protocol.h"
|
||||
#include "fonts/Arial.h"
|
||||
|
||||
static const int Line3 = 20; // system voltage
|
||||
static const int Line2 = 30; // fan sensor
|
||||
|
@ -66,10 +67,14 @@ CSettingsScreen::show()
|
|||
{
|
||||
char str[16];
|
||||
|
||||
CScreenHeader::show(false);
|
||||
// CScreenHeader::show(false);
|
||||
//
|
||||
// _display.writeFillRect(0, 16, 84, 12, WHITE);
|
||||
// _printInverted(3, 18, "Heater Tuning", true);
|
||||
CScreen::show();
|
||||
_display.clearDisplay();
|
||||
|
||||
_display.writeFillRect(0, 16, 84, 12, WHITE);
|
||||
_printInverted(3, 18, "Heater Tuning", true);
|
||||
_showTitle("Heater Tuning");
|
||||
|
||||
if(!CPasswordScreen::show()) {
|
||||
|
||||
|
@ -77,14 +82,15 @@ CSettingsScreen::show()
|
|||
_printMenuText(_display.width(), Line3, str, false, eRightJustify);
|
||||
|
||||
sprintf(str, "Min: %.1f/%d", getHeaterInfo().getPump_Min(), getHeaterInfo().getFan_Min());
|
||||
_printMenuText(0, Line2, str);
|
||||
_printMenuText(0, Line3, str);
|
||||
|
||||
sprintf(str, "Max: %.1f/%d", getHeaterInfo().getPump_Max(), getHeaterInfo().getFan_Max());
|
||||
_printMenuText(0, Line1, str);
|
||||
_printMenuText(0, Line2, str);
|
||||
|
||||
int yPos = 53;
|
||||
int xPos = _display.xCentre();
|
||||
_printMenuText(xPos, yPos, " \021 \030Edit \031\352T \020 ", true, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 53, " ", true, eCentreJustify);
|
||||
_printMenuText(xPos, yPos, "\030Edit Exit", false, eCentreJustify);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -147,14 +153,14 @@ CSettingsScreen::keyHandler(uint8_t event)
|
|||
if(event & keyPressed) {
|
||||
// press LEFT
|
||||
if(event & key_Left) {
|
||||
_ScreenManager.prevMenu();
|
||||
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop);
|
||||
}
|
||||
// press RIGHT
|
||||
if(event & key_Right) {
|
||||
_ScreenManager.nextMenu();
|
||||
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop);
|
||||
}
|
||||
// press UP
|
||||
if(event & (key_Up | key_Centre)) {
|
||||
if(event & key_Up) {
|
||||
if(hasOEMcontroller()) {
|
||||
if(event & key_Centre)
|
||||
_reqOEMWarning();
|
||||
|
@ -166,10 +172,14 @@ CSettingsScreen::keyHandler(uint8_t event)
|
|||
_getPassword();
|
||||
}
|
||||
}
|
||||
if(event & key_Centre) {
|
||||
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop);
|
||||
}
|
||||
// press DOWN
|
||||
if(event & key_Down) {
|
||||
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop);
|
||||
// _ScreenManager.selectMenu(CScreenManager::BranchMenu, CScreenManager::ExperimentalUI);
|
||||
_ScreenManager.selectMenu(CScreenManager::UserSettingsLoop, CScreenManager::ExThermostatUI);
|
||||
// _ScreenManager.selectMenu(CScreenManager::UserSettingsLoop, CScreenManager::ExThermostatUI);
|
||||
}
|
||||
// THREE FINGER SALUTE!
|
||||
if((event & (key_Left|key_Right|key_Centre)) == (key_Left|key_Right|key_Centre)) {
|
||||
|
|
|
@ -75,12 +75,11 @@ CThermostatModeScreen::show()
|
|||
if(!CPasswordScreen::show()) { // for showing "saving settings"
|
||||
|
||||
if(_rowSel == 10) {
|
||||
_printInverted(_display.xCentre(), 0, " Saving Settings ", true, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 35, "Press UP to", false, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 43, "confirm save", false, eCentreJustify);
|
||||
_showConfirmMessage();
|
||||
}
|
||||
else {
|
||||
_printInverted(_display.xCentre(), 0, " Thermostat Mode ", true, eCentreJustify);
|
||||
_showTitle("Thermostat Mode");
|
||||
// _printInverted(_display.xCentre(), 0, " Thermostat Mode ", true, eCentreJustify);
|
||||
_drawBitmap(3, 14, ThermostatIconInfo);
|
||||
float fTemp = _window;
|
||||
if(NVstore.getUserSettings().degF) {
|
||||
|
@ -140,47 +139,49 @@ CThermostatModeScreen::show()
|
|||
bool
|
||||
CThermostatModeScreen::animate()
|
||||
{
|
||||
if(_rowSel != 10) {
|
||||
int yPos = 53;
|
||||
int xPos = _display.xCentre();
|
||||
const char* pMsg = NULL;
|
||||
switch(_rowSel) {
|
||||
case 0:
|
||||
_printMenuText(xPos, yPos, " \021 \030Edit Exit \020 ", true, eCentreJustify);
|
||||
break;
|
||||
case 1:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " Heater shuts down over set point. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 2:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " Heater restarts below setpoint. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 3:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " User defined window for custom thermostat modes. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 4:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
switch(_thermoMode) {
|
||||
case 1:
|
||||
pMsg = " The user defined window sets the thermostat's hysteresis. ";
|
||||
break;
|
||||
case 2:
|
||||
pMsg = " The pump rate is adjusted linearly across the set point window. ";
|
||||
break;
|
||||
default:
|
||||
pMsg = " Use heater's standard thermostat control. ";
|
||||
break;
|
||||
}
|
||||
if(pMsg)
|
||||
if(!CPasswordScreen::_busy()) {
|
||||
if(_rowSel != 10) {
|
||||
int yPos = 53;
|
||||
int xPos = _display.xCentre();
|
||||
const char* pMsg = NULL;
|
||||
switch(_rowSel) {
|
||||
case 0:
|
||||
_printMenuText(xPos, yPos, " \021 \030Edit Exit \020 ", true, eCentreJustify);
|
||||
break;
|
||||
case 1:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " Heater shuts down over set point. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
break;
|
||||
case 2:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " Heater restarts below setpoint. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 3:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
pMsg = " User defined window for custom thermostat modes. ";
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 4:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
switch(_thermoMode) {
|
||||
case 1:
|
||||
pMsg = " The user defined window sets the thermostat's hysteresis. ";
|
||||
break;
|
||||
case 2:
|
||||
pMsg = " The pump rate is adjusted linearly across the set point window. ";
|
||||
break;
|
||||
default:
|
||||
pMsg = " Use heater's standard thermostat control. ";
|
||||
break;
|
||||
}
|
||||
if(pMsg)
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -235,6 +236,9 @@ CThermostatModeScreen::keyHandler(uint8_t event)
|
|||
_rowSel--;
|
||||
LOWERLIMIT(_rowSel, 0);
|
||||
}
|
||||
else {
|
||||
_ScreenManager.selectMenu(CScreenManager::SystemSettingsLoop, CScreenManager::SysVerUI);
|
||||
}
|
||||
}
|
||||
// UP press
|
||||
if(event & key_Up) {
|
||||
|
@ -265,7 +269,8 @@ CThermostatModeScreen::keyHandler(uint8_t event)
|
|||
if(event & key_Centre) {
|
||||
switch(_rowSel) {
|
||||
case 0:
|
||||
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop, CScreenManager::SettingsUI); // force return to main menu
|
||||
// _ScreenManager.selectMenu(CScreenManager::RootMenuLoop, CScreenManager::SettingsUI); // force return to main menu
|
||||
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop); // force return to main menu
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
|
|
|
@ -80,11 +80,11 @@ CVersionInfoScreen::show()
|
|||
if(_rowSel < 2) {
|
||||
// standard version information screens,
|
||||
// animation of update available via animate() if firmware update is available on web server
|
||||
_printInverted(_display.xCentre(), 0, " Version Information ", true, eCentreJustify);
|
||||
_showTitle("Version Information");
|
||||
|
||||
_drawBitmap(13, 11, FirmwareIconInfo);
|
||||
_printMenuText(46, 14, getVersionStr());
|
||||
_printMenuText(46, 25, getVersionDate());
|
||||
_drawBitmap(13, 12, FirmwareIconInfo);
|
||||
_printMenuText(46, 15, getVersionStr());
|
||||
_printMenuText(46, 26, getVersionDate());
|
||||
|
||||
_drawBitmap(23, 34, HardwareIconInfo);
|
||||
int PCB = getBoardRevision();
|
||||
|
@ -95,12 +95,13 @@ CVersionInfoScreen::show()
|
|||
_display.drawLine(88, 42, 127, 42, WHITE);
|
||||
}
|
||||
|
||||
_printMenuText(_display.xCentre(), 53, " \021 \020 ", true, eCentreJustify);
|
||||
if(_rowSel == 1 && isUpdateAvailable()) {
|
||||
// prompt 'Get Update' for new firmware available and first UP press from home
|
||||
_printMenuText(_display.xCentre(), 53, " \021 Get Update \020 ", true, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 53, "Get Update", false, eCentreJustify);
|
||||
}
|
||||
else {
|
||||
_printMenuText(_display.xCentre(), 53, " \021 Exit \020 ", true, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 53, "Exit", false, eCentreJustify);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "../Utility/helpers.h"
|
||||
#include "../WiFi/BTCWifi.h"
|
||||
#include "../Utility/NVStorage.h"
|
||||
#include "fonts/Arial.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -40,7 +41,7 @@ static const int LIMIT_AWAY = 0;
|
|||
static const int LIMIT_LEFT = 1;
|
||||
static const int LIMIT_RIGHT = 2;
|
||||
|
||||
CWiFiScreen::CWiFiScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreenHeader(display, mgr)
|
||||
CWiFiScreen::CWiFiScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreen(display, mgr)
|
||||
{
|
||||
_initUI();
|
||||
}
|
||||
|
@ -48,7 +49,7 @@ CWiFiScreen::CWiFiScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreenHe
|
|||
void
|
||||
CWiFiScreen::onSelect()
|
||||
{
|
||||
CScreenHeader::onSelect();
|
||||
CScreen::onSelect();
|
||||
_initUI();
|
||||
}
|
||||
|
||||
|
@ -58,28 +59,23 @@ CWiFiScreen::_initUI()
|
|||
_rowSel = 0;
|
||||
_colSel = 0;
|
||||
_OTAsel = NVstore.getUserSettings().enableOTA;
|
||||
_colLimit = LIMIT_LEFT; // left most selection
|
||||
_bShowMAC = false;
|
||||
|
||||
if(NVstore.getUserSettings().enableWifi) {
|
||||
if(isWifiAP()) {
|
||||
if(isWifiConfigPortal()) {
|
||||
_colSel = 1; // " WiFi: CFG AP only "
|
||||
_colLimit = LIMIT_AWAY; // inner selection
|
||||
}
|
||||
else {
|
||||
_colSel = 2; // " WiFi: AP only ";
|
||||
_colLimit = LIMIT_RIGHT; // right most selection
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(isWifiConfigPortal()) {
|
||||
_colSel = 3; // " WiFi: CFG STA+AP "
|
||||
_colLimit = LIMIT_AWAY; // away from menu limits
|
||||
}
|
||||
else {
|
||||
_colSel = 4; // " WiFi: STA+AP ";
|
||||
_colLimit = LIMIT_RIGHT; // right most selection
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,39 +84,38 @@ CWiFiScreen::_initUI()
|
|||
bool
|
||||
CWiFiScreen::show()
|
||||
{
|
||||
CScreenHeader::show(false);
|
||||
// CScreenHeader::show(false);
|
||||
CScreen::show();
|
||||
|
||||
_display.clearDisplay();
|
||||
_showTitle("WiFi settings");
|
||||
|
||||
int yPos = 18;
|
||||
|
||||
const char* pTitle = NULL;
|
||||
switch(_colSel) {
|
||||
case 0:
|
||||
pTitle = " WiFi: DISABLED ";
|
||||
pTitle = "DISABLED";
|
||||
break;
|
||||
case 1:
|
||||
pTitle = " WiFi: CFG AP only ";
|
||||
pTitle = "CFG AP only";
|
||||
break;
|
||||
case 2:
|
||||
pTitle = " WiFi: AP only ";
|
||||
pTitle = "AP only";
|
||||
break;
|
||||
case 3:
|
||||
pTitle = " WiFi: CFG STA+AP ";
|
||||
pTitle = "CFG STA+AP";
|
||||
break;
|
||||
case 4:
|
||||
pTitle = " WiFi: STA+AP ";
|
||||
pTitle = "STA+AP";
|
||||
break;
|
||||
}
|
||||
|
||||
if(_rowSel == 0)
|
||||
_printInverted(3, yPos, pTitle, true); // inverted title bar
|
||||
if(_rowSel == 1)
|
||||
_printMenuText(3, yPos, pTitle, true); // selection box
|
||||
if(_rowSel == 2) {
|
||||
if(_OTAsel == 0)
|
||||
_printMenuText(3, yPos, " OTA: DISABLED ", true); // selection box
|
||||
else
|
||||
_printMenuText(3, yPos, " OTA: ENABLED ", true); // selection box
|
||||
}
|
||||
_printMenuText(border, yPos, pTitle, _rowSel==1); // selection box
|
||||
if(_OTAsel == 0)
|
||||
_printMenuText(128-border, yPos, "OTA: OFF", _rowSel==2, eRightJustify); // selection box
|
||||
else
|
||||
_printMenuText(128-border, yPos, "OTA: ON ", _rowSel==2, eRightJustify); // selection box
|
||||
yPos += 3;
|
||||
|
||||
if(_colSel) {
|
||||
|
@ -150,44 +145,30 @@ CWiFiScreen::animate()
|
|||
{
|
||||
// show next/prev menu navigation line
|
||||
if(_rowSel == 0) {
|
||||
_printMenuText(_display.xCentre(), 53, " \021 \020 ", true, eCentreJustify);
|
||||
if(_bShowMAC)
|
||||
_printMenuText(_display.xCentre(), 53, "\030Sel \031IP", false, eCentreJustify);
|
||||
else
|
||||
_printMenuText(_display.xCentre(), 53, "\030Sel \031MAC", false, eCentreJustify);
|
||||
// _printMenuText(_display.xCentre(), 53, " ", true, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 53, "\021 \020", true, eCentreJustify);
|
||||
if(_bShowMAC) {
|
||||
_printMenuText(_display.xCentre(), 53, "\030Mode \031IP", false, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 53, " Exit", false, eCentreJustify);
|
||||
}
|
||||
else {
|
||||
_printMenuText(_display.xCentre(), 53, "\030Mode \031MAC", false, eCentreJustify);
|
||||
_printMenuText(_display.xCentre(), 53, " Exit", false, eCentreJustify);
|
||||
}
|
||||
}
|
||||
if(_rowSel == 1) {
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
const char* pMsg = NULL;
|
||||
switch(_colLimit) {
|
||||
case LIMIT_AWAY:
|
||||
pMsg = "\031 ESC Set \033\032 Sel"; // both Sel arrows
|
||||
break;
|
||||
case LIMIT_LEFT:
|
||||
pMsg = "\031 ESC Set \032 Sel"; // only right Sel arrow
|
||||
break;
|
||||
case LIMIT_RIGHT:
|
||||
pMsg = "\031 ESC Set \033 Sel"; // only left Sel arrow
|
||||
break;
|
||||
}
|
||||
if(pMsg)
|
||||
_printMenuText(_display.xCentre(), 56, pMsg, false, eCentreJustify);
|
||||
pMsg = "\031ESC \030OTA Set \033\032Adj"; // both Sel arrows
|
||||
_printMenuText(_display.xCentre(), 56, pMsg, false, eCentreJustify);
|
||||
}
|
||||
if(_rowSel == 2) {
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
const char* pMsg = NULL;
|
||||
switch(_OTAsel) {
|
||||
case 0:
|
||||
pMsg = "\031 ESC Set \032 Enable"; // only right Sel arrow
|
||||
break;
|
||||
case 1:
|
||||
pMsg = "\031 ESC Set \033 Disable"; // only left Sel arrow
|
||||
break;
|
||||
}
|
||||
if(pMsg)
|
||||
_printMenuText(_display.xCentre(), 56, pMsg, false, eCentreJustify);
|
||||
pMsg = "\031Mode Set \033\032Adj";
|
||||
_printMenuText(_display.xCentre(), 56, pMsg, false, eCentreJustify);
|
||||
}
|
||||
CScreenHeader::animate();
|
||||
CScreen::animate();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -196,9 +177,6 @@ CWiFiScreen::keyHandler(uint8_t event)
|
|||
{
|
||||
if(event & keyPressed) {
|
||||
_repeatCount = 0;
|
||||
// press CENTRE
|
||||
if(event & key_Centre) {
|
||||
}
|
||||
// press LEFT
|
||||
if(event & key_Left) {
|
||||
switch(_rowSel) {
|
||||
|
@ -207,20 +185,17 @@ CWiFiScreen::keyHandler(uint8_t event)
|
|||
break;
|
||||
case 1:
|
||||
if(isWifiAP()) {
|
||||
// _colSel = 0;
|
||||
// _colLimit = LIMIT_LEFT;
|
||||
_colSel--;
|
||||
LOWERLIMIT(_colSel, 0);
|
||||
_colLimit = (_colSel == 0) ? LIMIT_LEFT : LIMIT_AWAY;
|
||||
WRAPLOWERLIMIT(_colSel, 0, 2);
|
||||
}
|
||||
else {
|
||||
_colSel--;
|
||||
LOWERLIMIT(_colSel, 0);
|
||||
_colLimit = (_colSel == 0) ? LIMIT_LEFT : LIMIT_AWAY;
|
||||
WRAPLOWERLIMIT(_colSel, 0, 4);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
_OTAsel = 0;
|
||||
_OTAsel--;
|
||||
WRAPLOWERLIMIT(_OTAsel, 0, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -232,22 +207,17 @@ CWiFiScreen::keyHandler(uint8_t event)
|
|||
break;
|
||||
case 1:
|
||||
if(isWifiAP()) {
|
||||
// _colSel = 1;
|
||||
// _colLimit = LIMIT_RIGHT;
|
||||
_colSel++;
|
||||
UPPERLIMIT(_colSel, 2);
|
||||
_colLimit = (_colSel == 3) ? LIMIT_RIGHT : LIMIT_AWAY;
|
||||
WRAPUPPERLIMIT(_colSel, 2, 0);
|
||||
}
|
||||
else {
|
||||
_colSel++;
|
||||
UPPERLIMIT(_colSel, 4);
|
||||
_colLimit = (_colSel == 4) ? LIMIT_RIGHT : LIMIT_AWAY;
|
||||
// UPPERLIMIT(_colSel, 3);
|
||||
// _colLimit = (_colSel == 3) ? LIMIT_RIGHT : LIMIT_AWAY;
|
||||
WRAPUPPERLIMIT(_colSel, 4, 0);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
_OTAsel = 1;
|
||||
_OTAsel++;
|
||||
WRAPUPPERLIMIT(_OTAsel, 1, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -275,6 +245,9 @@ CWiFiScreen::keyHandler(uint8_t event)
|
|||
|
||||
if(event & keyReleased) {
|
||||
if(event & key_Centre) {
|
||||
if(_rowSel == 0) {
|
||||
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop); // force return to main menu
|
||||
}
|
||||
if(_rowSel == 1) {
|
||||
|
||||
switch(_colSel) {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
class C128x64_OLED;
|
||||
class CScreenManager;
|
||||
|
||||
class CWiFiScreen : public CScreenHeader {
|
||||
class CWiFiScreen : public CScreen {
|
||||
public:
|
||||
CWiFiScreen(C128x64_OLED& display, CScreenManager& mgr);
|
||||
void onSelect();
|
||||
|
@ -36,7 +36,6 @@ public:
|
|||
bool animate();
|
||||
bool keyHandler(uint8_t event);
|
||||
private:
|
||||
int _colLimit;
|
||||
int _rowSel, _colSel, _OTAsel;
|
||||
int _repeatCount;
|
||||
bool _bShowMAC;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -10,3 +10,18 @@ extern const uint8_t PROGMEM arial_7ptBitmaps [];
|
|||
extern const FONT_INFO arial_7ptFontInfo;
|
||||
extern const FONT_CHAR_INFO PROGMEM arial_7ptDescriptors[];
|
||||
|
||||
// Font data for Arial 8pt Bold
|
||||
extern const uint8_t PROGMEM arial_8ptBoldBitmaps [];
|
||||
extern const FONT_INFO arial_8ptBoldFontInfo;
|
||||
extern const FONT_CHAR_INFO PROGMEM arial_8ptBoldDescriptors[];
|
||||
|
||||
// Font data for Arial 12pt
|
||||
extern const uint8_t PROGMEM arial_12ptBitmaps [];
|
||||
extern const FONT_INFO arial_12ptFontInfo;
|
||||
extern const FONT_CHAR_INFO PROGMEM arial_12ptDescriptors[];
|
||||
|
||||
// Font data for Arial Black 12pt
|
||||
extern const uint8_t PROGMEM arialBlack_12ptBitmaps [];
|
||||
extern const FONT_INFO arialBlack_12ptFontInfo;
|
||||
extern const FONT_CHAR_INFO PROGMEM arialBlack_12ptDescriptors[];
|
||||
|
||||
|
|
|
@ -76,6 +76,10 @@ CTimerManager::createMap(sTimer& timer, uint16_t* pTimerMap, uint16_t* pTimerIDs
|
|||
{
|
||||
int timerBit = 0x0001 << timer.timerID;
|
||||
|
||||
const BTCDateTime tNow = Clock.get();
|
||||
int todayDoW = 1 << tNow.dayOfTheWeek();
|
||||
int todayTime = tNow.hour() * 60 + tNow.minute();
|
||||
|
||||
if(timer.enabled) {
|
||||
// create linear minute of day values for start & stop
|
||||
// note that if stop < start, that is treated as a timer that rolls over midnight
|
||||
|
@ -91,6 +95,11 @@ CTimerManager::createMap(sTimer& timer, uint16_t* pTimerMap, uint16_t* pTimerIDs
|
|||
// flag timers that should get cancelled
|
||||
activeday |= (activeday << 8); // combine one shot status in MS byte
|
||||
}
|
||||
if(timer.enabled == 0x80 && !timer.repeat) { // on-shot next occurrence timer
|
||||
if(todayTime > timestart) {
|
||||
}
|
||||
}
|
||||
|
||||
if(timestop > timestart) {
|
||||
// treat normal start < stop times (within same day)
|
||||
if((dayMinute >= timestart) && (dayMinute < timestop)) {
|
||||
|
|
|
@ -26,17 +26,28 @@
|
|||
#include "../Protocol/Protocol.h"
|
||||
#include "../Utility/NVStorage.h"
|
||||
|
||||
#define DEBUG_HOURMETER
|
||||
|
||||
|
||||
void
|
||||
CHourMeter::init(bool poweron)
|
||||
{
|
||||
if(!INBOUNDS(RunTime.get(), 0, RTC_storageInterval)) {
|
||||
DebugPort.printf("CHourMeter::Init - resetting rogue run value %d\r\n", RunTime.get());
|
||||
RunTime.reset();
|
||||
}
|
||||
if(!INBOUNDS(GlowTime.get(), 0, RTC_storageInterval)) {
|
||||
DebugPort.printf("CHourMeter::Init - resetting rogue glow value %d\r\n", GlowTime.get());
|
||||
GlowTime.reset();
|
||||
}
|
||||
|
||||
// power on reset or OTA update - cannot trust persistent values - they are likely un-initialised
|
||||
if(poweron) {
|
||||
RunTime.reset();
|
||||
GlowTime.reset();
|
||||
}
|
||||
// if there is a remnant time held, add it to the real NV stored value
|
||||
|
||||
// after all that, if there is a remnant time held, add it to the real NV stored value
|
||||
if(RunTime.get() || GlowTime.get() || RTC_Store.getRunTime() || RTC_Store.getGlowTime()) {
|
||||
store();
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
GlowTime(glowtime)
|
||||
{
|
||||
#ifdef DEBUG_HOURMETER
|
||||
DebugPort.printf("CHourMeter %d %d\r\n", RunTime.get(), GlowTime.get());
|
||||
DebugPort.printf("CHourMeter::CHourMeter %d %d\r\n", RunTime.get(), GlowTime.get());
|
||||
#endif
|
||||
};
|
||||
void init(bool poweron);
|
||||
|
|
Loading…
Reference in a new issue