Added external thermostat time function to GPIO setup screen

This commit is contained in:
Ray Jones 2019-08-26 08:41:44 +10:00
parent e7bac339b5
commit 7853102a4d
8 changed files with 341 additions and 265 deletions

204
src/OLED/GPIOInfoScreen.cpp Normal file
View file

@ -0,0 +1,204 @@
/*
* This file is part of the "bluetoothheater" distribution
* (https://gitlab.com/mrjones.id.au/bluetoothheater)
*
* Copyright (C) 2018 Ray Jones <ray@mrjones.id.au>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "128x64OLED.h"
#include "GPIOInfoScreen.h"
#include "KeyPad.h"
#include "../Utility/NVStorage.h"
#include "../Utility/BTC_GPIO.h"
#include "fonts/Icons.h"
#include "../Utility/BoardDetect.h"
extern CGPIOout GPIOout;
extern CGPIOin GPIOin;
extern CGPIOalg GPIOalg;
static const int Line3 = 14;
static const int Line2 = 27;
static const int Line1 = 40;
static const int Column1 = 19;
static const int Column2 = 83;
CGPIOInfoScreen::CGPIOInfoScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreen(display, mgr)
{
_keyRepeatCount = -1;
}
void
CGPIOInfoScreen::_initUI()
{
}
bool
CGPIOInfoScreen::animate()
{
char msg[16];
_display.clearDisplay();
_showTitle("GPIO status");
_drawBitmap(0, 14, InputIconInfo);
_drawBitmap(11, 14, _1IconInfo);
_drawBitmap(0, 27, InputIconInfo);
_drawBitmap(11, 27, _2IconInfo);
_drawBitmap(75, 14, OutputIconInfo);
_drawBitmap(86, 14, _1IconInfo);
_drawBitmap(75, 27, OutputIconInfo);
_drawBitmap(86, 27, _2IconInfo);
if(getBoardRevision() == BRD_V2_FULLGPIO || getBoardRevision() == BRD_V1_FULLGPIO)
_printMenuText(0, Line1, "Analogue:", false, eRightJustify);
switch(NVstore.getUserSettings().GPIO.in1Mode) {
case CGPIOin1::Disabled:
_drawBitmap(23, 14, CrossLgIconInfo);
break;
case CGPIOin1::Start:
_drawBitmap(23, 14, StartIconInfo);
break;
case CGPIOin1::Run:
_drawBitmap(23, 14, RunIconInfo);
break;
case CGPIOin1::StartStop:
_drawBitmap(23, 14, StartIconInfo);
_drawBitmap(30, 14, StopIconInfo);
break;
}
_drawBitmap(40, 16, GPIOin.getState(0) ? CloseIconInfo : OpenIconInfo);
switch(NVstore.getUserSettings().GPIO.in2Mode) {
case CGPIOin2::Disabled:
_drawBitmap(23, 27, CrossLgIconInfo);
break;
case CGPIOin2::Stop:
_drawBitmap(23, 27, StopIconInfo);
break;
case CGPIOin2::Thermostat:
_printMenuText(23, 27, "\352T");
break;
}
_drawBitmap(40, 28, GPIOin.getState(1) ? CloseIconInfo : OpenIconInfo);
int bulbmode = GPIOout.getState(0);
static bool iconstate = false;
switch(NVstore.getUserSettings().GPIO.out1Mode) {
case CGPIOout1::Disabled:
_drawBitmap(99, 14, CrossLgIconInfo);
break;
case CGPIOout1::Status:
_drawBitmap(99, 14, InfoIconInfo);
if(iconstate && bulbmode == 2) // animate bulb icon when status is PWM mode
_drawBitmap(110, 13, BulbOn2IconInfo);
else
_drawBitmap(110, 13, bulbmode ? BulbOnIconInfo : BulbOffIconInfo);
iconstate = !iconstate;
break;
case CGPIOout1::User:
_drawBitmap(99, 15, UserIconInfo);
_drawBitmap(110, 13, bulbmode ? BulbOnIconInfo : BulbOffIconInfo);
break;
}
switch(NVstore.getUserSettings().GPIO.out2Mode) {
case CGPIOout2::Disabled: _drawBitmap(99, 27, CrossLgIconInfo); break;
case CGPIOout2::User:
_drawBitmap(99, 27, UserIconInfo);
_drawBitmap(110, 26, GPIOout.getState(1) ? BulbOnIconInfo : BulbOffIconInfo);
break;
}
if(getBoardRevision() == BRD_V2_FULLGPIO || getBoardRevision() == BRD_V1_FULLGPIO) {
_drawBitmap(0, Line1-1, algIconInfo);
if(NVstore.getUserSettings().GPIO.algMode == CGPIOalg::Disabled) {
_drawBitmap(23, Line1, CrossLgIconInfo);
}
else {
sprintf(msg, "%d%%", GPIOalg.getValue() * 100 / 4096);
_printMenuText(23, Line1, msg);
}
}
_printMenuText(_display.xCentre(), 53, " \021 \020 ", true, eCentreJustify);
return true;
}
bool
CGPIOInfoScreen::show()
{
return false;// CScreenHeader::show(false);
}
bool
CGPIOInfoScreen::keyHandler(uint8_t event)
{
if(event & keyPressed) {
_keyRepeatCount = 0; // unlock tracking of repeat events
// UP press
if(event & key_Up) {
}
// CENTRE press
if(event & key_Centre) {
}
if(event & key_Down) {
_ScreenManager.selectMenu(CScreenManager::UserSettingsLoop, CScreenManager::GPIOUI);
}
}
if(event & keyRepeat) {
if(_keyRepeatCount >= 0) {
_keyRepeatCount++;
// hold LEFT to toggle GPIO output #1
if(event & key_Left) {
if(_keyRepeatCount > 2) {
_keyRepeatCount = -1; // prevent double handling
toggleGPIOout(0); // toggle GPIO output #1
}
}
// hold RIGHT to toggle GPIO output #2
if(event & key_Right) {
if(_keyRepeatCount > 2) {
_keyRepeatCount = -1; // prevent double handling
toggleGPIOout(1); // toggle GPIO output #2
}
}
}
}
// release event
if(event & keyReleased) {
if(_keyRepeatCount == 0) { // short Up press - lower target
// press LEFT to select previous screen
if(event & key_Left) {
_ScreenManager.prevMenu();
}
// press RIGHT to select next screen
if(event & key_Right) {
_ScreenManager.nextMenu();
}
}
_keyRepeatCount = -1;
}
_ScreenManager.reqUpdate();
return true;
}

43
src/OLED/GPIOInfoScreen.h Normal file
View file

@ -0,0 +1,43 @@
/*
* This file is part of the "bluetoothheater" distribution
* (https://gitlab.com/mrjones.id.au/bluetoothheater)
*
* Copyright (C) 2018 Ray Jones <ray@mrjones.id.au>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifndef __GPIOINFOSCREEN_H__
#define __GPIOINFOSCREEN_H__
#include <stdint.h>
#include "PasswordScreen.h"
#include "../Utility/BTC_GPIO.h"
class C128x64_OLED;
class CScreenManager;
class CGPIOInfoScreen : public CScreen
{
int _keyRepeatCount;
void _initUI();
public:
CGPIOInfoScreen(C128x64_OLED& display, CScreenManager& mgr);
bool show();
bool animate();
bool keyHandler(uint8_t event);
};
#endif

View file

@ -20,7 +20,7 @@
*/
#include "128x64OLED.h"
#include "GPIOScreen.h"
#include "GPIOSetupScreen.h"
#include "KeyPad.h"
#include "../Utility/NVStorage.h"
#include "../Utility/BTC_GPIO.h"
@ -43,7 +43,7 @@ static const int Line3 = 14;
static const int Line2 = 27;
static const int Line1 = 40;
static const int Column1 = 19;
static const int Column2 = 83;
static const int Column2 = 88;
CGPIOSetupScreen::CGPIOSetupScreen(C128x64_OLED& display, CScreenManager& mgr) : CPasswordScreen(display, mgr)
{
@ -53,6 +53,7 @@ CGPIOSetupScreen::CGPIOSetupScreen(C128x64_OLED& display, CScreenManager& mgr) :
_GPIOparams.out1Mode = CGPIOout1::Disabled;
_GPIOparams.out2Mode = CGPIOout2::Disabled;
_GPIOparams.algMode = CGPIOalg::Disabled;
_ExtHold = 0;
}
void
@ -61,6 +62,7 @@ CGPIOSetupScreen::onSelect()
CPasswordScreen::onSelect();
_initUI();
_GPIOparams = NVstore.getUserSettings().GPIO;
_ExtHold = NVstore.getUserSettings().ExtThermoTimeout;
}
void
@ -96,7 +98,7 @@ CGPIOSetupScreen::show()
case CGPIOin1::StartStop: msgText = animated ? "Start" : "Stop "; break;
}
if(msgText)
_printMenuText(Column1, Line3, msgText, _rowSel == 3);
_printMenuText(Column1, Line3, msgText, _rowSel == 4);
}
_drawBitmap(0, Line2, InputIconInfo);
_drawBitmap(11, Line2, _2IconInfo);
@ -105,34 +107,50 @@ CGPIOSetupScreen::show()
switch(_GPIOparams.in2Mode) {
case CGPIOin2::Disabled: msgText = " --- "; break;
case CGPIOin2::Stop: msgText = "Stop "; break;
case CGPIOin2::Thermostat: msgText = "\352T "; break;
case CGPIOin2::Thermostat: msgText = "\352T"; break;
}
if(msgText)
_printMenuText(Column1, Line2, msgText, _rowSel == 2);
if(_GPIOparams.in2Mode == CGPIOin2::Thermostat) {
const char* modeStr = "---";
switch(_ExtHold) {
// case 0: modeStr = "Psv"; break;
case 60000: modeStr = "1m"; break;
case 120000: modeStr = "2m"; break;
case 300000: modeStr = "5m"; break;
case 600000: modeStr = "10m"; break;
case 900000: modeStr = "15m"; break;
case 1200000: modeStr = "20m"; break;
case 1800000: modeStr = "30m"; break;
case 3600000: modeStr = "1hr"; break;
}
_printMenuText(Column1 + 18, Line2, modeStr, _rowSel == 3);
}
}
_drawBitmap(65, Line3, OutputIconInfo);
_drawBitmap(75, Line3, _1IconInfo);
_drawBitmap(70, Line3, OutputIconInfo);
_drawBitmap(80, Line3, _1IconInfo);
{
const char* msgText = NULL;
switch(_GPIOparams.out1Mode) {
case CGPIOout1::Disabled: msgText = " --- "; break;
case CGPIOout1::Disabled: msgText = "---"; break;
case CGPIOout1::Status: msgText = "Status"; break;
case CGPIOout1::User: msgText = "User "; break;
case CGPIOout1::User: msgText = "User"; break;
}
if(msgText)
_printMenuText(Column2, Line3, msgText, _rowSel == 5);
_printMenuText(Column2, Line3, msgText, _rowSel == 6);
}
_drawBitmap(65, Line2, OutputIconInfo);
_drawBitmap(75, Line2, _2IconInfo);
_drawBitmap(70, Line2, OutputIconInfo);
_drawBitmap(80, Line2, _2IconInfo);
{
const char* msgText = NULL;
switch(_GPIOparams.out2Mode) {
case CGPIOout2::Disabled: msgText = " --- "; break;
case CGPIOout2::User: msgText = "User "; break;
case CGPIOout2::Disabled: msgText = "---"; break;
case CGPIOout2::User: msgText = "User"; break;
}
if(msgText)
_printMenuText(Column2, Line2, msgText, _rowSel == 4);
_printMenuText(Column2, Line2, msgText, _rowSel == 5);
}
if(getBoardRevision() == BRD_V2_FULLGPIO || getBoardRevision() == BRD_V1_FULLGPIO) {
@ -175,27 +193,22 @@ CGPIOSetupScreen::animate()
_scrollMessage(56, pMsg, _scrollChar);
break;
case 5:
case 2:
_display.drawFastHLine(0, 52, 128, WHITE);
switch(_GPIOparams.out1Mode) {
case CGPIOout1::Disabled: pMsg = " Output 1: DISABLED. "; break;
case CGPIOout1::Status: pMsg = " Output 1: LED status indicator. "; break;
case CGPIOout1::User: pMsg = " Output 1: User controlled. "; break;
switch(_GPIOparams.in2Mode) {
case CGPIOin2::Disabled: pMsg = " Input 2: DISABLED. "; break;
case CGPIOin2::Stop: pMsg = " Input 2: Stops heater upon closure. "; break;
case CGPIOin2::Thermostat: pMsg = " Input 2: External thermostat. Max fuel when closed, min fuel when open. "; break;
}
if(pMsg)
_scrollMessage(56, pMsg, _scrollChar);
break;
case 3:
_display.drawFastHLine(0, 52, 128, WHITE);
pMsg = " Input 2: External thermostat. Start heater upon closure, stop after open for specified period. ";
_scrollMessage(56, pMsg, _scrollChar);
break;
case 4:
_display.drawFastHLine(0, 52, 128, WHITE);
switch(_GPIOparams.out2Mode) {
case CGPIOout2::Disabled: pMsg = " Output 2: DISABLED. "; break;
case CGPIOout2::User: pMsg = " Output 2: User controlled. "; break;
}
if(pMsg)
_scrollMessage(56, pMsg, _scrollChar);
break;
case 3:
_display.drawFastHLine(0, 52, 128, WHITE);
switch(_GPIOparams.in1Mode) {
case CGPIOin1::Disabled: pMsg = " Input 1: DISABLED. "; break;
@ -206,12 +219,22 @@ CGPIOSetupScreen::animate()
if(pMsg)
_scrollMessage(56, pMsg, _scrollChar);
break;
case 2:
case 5:
_display.drawFastHLine(0, 52, 128, WHITE);
switch(_GPIOparams.in2Mode) {
case CGPIOin2::Disabled: pMsg = " Input 2: DISABLED. "; break;
case CGPIOin2::Stop: pMsg = " Input 2: Stops heater upon closure. "; break;
case CGPIOin2::Thermostat: pMsg = " Input 2: External thermostat. Max fuel when closed, min fuel when open. "; break;
switch(_GPIOparams.out2Mode) {
case CGPIOout2::Disabled: pMsg = " Output 2: DISABLED. "; break;
case CGPIOout2::User: pMsg = " Output 2: User controlled. "; break;
}
if(pMsg)
_scrollMessage(56, pMsg, _scrollChar);
break;
case 6:
_display.drawFastHLine(0, 52, 128, WHITE);
switch(_GPIOparams.out1Mode) {
case CGPIOout1::Disabled: pMsg = " Output 1: DISABLED. "; break;
case CGPIOout1::Status: pMsg = " Output 1: LED status indicator. "; break;
case CGPIOout1::User: pMsg = " Output 1: User controlled. "; break;
}
if(pMsg)
_scrollMessage(56, pMsg, _scrollChar);
@ -239,6 +262,7 @@ CGPIOSetupScreen::keyHandler(uint8_t event)
case 3:
case 4:
case 5:
case 6:
_scrollChar = 0;
_adjust(-1);
break;
@ -258,6 +282,7 @@ CGPIOSetupScreen::keyHandler(uint8_t event)
case 3:
case 4:
case 5:
case 6:
_scrollChar = 0;
_adjust(+1);
break;
@ -269,6 +294,8 @@ CGPIOSetupScreen::keyHandler(uint8_t event)
if(event & key_Down) {
_scrollChar = 0;
_rowSel--;
if((_rowSel == 3) && (_GPIOparams.in2Mode != CGPIOin2::Thermostat))
_rowSel--; // force skip if not set to external thermostat
if((_rowSel == 1) && (getBoardRevision() == BRD_V2_GPIO_NOALG)) // GPIO but NO analog support
_rowSel--; // force skip if analog input is not supported by PCB
LOWERLIMIT(_rowSel, 0);
@ -286,12 +313,15 @@ CGPIOSetupScreen::keyHandler(uint8_t event)
case 5:
_scrollChar = 0;
_rowSel++;
UPPERLIMIT(_rowSel, 5);
if((_rowSel == 3) && (_GPIOparams.in2Mode != CGPIOin2::Thermostat))
_rowSel++; // force skip if not set to external thermostat
UPPERLIMIT(_rowSel, 6);
break;
case 10: // confirmed save
_enableStoringMessage();
us = NVstore.getUserSettings();
us.GPIO = _GPIOparams;
us.ExtThermoTimeout = _ExtHold;
NVstore.setUserSettings(us);
saveNV();
@ -312,6 +342,7 @@ CGPIOSetupScreen::keyHandler(uint8_t event)
case 3:
case 4:
case 5:
case 6:
_rowSel = 10;
break;
}
@ -333,24 +364,38 @@ CGPIOSetupScreen::_adjust(int dir)
WRAPLIMITS(tVal, 0, 1);
_GPIOparams.algMode = (CGPIOalg::Modes)tVal;
break;
case 5: // outputs mode
case 6: // outputs mode
tVal = _GPIOparams.out1Mode;
tVal += dir;
WRAPLIMITS(tVal, 0, 2);
_GPIOparams.out1Mode = (CGPIOout1::Modes)tVal;
break;
case 4: // outputs mode
case 5: // outputs mode
tVal = _GPIOparams.out2Mode;
tVal += dir;
WRAPLIMITS(tVal, 0, 1);
_GPIOparams.out2Mode = (CGPIOout2::Modes)tVal;
break;
case 3:
case 4:
tVal = _GPIOparams.in1Mode;
tVal += dir;
WRAPLIMITS(tVal, 0, 3);
_GPIOparams.in1Mode = (CGPIOin1::Modes)tVal;
break;
case 3:
switch(_ExtHold) {
case 0: _ExtHold = (dir > 0) ? 60000 : 0; break;
case 60000: _ExtHold = (dir > 0) ? 120000 : 0; break;
case 120000: _ExtHold = (dir > 0) ? 300000 : 60000; break;
case 300000: _ExtHold = (dir > 0) ? 600000 : 120000; break;
case 600000: _ExtHold = (dir > 0) ? 900000 : 300000; break;
case 900000: _ExtHold = (dir > 0) ? 1200000 : 600000; break;
case 1200000: _ExtHold = (dir > 0) ? 1800000 : 900000; break;
case 1800000: _ExtHold = (dir > 0) ? 3600000 : 1200000; break;
case 3600000: _ExtHold = (dir > 0) ? 3600000 : 1800000; break;
default: _ExtHold = 0; break;
}
break;
case 2:
tVal = _GPIOparams.in2Mode;
tVal += dir;
@ -361,169 +406,3 @@ CGPIOSetupScreen::_adjust(int dir)
}
CGPIOInfoScreen::CGPIOInfoScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreen(display, mgr)
{
_keyRepeatCount = -1;
}
void
CGPIOInfoScreen::_initUI()
{
}
bool
CGPIOInfoScreen::animate()
{
char msg[16];
_display.clearDisplay();
_showTitle("GPIO status");
_drawBitmap(0, 14, InputIconInfo);
_drawBitmap(11, 14, _1IconInfo);
_drawBitmap(0, 27, InputIconInfo);
_drawBitmap(11, 27, _2IconInfo);
_drawBitmap(75, 14, OutputIconInfo);
_drawBitmap(86, 14, _1IconInfo);
_drawBitmap(75, 27, OutputIconInfo);
_drawBitmap(86, 27, _2IconInfo);
if(getBoardRevision() == BRD_V2_FULLGPIO || getBoardRevision() == BRD_V1_FULLGPIO)
_printMenuText(0, Line1, "Analogue:", false, eRightJustify);
switch(NVstore.getUserSettings().GPIO.in1Mode) {
case CGPIOin1::Disabled:
_drawBitmap(23, 14, CrossLgIconInfo);
break;
case CGPIOin1::Start:
_drawBitmap(23, 14, StartIconInfo);
break;
case CGPIOin1::Run:
_drawBitmap(23, 14, RunIconInfo);
break;
case CGPIOin1::StartStop:
_drawBitmap(23, 14, StartIconInfo);
_drawBitmap(30, 14, StopIconInfo);
break;
}
_drawBitmap(40, 16, GPIOin.getState(0) ? CloseIconInfo : OpenIconInfo);
switch(NVstore.getUserSettings().GPIO.in2Mode) {
case CGPIOin2::Disabled:
_drawBitmap(23, 27, CrossLgIconInfo);
break;
case CGPIOin2::Stop:
_drawBitmap(23, 27, StopIconInfo);
break;
case CGPIOin2::Thermostat:
_printMenuText(23, 27, "\352T");
break;
}
_drawBitmap(40, 28, GPIOin.getState(1) ? CloseIconInfo : OpenIconInfo);
int bulbmode = GPIOout.getState(0);
static bool iconstate = false;
switch(NVstore.getUserSettings().GPIO.out1Mode) {
case CGPIOout1::Disabled:
_drawBitmap(99, 14, CrossLgIconInfo);
break;
case CGPIOout1::Status:
_drawBitmap(99, 14, InfoIconInfo);
if(iconstate && bulbmode == 2) // animate bulb icon when status is PWM mode
_drawBitmap(110, 13, BulbOn2IconInfo);
else
_drawBitmap(110, 13, bulbmode ? BulbOnIconInfo : BulbOffIconInfo);
iconstate = !iconstate;
break;
case CGPIOout1::User:
_drawBitmap(99, 15, UserIconInfo);
_drawBitmap(110, 13, bulbmode ? BulbOnIconInfo : BulbOffIconInfo);
break;
}
switch(NVstore.getUserSettings().GPIO.out2Mode) {
case CGPIOout2::Disabled: _drawBitmap(99, 27, CrossLgIconInfo); break;
case CGPIOout2::User:
_drawBitmap(99, 27, UserIconInfo);
_drawBitmap(110, 26, GPIOout.getState(1) ? BulbOnIconInfo : BulbOffIconInfo);
break;
}
if(getBoardRevision() == BRD_V2_FULLGPIO || getBoardRevision() == BRD_V1_FULLGPIO) {
_drawBitmap(0, Line1-1, algIconInfo);
if(NVstore.getUserSettings().GPIO.algMode == CGPIOalg::Disabled) {
_drawBitmap(23, Line1, CrossLgIconInfo);
}
else {
sprintf(msg, "%d%%", GPIOalg.getValue() * 100 / 4096);
_printMenuText(23, Line1, msg);
}
}
_printMenuText(_display.xCentre(), 53, " \021 \020 ", true, eCentreJustify);
return true;
}
bool
CGPIOInfoScreen::show()
{
return false;// CScreenHeader::show(false);
}
bool
CGPIOInfoScreen::keyHandler(uint8_t event)
{
if(event & keyPressed) {
_keyRepeatCount = 0; // unlock tracking of repeat events
// UP press
if(event & key_Up) {
}
// CENTRE press
if(event & key_Centre) {
}
if(event & key_Down) {
_ScreenManager.selectMenu(CScreenManager::UserSettingsLoop, CScreenManager::GPIOUI);
}
}
if(event & keyRepeat) {
if(_keyRepeatCount >= 0) {
_keyRepeatCount++;
// hold LEFT to toggle GPIO output #1
if(event & key_Left) {
if(_keyRepeatCount > 2) {
_keyRepeatCount = -1; // prevent double handling
toggleGPIOout(0); // toggle GPIO output #1
}
}
// hold RIGHT to toggle GPIO output #2
if(event & key_Right) {
if(_keyRepeatCount > 2) {
_keyRepeatCount = -1; // prevent double handling
toggleGPIOout(1); // toggle GPIO output #2
}
}
}
}
// release event
if(event & keyReleased) {
if(_keyRepeatCount == 0) { // short Up press - lower target
// press LEFT to select previous screen
if(event & key_Left) {
_ScreenManager.prevMenu();
}
// press RIGHT to select next screen
if(event & key_Right) {
_ScreenManager.nextMenu();
}
}
_keyRepeatCount = -1;
}
_ScreenManager.reqUpdate();
return true;
}

View file

@ -19,8 +19,8 @@
*
*/
#ifndef __GPIOSCREEN_H__
#define __GPIOSCREEN_H__
#ifndef __GPIOSETUPSCREEN_H__
#define __GPIOSETUPSCREEN_H__
#include <stdint.h>
#include "PasswordScreen.h"
@ -34,6 +34,7 @@ class CGPIOSetupScreen : public CPasswordScreen
int _rowSel;
void _adjust(int dir);
sGPIOparams _GPIOparams;
unsigned long _ExtHold;
int _animateCount;
int _scrollChar;
void _initUI();
@ -45,15 +46,4 @@ public:
void onSelect();
};
class CGPIOInfoScreen : public CScreen
{
int _keyRepeatCount;
void _initUI();
public:
CGPIOInfoScreen(C128x64_OLED& display, CScreenManager& mgr);
bool show();
bool animate();
bool keyHandler(uint8_t event);
};
#endif

View file

@ -36,7 +36,8 @@
#include "FontDumpScreen.h"
#include "TimerChartScreen.h"
#include "InheritSettingsScreen.h"
#include "GPIOScreen.h"
#include "GPIOInfoScreen.h"
#include "GPIOSetupScreen.h"
#include "VersionInfoScreen.h"
#include "HomeMenuSelScreen.h"
#include "OtherOptionsScreen.h"

View file

@ -56,7 +56,6 @@ CThermostatModeScreen::onSelect()
_window = NVstore.getUserSettings().ThermostatWindow;
_thermoMode = NVstore.getUserSettings().ThermostatMethod;
_cyclicMode = NVstore.getUserSettings().cyclic;
_ExtHold = NVstore.getUserSettings().ExtThermoTimeout;
}
void
@ -99,21 +98,6 @@ CThermostatModeScreen::show()
}
if(modeStr)
_printMenuText(Column, Line3, modeStr, _rowSel == 4);
modeStr = "??";
if(_thermoMode == 3) {
switch(_ExtHold) {
case 0: modeStr = "Psv"; break;
case 60000: modeStr = "1 min"; break;
case 120000: modeStr = "2 min"; break;
case 300000: modeStr = "5 min"; break;
case 600000: modeStr = "10 min"; break;
case 900000: modeStr = "15 min"; break;
case 1200000: modeStr = "20 min"; break;
case 1800000: modeStr = "30 min"; break;
case 3600000: modeStr = "1 hour"; break;
}
_printMenuText(_display.width()-border, Line2, modeStr, _rowSel == 5, eRightJustify);
}
if(_cyclicMode.isEnabled()) {
float fTemp = _cyclicMode.Stop+1;
if(NVstore.getUserSettings().degF) {
@ -194,10 +178,6 @@ CThermostatModeScreen::animate()
if(pMsg)
_scrollMessage(56, pMsg, _scrollChar);
break;
case 5:
_display.drawFastHLine(0, 52, 128, WHITE);
pMsg = " External thermostat handling - start upon initial closure, stop the heater after the nominated period. ";
break;
}
return true;
}
@ -219,10 +199,10 @@ CThermostatModeScreen::keyHandler(uint8_t event)
break;
case 4:
_scrollChar = 0;
// deliberate fall through here
case 1:
case 2:
case 3:
case 5:
_adjust(-1);
break;
case 10:
@ -238,10 +218,10 @@ CThermostatModeScreen::keyHandler(uint8_t event)
break;
case 4:
_scrollChar = 0;
// deliberate fall through here
case 1:
case 2:
case 3:
case 5:
_adjust(+1);
break;
case 10:
@ -274,17 +254,12 @@ CThermostatModeScreen::keyHandler(uint8_t event)
_rowSel++;
UPPERLIMIT(_rowSel, 4);
break;
case 4:
if(_thermoMode == 3)
_rowSel++;
break;
case 10: // confirmed save
_enableStoringMessage();
settings = NVstore.getUserSettings();
settings.ThermostatMethod = _thermoMode;
settings.ThermostatWindow = _window;
settings.cyclic = _cyclicMode;
settings.ExtThermoTimeout = _ExtHold;
NVstore.setUserSettings(settings);
saveNV();
_rowSel = 0;
@ -302,7 +277,6 @@ CThermostatModeScreen::keyHandler(uint8_t event)
case 2:
case 3:
case 4:
case 5:
_rowSel = 10;
break;
}
@ -357,19 +331,5 @@ CThermostatModeScreen::_adjust(int dir)
wrap = getExternalThermostatModeActive() ? 3 : 2;
WRAPLIMITS(_thermoMode, 0, wrap);
break;
case 5:
switch(_ExtHold) {
case 0: _ExtHold = (dir > 0) ? 60000 : 0; break;
case 60000: _ExtHold = (dir > 0) ? 120000 : 0; break;
case 120000: _ExtHold = (dir > 0) ? 300000 : 60000; break;
case 300000: _ExtHold = (dir > 0) ? 600000 : 120000; break;
case 600000: _ExtHold = (dir > 0) ? 900000 : 300000; break;
case 900000: _ExtHold = (dir > 0) ? 1200000 : 600000; break;
case 1200000: _ExtHold = (dir > 0) ? 1800000 : 900000; break;
case 1800000: _ExtHold = (dir > 0) ? 3600000 : 1200000; break;
case 3600000: _ExtHold = (dir > 0) ? 3600000 : 1800000; break;
default: _ExtHold = 0; break;
}
break;
}
}

View file

@ -36,7 +36,6 @@ class CThermostatModeScreen : public CPasswordScreen
void _adjust(int dir);
float _window;
int _thermoMode;
unsigned long _ExtHold;
sCyclicThermostat _cyclicMode;
int _animateCount;
int _scrollChar;

View file

@ -645,9 +645,9 @@ const uint8_t PROGMEM segoeUI_Italic_7ptBitmaps [] =
// @24 '4' (5 pixels wide)
0x18, // ##
0x28, // # #
0x48, // # #
0xFC, // ######
0x88, // # #
0x4E, // # ###
0xB8, // # ###
0xC8, // ## #
// @29 '5' (5 pixels wide)
0x06, // ##
@ -737,7 +737,7 @@ const FONT_CHAR_INFO PROGMEM segoeUI_Italic_7ptDescriptors[] =
{2, 7, 12}, // '1'
{5, 7, 14}, // '2'
{5, 7, 19}, // '3'
{5, 6, 24}, // '4'
{5, 7, 24}, // '4'
{5, 7, 29}, // '5'
{4, 7, 34}, // '6'
{4, 7, 39}, // '7'