Titled Timer screen - lost std header
Added missing source files
This commit is contained in:
parent
d563cb0c8a
commit
6c21a9c6a6
21 changed files with 1010 additions and 655 deletions
115
src/OLED/BTScreen.cpp
Normal file
115
src/OLED/BTScreen.cpp
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* 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 "BTScreen.h"
|
||||||
|
#include "KeyPad.h"
|
||||||
|
#include "../Utility/helpers.h"
|
||||||
|
#include "../Bluetooth/BluetoothAbstract.h"
|
||||||
|
#include "../Utility/NVStorage.h"
|
||||||
|
#include "fonts/Arial.h"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// CBTScreen
|
||||||
|
//
|
||||||
|
// This screen presents Bluetooth status information
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
static const int LIMIT_AWAY = 0;
|
||||||
|
static const int LIMIT_LEFT = 1;
|
||||||
|
static const int LIMIT_RIGHT = 2;
|
||||||
|
|
||||||
|
CBTScreen::CBTScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreen(display, mgr)
|
||||||
|
{
|
||||||
|
_initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CBTScreen::onSelect()
|
||||||
|
{
|
||||||
|
CScreen::onSelect();
|
||||||
|
_initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CBTScreen::_initUI()
|
||||||
|
{
|
||||||
|
_rowSel = 0;
|
||||||
|
_colSel = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CBTScreen::show()
|
||||||
|
{
|
||||||
|
// CScreenHeader::show(false);
|
||||||
|
CScreen::show();
|
||||||
|
|
||||||
|
int yPos = 18;
|
||||||
|
|
||||||
|
_showTitle("Bluetooth info");
|
||||||
|
|
||||||
|
yPos = 35;
|
||||||
|
_printMenuText(0, yPos, "MAC:");
|
||||||
|
_printMenuText(25, yPos, getBluetoothClient().getMAC());
|
||||||
|
|
||||||
|
_printMenuText(_display.xCentre(), 53, " \021 \020 ", true, eCentreJustify);
|
||||||
|
_printMenuText(_display.xCentre(), 53, "Exit", false, eCentreJustify);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CBTScreen::keyHandler(uint8_t event)
|
||||||
|
{
|
||||||
|
if(event & keyPressed) {
|
||||||
|
// press CENTRE
|
||||||
|
if(event & key_Centre) {
|
||||||
|
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop); // force return to main menu
|
||||||
|
}
|
||||||
|
// press LEFT
|
||||||
|
if(event & key_Left) {
|
||||||
|
switch(_rowSel) {
|
||||||
|
case 0:
|
||||||
|
_ScreenManager.prevMenu();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// press RIGHT
|
||||||
|
if(event & key_Right) {
|
||||||
|
switch(_rowSel) {
|
||||||
|
case 0:
|
||||||
|
_ScreenManager.nextMenu();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// press UP
|
||||||
|
if(event & key_Up) {
|
||||||
|
}
|
||||||
|
// press DOWN
|
||||||
|
if(event & key_Down) {
|
||||||
|
}
|
||||||
|
_ScreenManager.reqUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
42
src/OLED/BTScreen.h
Normal file
42
src/OLED/BTScreen.h
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* 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 __BTSCREEN_H__
|
||||||
|
#define __BTSCREEN_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "ScreenHeader.h"
|
||||||
|
|
||||||
|
class C128x64_OLED;
|
||||||
|
class CScreenManager;
|
||||||
|
|
||||||
|
class CBTScreen : public CScreen {
|
||||||
|
public:
|
||||||
|
CBTScreen(C128x64_OLED& display, CScreenManager& mgr);
|
||||||
|
void onSelect();
|
||||||
|
bool show();
|
||||||
|
bool keyHandler(uint8_t event);
|
||||||
|
private:
|
||||||
|
int _rowSel, _colSel;
|
||||||
|
void _initUI();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -227,7 +227,7 @@ CFuelCalScreen::keyHandler(uint8_t event)
|
||||||
case 4: // confirmed save
|
case 4: // confirmed save
|
||||||
_display.clearDisplay();
|
_display.clearDisplay();
|
||||||
_animateCount = -1;
|
_animateCount = -1;
|
||||||
_showStoringMessage();
|
_enableStoringMessage();
|
||||||
tuning = NVstore.getHeaterTuning();
|
tuning = NVstore.getHeaterTuning();
|
||||||
tuning.pumpCal = _mlPerStroke;
|
tuning.pumpCal = _mlPerStroke;
|
||||||
tuning.lowVolts = _LVC;
|
tuning.lowVolts = _LVC;
|
||||||
|
|
|
@ -245,7 +245,7 @@ CFuelMixtureScreen::keyHandler(uint8_t event)
|
||||||
case 5:
|
case 5:
|
||||||
_display.clearDisplay();
|
_display.clearDisplay();
|
||||||
_animateCount = -1;
|
_animateCount = -1;
|
||||||
_showStoringMessage();
|
_enableStoringMessage();
|
||||||
setPumpMin(adjPump[0]);
|
setPumpMin(adjPump[0]);
|
||||||
setPumpMax(adjPump[1]);
|
setPumpMax(adjPump[1]);
|
||||||
setFanMin(adjFan[0]);
|
setFanMin(adjFan[0]);
|
||||||
|
|
|
@ -227,7 +227,7 @@ CGPIOScreen::keyHandler(uint8_t event)
|
||||||
UPPERLIMIT(_rowSel, 3);
|
UPPERLIMIT(_rowSel, 3);
|
||||||
break;
|
break;
|
||||||
case 4: // confirmed save
|
case 4: // confirmed save
|
||||||
_showStoringMessage();
|
_enableStoringMessage();
|
||||||
us = NVstore.getUserSettings();
|
us = NVstore.getUserSettings();
|
||||||
us.GPIO = _GPIOparams;
|
us.GPIO = _GPIOparams;
|
||||||
NVstore.setUserSettings(us);
|
NVstore.setUserSettings(us);
|
||||||
|
|
|
@ -203,7 +203,7 @@ CHeaterSettingsScreen::keyHandler(uint8_t event)
|
||||||
UPPERLIMIT(_rowSel, 3);
|
UPPERLIMIT(_rowSel, 3);
|
||||||
break;
|
break;
|
||||||
case 4: // confirmed save
|
case 4: // confirmed save
|
||||||
_showStoringMessage();
|
_enableStoringMessage();
|
||||||
setSystemVoltage(float(_sysVoltage));
|
setSystemVoltage(float(_sysVoltage));
|
||||||
setFanSensor(_fanSensor);
|
setFanSensor(_fanSensor);
|
||||||
setGlowDrive(_glowDrive);
|
setGlowDrive(_glowDrive);
|
||||||
|
|
|
@ -133,7 +133,7 @@ CHomeMenuSelScreen::keyHandler(uint8_t event)
|
||||||
// UP press
|
// UP press
|
||||||
if(event & key_Up) {
|
if(event & key_Up) {
|
||||||
if(_rowSel == 4) {
|
if(_rowSel == 4) {
|
||||||
_showStoringMessage();
|
_enableStoringMessage();
|
||||||
us = NVstore.getUserSettings();
|
us = NVstore.getUserSettings();
|
||||||
us.HomeMenu = _action;
|
us.HomeMenu = _action;
|
||||||
NVstore.setUserSettings(us);
|
NVstore.setUserSettings(us);
|
||||||
|
|
|
@ -105,7 +105,7 @@ CInheritSettingsScreen::keyHandler(uint8_t event)
|
||||||
setFanSensor(getHeaterInfo().getFan_Sensor());
|
setFanSensor(getHeaterInfo().getFan_Sensor());
|
||||||
setSystemVoltage(getHeaterInfo().getSystemVoltage());
|
setSystemVoltage(getHeaterInfo().getSystemVoltage());
|
||||||
saveNV();
|
saveNV();
|
||||||
_showStoringMessage();
|
_enableStoringMessage();
|
||||||
_nAdoptSettings = 0; // will cause return to main menu after storing message expires
|
_nAdoptSettings = 0; // will cause return to main menu after storing message expires
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
149
src/OLED/MenuTrunkScreen.cpp
Normal file
149
src/OLED/MenuTrunkScreen.cpp
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
/*
|
||||||
|
* 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 "MenuTrunkScreen.h"
|
||||||
|
#include "KeyPad.h"
|
||||||
|
#include "../Utility/helpers.h"
|
||||||
|
#include "../Utility/macros.h"
|
||||||
|
#include "fonts/Arial.h"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// CMenuTrunkScreen
|
||||||
|
//
|
||||||
|
// This screen presents Bluetooth status information
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
static const int LIMIT_AWAY = 0;
|
||||||
|
static const int LIMIT_LEFT = 1;
|
||||||
|
static const int LIMIT_RIGHT = 2;
|
||||||
|
|
||||||
|
CMenuTrunkScreen::CMenuTrunkScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreen(display, mgr)
|
||||||
|
{
|
||||||
|
_initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CMenuTrunkScreen::onSelect()
|
||||||
|
{
|
||||||
|
CScreen::onSelect();
|
||||||
|
// _initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CMenuTrunkScreen::_initUI()
|
||||||
|
{
|
||||||
|
_rowSel = 0;
|
||||||
|
_colSel = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CMenuTrunkScreen::show()
|
||||||
|
{
|
||||||
|
_display.clearDisplay();
|
||||||
|
|
||||||
|
CScreen::show();
|
||||||
|
|
||||||
|
int yPos[] = { 53, 41, 29, 17 };
|
||||||
|
|
||||||
|
_showTitle("Menu Trunk");
|
||||||
|
|
||||||
|
_printMenuText(_display.xCentre(), yPos[_rowSel], " \021 \020 ", true, eCentreJustify);
|
||||||
|
|
||||||
|
_printMenuText(_display.xCentre(), yPos[3], "Heater Tuning", false, eCentreJustify);
|
||||||
|
_printMenuText(_display.xCentre(), yPos[2], "System Settings", false, eCentreJustify);
|
||||||
|
_printMenuText(_display.xCentre(), yPos[1], "User Settings", false, eCentreJustify);
|
||||||
|
_printMenuText(_display.xCentre(), yPos[0], "Root menu", false, eCentreJustify);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CMenuTrunkScreen::keyHandler(uint8_t event)
|
||||||
|
{
|
||||||
|
if(event & keyPressed) {
|
||||||
|
// press CENTRE
|
||||||
|
if(event & key_Centre) {
|
||||||
|
_rowSel = 0;
|
||||||
|
}
|
||||||
|
// press LEFT
|
||||||
|
if(event & key_Left) {
|
||||||
|
switch(_rowSel) {
|
||||||
|
case 0:
|
||||||
|
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop);
|
||||||
|
_ScreenManager.prevMenu();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
_ScreenManager.selectMenu(CScreenManager::UserSettingsLoop);
|
||||||
|
// _ScreenManager.prevMenu();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
_ScreenManager.selectMenu(CScreenManager::SystemSettingsLoop);
|
||||||
|
// _ScreenManager.prevMenu();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
_ScreenManager.selectMenu(CScreenManager::BranchMenu, CScreenManager::HtrSettingsUI);
|
||||||
|
// _ScreenManager.selectMenu(CScreenManager::TuningMenuLoop);
|
||||||
|
// _ScreenManager.prevMenu();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// press RIGHT
|
||||||
|
if(event & key_Right) {
|
||||||
|
switch(_rowSel) {
|
||||||
|
case 0:
|
||||||
|
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop);
|
||||||
|
_ScreenManager.nextMenu();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
_ScreenManager.selectMenu(CScreenManager::UserSettingsLoop);
|
||||||
|
// _ScreenManager.nextMenu();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
_ScreenManager.selectMenu(CScreenManager::SystemSettingsLoop);
|
||||||
|
// _ScreenManager.nextMenu();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
_ScreenManager.selectMenu(CScreenManager::BranchMenu, CScreenManager::HtrSettingsUI);
|
||||||
|
|
||||||
|
// _ScreenManager.selectMenu(CScreenManager::TuningMenuLoop);
|
||||||
|
// _ScreenManager.nextMenu();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// press UP
|
||||||
|
if(event & key_Up) {
|
||||||
|
_rowSel++;
|
||||||
|
UPPERLIMIT(_rowSel, 3);
|
||||||
|
}
|
||||||
|
// press DOWN
|
||||||
|
if(event & key_Down) {
|
||||||
|
_rowSel--;
|
||||||
|
LOWERLIMIT(_rowSel, 0);
|
||||||
|
}
|
||||||
|
_ScreenManager.reqUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
42
src/OLED/MenuTrunkScreen.h
Normal file
42
src/OLED/MenuTrunkScreen.h
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* 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 __MENUTRUNKSCREEN_H__
|
||||||
|
#define __MENUTRUNKSCREEN_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "Screen.h"
|
||||||
|
|
||||||
|
class C128x64_OLED;
|
||||||
|
class CScreenManager;
|
||||||
|
|
||||||
|
class CMenuTrunkScreen : public CScreen {
|
||||||
|
public:
|
||||||
|
CMenuTrunkScreen(C128x64_OLED& display, CScreenManager& mgr);
|
||||||
|
void onSelect();
|
||||||
|
bool show();
|
||||||
|
bool keyHandler(uint8_t event);
|
||||||
|
private:
|
||||||
|
int _rowSel, _colSel;
|
||||||
|
void _initUI();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -147,7 +147,7 @@ COtherOptionsScreen::keyHandler(uint8_t event)
|
||||||
settings.FrameRate = _frameRate;
|
settings.FrameRate = _frameRate;
|
||||||
NVstore.setUserSettings(settings);
|
NVstore.setUserSettings(settings);
|
||||||
NVstore.save();
|
NVstore.save();
|
||||||
_showStoringMessage();
|
_enableStoringMessage();
|
||||||
_rowSel = 0;
|
_rowSel = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -64,11 +64,7 @@ CPasswordScreen::show()
|
||||||
|
|
||||||
if(_SaveTime) {
|
if(_SaveTime) {
|
||||||
_display.clearDisplay();
|
_display.clearDisplay();
|
||||||
// _printInverted(_display.xCentre(), 28, " ", true, eCentreJustify);
|
_showStoringMessage();
|
||||||
// _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;
|
return true;
|
||||||
}
|
}
|
||||||
else if(_bGetPassword) {
|
else if(_bGetPassword) {
|
||||||
|
@ -204,16 +200,10 @@ CPasswordScreen::_getPassword()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CPasswordScreen::_showStoringMessage()
|
CPasswordScreen::_enableStoringMessage()
|
||||||
{
|
{
|
||||||
_SaveTime = millis() + 1500;
|
_SaveTime = millis() + 1500;
|
||||||
_ScreenManager.reqUpdate();
|
_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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -37,10 +37,9 @@ protected:
|
||||||
bool _showPassword();
|
bool _showPassword();
|
||||||
void _getPassword();
|
void _getPassword();
|
||||||
bool _isPasswordOK() { return _bPasswordOK; };
|
bool _isPasswordOK() { return _bPasswordOK; };
|
||||||
void _showStoringMessage();
|
void _enableStoringMessage();
|
||||||
void _initUI();
|
void _initUI();
|
||||||
bool _busy();
|
bool _busy();
|
||||||
void _showConfirmMessage();
|
|
||||||
public:
|
public:
|
||||||
CPasswordScreen(C128x64_OLED& display, CScreenManager& mgr);
|
CPasswordScreen(C128x64_OLED& display, CScreenManager& mgr);
|
||||||
void onSelect();
|
void onSelect();
|
||||||
|
|
|
@ -183,10 +183,26 @@ void
|
||||||
CScreen::_showTitle(const char* title)
|
CScreen::_showTitle(const char* title)
|
||||||
{
|
{
|
||||||
CTransientFont AF(_display, &arial_8ptBoldFontInfo);
|
CTransientFont AF(_display, &arial_8ptBoldFontInfo);
|
||||||
_printMenuText(_display.xCentre(), -2, title, false, eCentreJustify);
|
_printMenuText(_display.xCentre(), -1, title, false, eCentreJustify);
|
||||||
_display.drawFastHLine(0, 10, 128, WHITE);
|
_display.drawFastHLine(0, 10, 128, WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CScreen::_showConfirmMessage()
|
||||||
|
{
|
||||||
|
_showTitle("Saving Settings");
|
||||||
|
_printMenuText(_display.xCentre(), 35, "Press UP to", false, eCentreJustify);
|
||||||
|
_printMenuText(_display.xCentre(), 43, "confirm save", false, eCentreJustify);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CScreen::_showStoringMessage()
|
||||||
|
{
|
||||||
|
_display.writeFillRect(34, 19, 60, 26, WHITE);
|
||||||
|
CTransientFont AF(_display, &arial_8ptBoldFontInfo);
|
||||||
|
_printInverted(_display.xCentre(), 25, " STORING ", true, eCentreJustify);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// a class used for temporary alternate fonts usage
|
// a class used for temporary alternate fonts usage
|
||||||
// Reverts to standard inbuilt font when the instance falls out of scope
|
// Reverts to standard inbuilt font when the instance falls out of scope
|
||||||
|
|
|
@ -57,6 +57,8 @@ protected:
|
||||||
void _reqOEMWarning();
|
void _reqOEMWarning();
|
||||||
void _drawBitmap(int x, int y, const BITMAP_INFO& info, uint16_t color = WHITE, uint16_t bg = 0xffff);
|
void _drawBitmap(int x, int y, const BITMAP_INFO& info, uint16_t color = WHITE, uint16_t bg = 0xffff);
|
||||||
void _showTitle(const char* title);
|
void _showTitle(const char* title);
|
||||||
|
void _showConfirmMessage();
|
||||||
|
void _showStoringMessage();
|
||||||
public:
|
public:
|
||||||
CScreen(C128x64_OLED& disp, CScreenManager& mgr);
|
CScreen(C128x64_OLED& disp, CScreenManager& mgr);
|
||||||
virtual ~CScreen();
|
virtual ~CScreen();
|
||||||
|
|
|
@ -83,12 +83,11 @@ CSetClockScreen::show()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_SaveTime) {
|
if(_SaveTime) {
|
||||||
|
_showStoringMessage();
|
||||||
long tDelta = millis() - _SaveTime;
|
long tDelta = millis() - _SaveTime;
|
||||||
if(tDelta > 0)
|
if(tDelta > 0) {
|
||||||
_SaveTime = 0;
|
_SaveTime = 0;
|
||||||
_printInverted(_display.xCentre(), 28, " ", true, eCentreJustify);
|
}
|
||||||
_printInverted(_display.xCentre(), 39, " ", true, eCentreJustify);
|
|
||||||
_printInverted(_display.xCentre(), 34, " STORING ", true, eCentreJustify);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
yPos = 28;
|
yPos = 28;
|
||||||
|
|
|
@ -33,10 +33,11 @@
|
||||||
#include "../Utility/helpers.h"
|
#include "../Utility/helpers.h"
|
||||||
#include "../../lib/RTClib/RTClib.h"
|
#include "../../lib/RTClib/RTClib.h"
|
||||||
#include "../RTC/TimerManager.h"
|
#include "../RTC/TimerManager.h"
|
||||||
|
#include "fonts/Arial.h"
|
||||||
|
|
||||||
const char* briefDOW[] = { "S", "M", "T", "W", "T", "F", "S" };
|
const char* briefDOW[] = { "S", "M", "T", "W", "T", "F", "S" };
|
||||||
|
|
||||||
CSetTimerScreen::CSetTimerScreen(C128x64_OLED& display, CScreenManager& mgr, int instance) : CScreenHeader(display, mgr)
|
CSetTimerScreen::CSetTimerScreen(C128x64_OLED& display, CScreenManager& mgr, int instance) : CScreen(display, mgr)
|
||||||
{
|
{
|
||||||
_initUI();
|
_initUI();
|
||||||
_ConflictTime = 0;
|
_ConflictTime = 0;
|
||||||
|
@ -47,7 +48,7 @@ CSetTimerScreen::CSetTimerScreen(C128x64_OLED& display, CScreenManager& mgr, int
|
||||||
void
|
void
|
||||||
CSetTimerScreen::onSelect()
|
CSetTimerScreen::onSelect()
|
||||||
{
|
{
|
||||||
CScreenHeader::onSelect();
|
CScreen::onSelect();
|
||||||
_initUI();
|
_initUI();
|
||||||
NVstore.getTimerInfo(_timerID, _timerInfo);
|
NVstore.getTimerInfo(_timerID, _timerInfo);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +64,9 @@ CSetTimerScreen::_initUI()
|
||||||
bool
|
bool
|
||||||
CSetTimerScreen::show()
|
CSetTimerScreen::show()
|
||||||
{
|
{
|
||||||
CScreenHeader::show(false);
|
CScreen::show();
|
||||||
|
|
||||||
|
_display.clearDisplay();
|
||||||
|
|
||||||
char str[20];
|
char str[20];
|
||||||
int xPos, yPos;
|
int xPos, yPos;
|
||||||
|
@ -71,35 +74,22 @@ CSetTimerScreen::show()
|
||||||
if(_rowSel == 0) {
|
if(_rowSel == 0) {
|
||||||
NVstore.getTimerInfo(_timerID, _timerInfo);
|
NVstore.getTimerInfo(_timerID, _timerInfo);
|
||||||
}
|
}
|
||||||
sprintf(str, " Set Timer %d ", _timerID + 1);
|
sprintf(str, "Set Timer #%d", _timerID + 1);
|
||||||
_printInverted(0, 15, str, true);
|
_showTitle(str);
|
||||||
|
|
||||||
if(_SaveTime) {
|
if(_SaveTime) {
|
||||||
|
_showStoringMessage();
|
||||||
long tDelta = millis() - _SaveTime;
|
long tDelta = millis() - _SaveTime;
|
||||||
if(tDelta > 0)
|
if(tDelta > 0) {
|
||||||
_SaveTime = 0;
|
_SaveTime = 0;
|
||||||
_printInverted(_display.xCentre(), 28, " ", true, eCentreJustify);
|
}
|
||||||
_printInverted(_display.xCentre(), 39, " ", true, eCentreJustify);
|
|
||||||
_printInverted(_display.xCentre(), 34, " STORING ", true, eCentreJustify);
|
|
||||||
}
|
}
|
||||||
else if(_ConflictTime) {
|
else if(_ConflictTime) {
|
||||||
long tDelta = millis() - _ConflictTime;
|
long tDelta = millis() - _ConflictTime;
|
||||||
if(tDelta > 0)
|
if(tDelta > 0)
|
||||||
_ConflictTime = 0;
|
_ConflictTime = 0;
|
||||||
sprintf(str, " with Timer %d ", _conflictID);
|
sprintf(str, " with Timer %d ", _conflictID);
|
||||||
if(_conflictID >= 10) {
|
_showConflict(str);
|
||||||
// extra space
|
|
||||||
_printInverted(_display.xCentre(), 26, " ", true, eCentreJustify);
|
|
||||||
_printInverted(_display.xCentre(), 45, " ", true, eCentreJustify);
|
|
||||||
_printInverted(_display.xCentre(), 30, " Conflicts ", true, eCentreJustify);
|
|
||||||
_printInverted(_display.xCentre(), 38, str, true, eCentreJustify);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
_printInverted(_display.xCentre(), 26, " ", true, eCentreJustify);
|
|
||||||
_printInverted(_display.xCentre(), 45, " ", true, eCentreJustify);
|
|
||||||
_printInverted(_display.xCentre(), 30, " Conflicts ", true, eCentreJustify);
|
|
||||||
_printInverted(_display.xCentre(), 38, str, true, eCentreJustify);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// start
|
// start
|
||||||
|
@ -140,7 +130,7 @@ CSetTimerScreen::show()
|
||||||
_printMenuText(xPos, yPos, msg, _colSel==5, eRightJustify);
|
_printMenuText(xPos, yPos, msg, _colSel==5, eRightJustify);
|
||||||
else
|
else
|
||||||
_printInverted(xPos, yPos, msg, _timerInfo.repeat, eRightJustify);
|
_printInverted(xPos, yPos, msg, _timerInfo.repeat, eRightJustify);
|
||||||
}
|
|
||||||
// navigation line
|
// navigation line
|
||||||
yPos = 53;
|
yPos = 53;
|
||||||
xPos = _display.xCentre();
|
xPos = _display.xCentre();
|
||||||
|
@ -157,6 +147,7 @@ CSetTimerScreen::show()
|
||||||
else {
|
else {
|
||||||
_printMenuText(xPos, yPos, " \021 Exit \020 ", _rowSel==0, eCentreJustify);
|
_printMenuText(xPos, yPos, " \021 Exit \020 ", _rowSel==0, eCentreJustify);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -395,3 +386,12 @@ CSetTimerScreen::_printEnabledTimers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CSetTimerScreen::_showConflict(const char* str)
|
||||||
|
{
|
||||||
|
CTransientFont AF(_display, &arial_8ptBoldFontInfo);
|
||||||
|
_display.fillRect(19, 22, 90, 36, WHITE);
|
||||||
|
_printInverted(_display.xCentre(), 39, str, true, eCentreJustify);
|
||||||
|
_printInverted(_display.xCentre(), 28, "Conflicts", true, eCentreJustify);
|
||||||
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class C128x64_OLED;
|
||||||
class CScreenManager;
|
class CScreenManager;
|
||||||
class CProtocol;
|
class CProtocol;
|
||||||
|
|
||||||
class CSetTimerScreen : public CScreenHeader {
|
class CSetTimerScreen : public CScreen {
|
||||||
int _rowSel;
|
int _rowSel;
|
||||||
int _colSel;
|
int _colSel;
|
||||||
int _timerID;
|
int _timerID;
|
||||||
|
@ -41,7 +41,7 @@ class CSetTimerScreen : public CScreenHeader {
|
||||||
void _adjust(int dir);
|
void _adjust(int dir);
|
||||||
void _printEnabledTimers();
|
void _printEnabledTimers();
|
||||||
void _initUI();
|
void _initUI();
|
||||||
|
void _showConflict(const char* str);
|
||||||
public:
|
public:
|
||||||
CSetTimerScreen(C128x64_OLED& display, CScreenManager& mgr, int instance);
|
CSetTimerScreen(C128x64_OLED& display, CScreenManager& mgr, int instance);
|
||||||
void onSelect();
|
void onSelect();
|
||||||
|
|
|
@ -254,7 +254,7 @@ CThermostatModeScreen::keyHandler(uint8_t event)
|
||||||
UPPERLIMIT(_rowSel, 4);
|
UPPERLIMIT(_rowSel, 4);
|
||||||
break;
|
break;
|
||||||
case 10: // confirmed save
|
case 10: // confirmed save
|
||||||
_showStoringMessage();
|
_enableStoringMessage();
|
||||||
settings = NVstore.getUserSettings();
|
settings = NVstore.getUserSettings();
|
||||||
settings.ThermostatMethod = _thermoMode;
|
settings.ThermostatMethod = _thermoMode;
|
||||||
settings.ThermostatWindow = _window;
|
settings.ThermostatWindow = _window;
|
||||||
|
|
|
@ -174,7 +174,7 @@ CVersionInfoScreen::keyHandler(uint8_t event)
|
||||||
BoardRevisionReset();
|
BoardRevisionReset();
|
||||||
NVstore.init();
|
NVstore.init();
|
||||||
NVstore.save();
|
NVstore.save();
|
||||||
_showStoringMessage();
|
_enableStoringMessage();
|
||||||
_rowSel = 11;
|
_rowSel = 11;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue