2018-11-26 11:58:15 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the "bluetoothheater" distribution
|
|
|
|
* (https://gitlab.com/mrjones.id.au/bluetoothheater)
|
|
|
|
*
|
2019-09-08 00:14:36 +00:00
|
|
|
* Copyright (C) 2019 Ray Jones <ray@mrjones.id.au>
|
2018-11-26 11:58:15 +00:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-07-07 07:18:38 +00:00
|
|
|
#include <Arduino.h>
|
2019-07-02 08:27:20 +00:00
|
|
|
#include "fonts/Tahoma24.h"
|
2019-10-18 01:55:16 +00:00
|
|
|
#include "fonts/Arial.h"
|
2019-01-18 07:09:40 +00:00
|
|
|
#include "BasicScreen.h"
|
2018-11-23 10:34:37 +00:00
|
|
|
#include "KeyPad.h"
|
2019-06-15 23:09:29 +00:00
|
|
|
#include "../Utility/helpers.h"
|
2018-12-16 07:34:39 +00:00
|
|
|
#include "../Utility/UtilClasses.h"
|
2019-02-06 20:24:22 +00:00
|
|
|
#include "../Utility/NVStorage.h"
|
2019-06-15 23:09:29 +00:00
|
|
|
#include "../Protocol/Protocol.h"
|
2019-10-18 01:55:16 +00:00
|
|
|
#include "../Utility/TempSense.h"
|
2019-10-31 22:24:58 +00:00
|
|
|
#include "../RTC/RTCStore.h"
|
2018-11-23 10:34:37 +00:00
|
|
|
|
2019-04-19 11:38:39 +00:00
|
|
|
#define MAXIFONT tahoma_24ptFontInfo
|
2018-11-23 10:34:37 +00:00
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2019-01-18 07:09:40 +00:00
|
|
|
// CBasicScreen
|
2018-12-01 00:36:25 +00:00
|
|
|
//
|
|
|
|
// This screen provides a basic control function
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2019-01-18 07:09:40 +00:00
|
|
|
CBasicScreen::CBasicScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreenHeader(display, mgr)
|
2018-11-25 04:45:17 +00:00
|
|
|
{
|
2019-04-10 23:00:36 +00:00
|
|
|
_showSetModeTime = 0;
|
|
|
|
_showModeTime = 0;
|
|
|
|
_feedbackType = 0;
|
2018-11-25 04:45:17 +00:00
|
|
|
_nModeSel = 0;
|
2019-10-18 01:55:16 +00:00
|
|
|
_bShowOtherSensors = 0;
|
2018-11-25 04:45:17 +00:00
|
|
|
}
|
2018-11-24 00:51:09 +00:00
|
|
|
|
2019-01-18 23:06:12 +00:00
|
|
|
bool
|
2019-01-18 07:09:40 +00:00
|
|
|
CBasicScreen::show()
|
2018-11-23 10:34:37 +00:00
|
|
|
{
|
2019-07-21 11:17:54 +00:00
|
|
|
CScreenHeader::show(false);
|
2018-12-01 00:36:25 +00:00
|
|
|
|
2019-10-18 01:55:16 +00:00
|
|
|
char msg[32];
|
2018-11-29 11:11:50 +00:00
|
|
|
int xPos, yPos;
|
2019-10-18 01:55:16 +00:00
|
|
|
float fTemp;
|
|
|
|
bool bShowLargeTemp = true;
|
2018-11-24 00:51:09 +00:00
|
|
|
|
|
|
|
// at bottom of screen show either:
|
|
|
|
// Selection between Fixed or Thermostat mode
|
|
|
|
// Current heat demand setting
|
|
|
|
// Run state of heater
|
|
|
|
|
2019-04-10 23:00:36 +00:00
|
|
|
if(_showModeTime) {
|
2018-11-24 00:51:09 +00:00
|
|
|
const int border = 3;
|
|
|
|
// Show selection between Fixed or Thermostat mode
|
2019-04-10 23:00:36 +00:00
|
|
|
long tDelta = millis() - _showModeTime;
|
2018-11-24 11:03:47 +00:00
|
|
|
if(tDelta < 0) {
|
2018-11-29 11:11:50 +00:00
|
|
|
|
2018-12-01 18:25:10 +00:00
|
|
|
yPos = _display.height() - _display.textHeight() - border; // bottom of screen, with room for box
|
2018-11-29 11:11:50 +00:00
|
|
|
|
2018-11-30 13:33:49 +00:00
|
|
|
// display "Fixed Hz" at lower right, allowing space for a selection surrounding box
|
2018-11-23 10:34:37 +00:00
|
|
|
strcpy(msg, "Fixed Hz");
|
2018-11-29 11:11:50 +00:00
|
|
|
xPos = _display.width() - border; // set X position to finish short of RHS
|
2018-12-07 04:18:24 +00:00
|
|
|
_printMenuText(xPos, yPos, msg, _nModeSel == 1, eRightJustify);
|
2018-11-29 11:11:50 +00:00
|
|
|
|
2018-11-30 13:33:49 +00:00
|
|
|
// display "Thermostat" at lower left, allowing space for a selection surrounding box
|
2018-11-23 10:34:37 +00:00
|
|
|
strcpy(msg, "Thermostat");
|
2018-11-29 11:11:50 +00:00
|
|
|
xPos = border;
|
2018-12-07 04:18:24 +00:00
|
|
|
_printMenuText(xPos, yPos, msg, _nModeSel == 0);
|
2018-11-29 11:11:50 +00:00
|
|
|
|
2019-04-04 10:48:05 +00:00
|
|
|
// setThermostatMode(_nModeSel == 0 ? 1 : 0); // set the new mode
|
2018-11-23 10:34:37 +00:00
|
|
|
}
|
|
|
|
else {
|
2018-11-24 00:51:09 +00:00
|
|
|
// cancel selection mode, apply whatever is boxed
|
2019-04-10 23:00:36 +00:00
|
|
|
_showModeTime = 0;
|
|
|
|
_showSetModeTime = millis() + 5000; // then make the new mode setting be shown
|
2019-10-18 01:55:16 +00:00
|
|
|
_bShowOtherSensors = 0;
|
2019-04-10 23:00:36 +00:00
|
|
|
_feedbackType = 0;
|
|
|
|
_ScreenManager.reqUpdate();
|
2018-11-23 10:34:37 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-10 23:00:36 +00:00
|
|
|
if((_showModeTime == 0) && _showSetModeTime) {
|
2019-08-03 02:42:49 +00:00
|
|
|
showHeaderDetail(true);
|
2019-04-10 23:00:36 +00:00
|
|
|
long tDelta = millis() - _showSetModeTime;
|
2018-11-24 11:03:47 +00:00
|
|
|
if(tDelta < 0) {
|
2019-04-10 23:00:36 +00:00
|
|
|
switch(_feedbackType) {
|
|
|
|
case 0:
|
|
|
|
// Show current heat demand setting
|
|
|
|
|
2019-10-18 01:55:16 +00:00
|
|
|
if(getThermostatModeActive()) {
|
|
|
|
if(getExternalThermostatModeActive()) {
|
|
|
|
sprintf(msg, "External @ %.1fHz", getHeaterInfo().getPump_Fixed());
|
2019-04-10 23:00:36 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-10-18 01:55:16 +00:00
|
|
|
float fTemp = getTemperatureDesired();
|
|
|
|
if(NVstore.getUserSettings().degF) {
|
|
|
|
fTemp = fTemp * 9 / 5 + 32;
|
|
|
|
sprintf(msg, "Setpoint = %.0f`F", fTemp);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(msg, "Setpoint = %.0f`C", fTemp);
|
|
|
|
}
|
2019-04-10 23:00:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(msg, "Setpoint = %.1fHz", getHeaterInfo().getPump_Fixed());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
case 2:
|
2019-06-02 12:47:35 +00:00
|
|
|
sprintf(msg, "GPIO output #%d %s", _feedbackType, getGPIOout(_feedbackType-1) ? "ON" : "OFF");
|
2019-04-10 23:00:36 +00:00
|
|
|
break;
|
2018-11-23 10:34:37 +00:00
|
|
|
}
|
2018-11-24 00:51:09 +00:00
|
|
|
// centre message at bottom of screen
|
2018-12-07 04:18:24 +00:00
|
|
|
_printMenuText(_display.xCentre(), _display.height() - _display.textHeight(), msg, false, eCentreJustify);
|
2019-10-18 01:55:16 +00:00
|
|
|
|
2019-10-18 22:58:19 +00:00
|
|
|
int numSensors = getTempSensor().getNumSensors();
|
|
|
|
if(_bShowOtherSensors && numSensors > 1) {
|
2019-10-18 01:55:16 +00:00
|
|
|
bShowLargeTemp = false;
|
|
|
|
CTransientFont AF(_display, &arial_8ptFontInfo);
|
2019-10-18 22:58:19 +00:00
|
|
|
int yPos = numSensors == 4 ? 14 : 23;
|
2019-10-18 01:55:16 +00:00
|
|
|
if(getTempSensor().getTemperature(1, fTemp)) {
|
2019-10-18 22:58:19 +00:00
|
|
|
CTempSense::format(msg, fTemp);
|
2019-10-18 01:55:16 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
strcpy(msg, "---");
|
|
|
|
}
|
2019-10-18 22:58:19 +00:00
|
|
|
_printMenuText(50, yPos, "External:", false, eRightJustify);
|
|
|
|
_printMenuText(54, yPos, msg);
|
|
|
|
|
2019-10-18 01:55:16 +00:00
|
|
|
yPos += 13;
|
2019-10-18 22:58:19 +00:00
|
|
|
if(numSensors > 2) {
|
2019-10-18 01:55:16 +00:00
|
|
|
if(getTempSensor().getTemperature(2, fTemp)) {
|
2019-10-18 22:58:19 +00:00
|
|
|
CTempSense::format(msg, fTemp);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
strcpy(msg, "---");
|
|
|
|
}
|
|
|
|
_printMenuText(50, yPos, (numSensors == 3) ? "Aux:" : "Aux1:", false, eRightJustify);
|
|
|
|
_printMenuText(54, yPos, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
yPos += 13;
|
|
|
|
if(numSensors > 3) {
|
|
|
|
if(getTempSensor().getTemperature(3, fTemp)) {
|
|
|
|
CTempSense::format(msg, fTemp);
|
2019-10-18 01:55:16 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
strcpy(msg, "---");
|
|
|
|
}
|
2019-10-18 22:58:19 +00:00
|
|
|
_printMenuText(50, yPos, "Aux2:", false, eRightJustify);
|
|
|
|
_printMenuText(54, yPos, msg);
|
2019-10-18 01:55:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-24 00:51:09 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-04-10 23:00:36 +00:00
|
|
|
_showSetModeTime = 0;
|
2018-11-23 10:34:37 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-10 23:00:36 +00:00
|
|
|
if((_showModeTime == 0) && (_showSetModeTime == 0)) {
|
2018-11-25 04:45:17 +00:00
|
|
|
showRunState();
|
2019-08-03 02:42:49 +00:00
|
|
|
showHeaderDetail(false);
|
2018-11-24 00:51:09 +00:00
|
|
|
}
|
2019-10-18 01:55:16 +00:00
|
|
|
|
|
|
|
if(bShowLargeTemp) {
|
|
|
|
float fTemp = getTemperatureSensor(0); // Primary system sensor - the one used for thermostat modes
|
|
|
|
// float fTemp = getTemperatureSensor(0); // DHT22 or DS18B20
|
|
|
|
// fTemp = getTemperatureSensor(1); // BMP180
|
|
|
|
if(fTemp > -80) {
|
|
|
|
if(NVstore.getUserSettings().degF) {
|
|
|
|
fTemp = fTemp * 9 / 5 + 32;
|
|
|
|
sprintf(msg, "%.1f`F", fTemp);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(msg, "%.1f`C", fTemp);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
CTransientFont AF(_display, &MAXIFONT); // temporarily use a large font
|
|
|
|
_printMenuText(_display.xCentre(), 23, msg, false, eCentreJustify);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
_printMenuText(_display.xCentre(), 25, "No Temperature Sensor", false, eCentreJustify);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-18 23:06:12 +00:00
|
|
|
return true;
|
2018-11-23 10:34:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-18 23:06:12 +00:00
|
|
|
bool
|
2019-01-18 07:09:40 +00:00
|
|
|
CBasicScreen::keyHandler(uint8_t event)
|
2018-11-23 10:34:37 +00:00
|
|
|
{
|
|
|
|
static int repeatCount = -1;
|
2018-12-01 00:36:25 +00:00
|
|
|
|
2018-11-23 10:34:37 +00:00
|
|
|
if(event & keyPressed) {
|
|
|
|
repeatCount = 0; // unlock tracking of repeat events
|
|
|
|
}
|
2019-04-10 23:00:36 +00:00
|
|
|
|
|
|
|
//
|
2018-11-23 10:34:37 +00:00
|
|
|
// use repeat function for key hold detection
|
2019-04-10 23:00:36 +00:00
|
|
|
//
|
2018-11-23 10:34:37 +00:00
|
|
|
if(event & keyRepeat) {
|
|
|
|
if(repeatCount >= 0) {
|
|
|
|
repeatCount++;
|
2019-04-09 23:28:46 +00:00
|
|
|
// hold LEFT to toggle GPIO output #1
|
|
|
|
if(event & key_Left) {
|
|
|
|
if(repeatCount > 2) {
|
2019-06-02 12:47:35 +00:00
|
|
|
repeatCount = -1; // prevent double handling
|
|
|
|
if(toggleGPIOout(0)) { // toggle GPIO output #1
|
2019-10-18 01:55:16 +00:00
|
|
|
_showSetModeTime = millis() + 5000;
|
|
|
|
_bShowOtherSensors = 0;
|
2019-06-02 12:47:35 +00:00
|
|
|
_feedbackType = 1;
|
|
|
|
_ScreenManager.reqUpdate();
|
|
|
|
}
|
2019-04-09 23:28:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// hold RIGHT to toggle GPIO output #2
|
|
|
|
if(event & key_Right) {
|
|
|
|
if(repeatCount > 2) {
|
|
|
|
repeatCount = -1; // prevent double handling
|
2019-06-02 12:47:35 +00:00
|
|
|
if(toggleGPIOout(1)) { // toggle GPIO output #2
|
2019-10-18 01:55:16 +00:00
|
|
|
_showSetModeTime = millis() + 5000;
|
|
|
|
_bShowOtherSensors = 0;
|
2019-06-02 12:47:35 +00:00
|
|
|
_feedbackType = 2;
|
|
|
|
_ScreenManager.reqUpdate();
|
|
|
|
}
|
2019-04-09 23:28:46 +00:00
|
|
|
}
|
|
|
|
}
|
2018-11-23 10:34:37 +00:00
|
|
|
// hold DOWN to enter thermostat / fixed mode selection
|
|
|
|
if(event & key_Down) {
|
|
|
|
if(repeatCount > 2) {
|
|
|
|
repeatCount = -1; // prevent double handling
|
2019-09-15 02:51:51 +00:00
|
|
|
if(NVstore.getUserSettings().menuMode < 2) {
|
2019-09-07 13:48:46 +00:00
|
|
|
_showModeTime = millis() + 5000;
|
|
|
|
_nModeSel = getThermostatModeActive() ? 0 : 1;
|
|
|
|
}
|
2018-11-23 10:34:37 +00:00
|
|
|
}
|
|
|
|
}
|
2019-02-06 20:24:22 +00:00
|
|
|
// hold UP to toggle degC/degF mode selection
|
|
|
|
if(event & key_Up) {
|
|
|
|
if(repeatCount > 2) {
|
|
|
|
repeatCount = -1; // prevent double handling
|
2019-09-15 02:51:51 +00:00
|
|
|
if(NVstore.getUserSettings().menuMode < 2) {
|
2019-09-07 13:48:46 +00:00
|
|
|
_showModeTime = millis() + 5000;
|
|
|
|
}
|
2019-06-06 01:32:43 +00:00
|
|
|
sUserSettings settings = NVstore.getUserSettings();
|
|
|
|
toggle(settings.degF);
|
|
|
|
NVstore.setUserSettings(settings);
|
|
|
|
NVstore.save();
|
2019-02-06 20:24:22 +00:00
|
|
|
}
|
|
|
|
}
|
2018-11-23 10:34:37 +00:00
|
|
|
// hold CENTRE to turn ON or OFF
|
|
|
|
if(event & key_Centre) {
|
2019-09-15 02:51:51 +00:00
|
|
|
if(NVstore.getUserSettings().menuMode < 2) {
|
2019-09-07 13:48:46 +00:00
|
|
|
int runstate = getHeaterInfo().getRunStateEx();
|
2019-10-31 22:24:58 +00:00
|
|
|
if(runstate && !RTC_Store.getFrostOn()) { // running, including cyclic mode idle
|
2019-09-07 13:48:46 +00:00
|
|
|
if(repeatCount > 5) {
|
|
|
|
repeatCount = -1;
|
|
|
|
requestOff();
|
|
|
|
}
|
2018-11-23 10:34:37 +00:00
|
|
|
}
|
2019-09-07 13:48:46 +00:00
|
|
|
else { // standard idle state
|
|
|
|
// standby, request ON
|
|
|
|
if(repeatCount > 3) {
|
|
|
|
repeatCount = -1;
|
|
|
|
requestOn();
|
|
|
|
}
|
2018-11-23 10:34:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-10 23:00:36 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// key released handling
|
|
|
|
//
|
2018-11-23 10:34:37 +00:00
|
|
|
if(event & keyReleased) {
|
2019-04-10 23:00:36 +00:00
|
|
|
if(!_showModeTime) {
|
2018-11-23 10:34:37 +00:00
|
|
|
// release DOWN key to reduce set demand, provided we are not in mode select
|
2019-09-15 02:51:51 +00:00
|
|
|
if(NVstore.getUserSettings().menuMode < 2) {
|
2019-09-07 13:48:46 +00:00
|
|
|
if(event & key_Down) {
|
|
|
|
if(reqDemandDelta(-1)) {
|
2019-10-18 01:55:16 +00:00
|
|
|
_showSetModeTime = millis() + 5000;
|
|
|
|
_bShowOtherSensors = 0;
|
2019-09-07 13:48:46 +00:00
|
|
|
_feedbackType = 0;
|
|
|
|
_ScreenManager.reqUpdate();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_reqOEMWarning();
|
2019-04-10 23:00:36 +00:00
|
|
|
}
|
2019-09-07 13:48:46 +00:00
|
|
|
// release UP key to increase set demand, provided we are not in mode select
|
|
|
|
if(event & key_Up) {
|
|
|
|
if(reqDemandDelta(+1)) {
|
2019-10-18 01:55:16 +00:00
|
|
|
_showSetModeTime = millis() + 5000;
|
|
|
|
_bShowOtherSensors = 0;
|
2019-09-07 13:48:46 +00:00
|
|
|
_feedbackType = 0;
|
|
|
|
_ScreenManager.reqUpdate();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_reqOEMWarning();
|
2019-04-10 23:00:36 +00:00
|
|
|
}
|
2018-11-23 10:34:37 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-09 23:28:46 +00:00
|
|
|
if(event & key_Left) {
|
|
|
|
if(repeatCount >= 0) {
|
2019-04-10 23:00:36 +00:00
|
|
|
if(!_showModeTime) {
|
2019-04-09 23:28:46 +00:00
|
|
|
_ScreenManager.prevMenu();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(hasOEMcontroller())
|
|
|
|
_reqOEMWarning();
|
|
|
|
else {
|
2019-04-10 23:00:36 +00:00
|
|
|
_showModeTime = millis() + 5000;
|
2019-04-09 23:28:46 +00:00
|
|
|
_nModeSel = 0;
|
|
|
|
setThermostatMode(1); // set the new mode
|
|
|
|
NVstore.save();
|
|
|
|
}
|
|
|
|
_ScreenManager.reqUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(event & key_Right) {
|
|
|
|
if(repeatCount >= 0) {
|
2019-04-10 23:00:36 +00:00
|
|
|
if(!_showModeTime)
|
2019-04-09 23:28:46 +00:00
|
|
|
_ScreenManager.nextMenu();
|
|
|
|
else {
|
|
|
|
if(hasOEMcontroller())
|
|
|
|
_reqOEMWarning();
|
|
|
|
else {
|
2019-04-10 23:00:36 +00:00
|
|
|
_showModeTime = millis() + 5000;
|
2019-04-09 23:28:46 +00:00
|
|
|
_nModeSel = 1;
|
|
|
|
setThermostatMode(0); // set the new mode
|
|
|
|
NVstore.save();
|
|
|
|
}
|
|
|
|
_ScreenManager.reqUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-11-24 00:51:09 +00:00
|
|
|
// release CENTRE to accept new mode, and/or show current setting
|
|
|
|
if(event & key_Centre) {
|
2019-09-15 02:51:51 +00:00
|
|
|
if(NVstore.getUserSettings().menuMode < 2) {
|
2019-09-07 13:48:46 +00:00
|
|
|
if(repeatCount != -2) { // prevent after off commands
|
|
|
|
if(_showModeTime) {
|
|
|
|
_showModeTime = millis(); // force immediate cancellation of showmode (via screen update)
|
|
|
|
}
|
2019-10-18 01:55:16 +00:00
|
|
|
_showSetModeTime = millis() + 5000;
|
|
|
|
_bShowOtherSensors = 1;
|
2019-09-07 13:48:46 +00:00
|
|
|
_feedbackType = 0;
|
2018-11-24 00:51:09 +00:00
|
|
|
}
|
2019-09-07 13:48:46 +00:00
|
|
|
_ScreenManager.reqUpdate();
|
2018-11-24 00:51:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-23 10:34:37 +00:00
|
|
|
repeatCount = -1;
|
|
|
|
}
|
2019-01-18 23:06:12 +00:00
|
|
|
return true;
|
2018-11-23 10:34:37 +00:00
|
|
|
}
|
2018-11-24 00:51:09 +00:00
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
void
|
2019-01-18 07:09:40 +00:00
|
|
|
CBasicScreen::showRunState()
|
2018-11-24 00:51:09 +00:00
|
|
|
{
|
2019-09-15 02:51:51 +00:00
|
|
|
if(NVstore.getUserSettings().menuMode == 2)
|
2019-09-07 13:48:46 +00:00
|
|
|
return;
|
|
|
|
|
2019-04-04 19:39:58 +00:00
|
|
|
int runstate = getHeaterInfo().getRunStateEx();
|
2018-12-01 00:36:25 +00:00
|
|
|
int errstate = getHeaterInfo().getErrState();
|
2018-11-24 00:51:09 +00:00
|
|
|
|
|
|
|
if(errstate) errstate--; // correct for +1 biased return value
|
|
|
|
|
|
|
|
static bool toggle = false;
|
|
|
|
const char* toPrint = NULL;
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.setTextColor(WHITE, BLACK);
|
2019-04-04 19:39:58 +00:00
|
|
|
if(errstate && ((runstate == 0) || (runstate > 5))) {
|
2018-12-01 18:25:10 +00:00
|
|
|
|
2019-04-06 10:45:25 +00:00
|
|
|
// flash error code
|
|
|
|
char msg[16];
|
|
|
|
toggle = !toggle;
|
|
|
|
if(toggle) {
|
|
|
|
// create an "E-XX" message to display
|
|
|
|
sprintf(msg, "E-%02d", errstate);
|
2018-11-24 00:51:09 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-04-06 10:45:25 +00:00
|
|
|
strcpy(msg, " ");
|
|
|
|
}
|
|
|
|
int xPos = _display.xCentre();
|
|
|
|
int yPos = _display.height() - 2*_display.textHeight();
|
|
|
|
_printMenuText(xPos, yPos, msg, false, eCentreJustify);
|
|
|
|
|
|
|
|
toPrint = getHeaterInfo().getErrStateStr();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(runstate) {
|
|
|
|
toPrint = getHeaterInfo().getRunStateStr();
|
|
|
|
// simplify starting states
|
|
|
|
switch(runstate) {
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
toPrint = "Starting";
|
|
|
|
break;
|
2019-04-04 10:48:05 +00:00
|
|
|
}
|
2019-04-06 10:45:25 +00:00
|
|
|
}
|
2018-11-24 00:51:09 +00:00
|
|
|
}
|
|
|
|
if(toPrint) {
|
2018-12-01 18:25:10 +00:00
|
|
|
// locate at bottom centre
|
2018-12-07 04:18:24 +00:00
|
|
|
_printMenuText(_display.xCentre(), _display.height() - _display.textHeight(), toPrint, false, eCentreJustify);
|
2018-11-24 00:51:09 +00:00
|
|
|
}
|
2018-11-25 04:45:17 +00:00
|
|
|
}
|