2018-11-26 11:58:15 +00:00
|
|
|
/*
|
|
|
|
* 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/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-11-22 10:30:51 +00:00
|
|
|
#include "128x64OLED.h"
|
2018-12-16 07:34:39 +00:00
|
|
|
#include "fonts/MiniFont.h"
|
|
|
|
#include "fonts/Icons.h"
|
|
|
|
#include "../Bluetooth/BluetoothAbstract.h"
|
2018-11-22 10:30:51 +00:00
|
|
|
#include "Screen1.h"
|
2018-12-16 07:34:39 +00:00
|
|
|
#include "../Wifi/BTCWifi.h"
|
2018-11-22 10:30:51 +00:00
|
|
|
#include "KeyPad.h"
|
2018-12-16 07:34:39 +00:00
|
|
|
#include "../Protocol/helpers.h"
|
|
|
|
#include "../Protocol/Protocol.h"
|
2018-11-22 10:30:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define MINIFONT miniFontInfo
|
|
|
|
|
|
|
|
#define X_FAN_ICON 55
|
|
|
|
#define Y_FAN_ICON 39
|
|
|
|
#define X_FUEL_ICON 81
|
|
|
|
#define Y_FUEL_ICON 39
|
|
|
|
#define X_TARGET_ICON 31
|
|
|
|
#define Y_TARGET_ICON 39
|
2018-11-24 11:03:47 +00:00
|
|
|
#define Y_BASELINE 58
|
2018-11-22 10:30:51 +00:00
|
|
|
#define X_GLOW_ICON 97
|
|
|
|
#define Y_GLOW_ICON 38
|
|
|
|
#define X_BODY_BULB 119
|
2018-11-24 11:03:47 +00:00
|
|
|
#define X_BULB 1 // >= 1
|
|
|
|
#define Y_BULB 4
|
2018-11-22 10:30:51 +00:00
|
|
|
|
|
|
|
#define MINI_TEMPLABEL
|
|
|
|
#define MINI_TARGETLABEL
|
|
|
|
#define MINI_FANLABEL
|
|
|
|
#define MINI_GLOWLABEL
|
|
|
|
#define MINI_FUELLABEL
|
|
|
|
#define MINI_BODYLABEL
|
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// CScreen1
|
|
|
|
//
|
|
|
|
// This screen provides a detailed control/status function
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
CScreen1::CScreen1(C128x64_OLED& display, CScreenManager& mgr) : CScreenHeader(display, mgr)
|
2018-11-25 04:45:17 +00:00
|
|
|
{
|
|
|
|
_animatePump = false;
|
|
|
|
_animateRPM = false;
|
|
|
|
_animateGlow = false;
|
|
|
|
_fanAnimationState = 0;
|
|
|
|
_dripAnimationState = 0;
|
|
|
|
_heatAnimationState = 0;
|
|
|
|
_keyRepeatCount = -1;
|
|
|
|
_showTarget = 0;
|
|
|
|
}
|
2018-11-22 10:30:51 +00:00
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
|
|
|
|
void
|
2018-12-01 00:36:25 +00:00
|
|
|
CScreen1::show()
|
2018-11-22 10:30:51 +00:00
|
|
|
{
|
2018-12-01 00:36:25 +00:00
|
|
|
CScreenHeader::show();
|
2018-11-25 04:45:17 +00:00
|
|
|
|
|
|
|
const char* c = String(getActualTemperature()).c_str();
|
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
int runstate = getHeaterInfo().getRunState();//HtrFrame.getRunState();
|
|
|
|
int errstate = getHeaterInfo().getErrState(); //HtrFrame.getErrState();
|
2018-11-22 10:30:51 +00:00
|
|
|
if(errstate) errstate--; // correct for +1 biased return value
|
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
long tDelta = millis() - _showTarget;
|
|
|
|
if(_showTarget && (tDelta > 0)) {
|
|
|
|
_showTarget = 0;
|
2018-11-24 11:03:47 +00:00
|
|
|
}
|
|
|
|
|
2018-11-22 10:30:51 +00:00
|
|
|
float desiredT = 0;
|
2018-11-25 04:45:17 +00:00
|
|
|
if((runstate && (runstate <= 5)) || _showTarget) {
|
2018-12-01 00:36:25 +00:00
|
|
|
if(getHeaterInfo().isThermostat())
|
|
|
|
desiredT = getHeaterInfo().getTemperature_Desired();
|
2018-11-22 10:30:51 +00:00
|
|
|
else
|
2018-12-01 00:36:25 +00:00
|
|
|
desiredT = -getHeaterInfo().getPump_Fixed();
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
|
2019-01-11 05:40:25 +00:00
|
|
|
float fTemp = getActualTemperature();
|
2018-11-25 04:45:17 +00:00
|
|
|
showThermometer(desiredT, // read values from most recently sent [BTC] frame
|
2019-01-11 05:40:25 +00:00
|
|
|
fTemp);
|
2018-11-22 10:30:51 +00:00
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
_animateRPM = false;
|
|
|
|
_animatePump = false;
|
|
|
|
_animateGlow = false;
|
2018-11-22 10:30:51 +00:00
|
|
|
|
|
|
|
if(runstate) {
|
2018-12-01 00:36:25 +00:00
|
|
|
float power = getHeaterInfo().getGlowPlug_Power();
|
2018-11-22 10:30:51 +00:00
|
|
|
if(power > 1) {
|
2018-11-28 11:15:23 +00:00
|
|
|
showGlowPlug(power);
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
showFan(getHeaterInfo().getFan_Actual());
|
2018-11-22 10:30:51 +00:00
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
showFuel(getHeaterInfo().getPump_Actual());
|
2018-11-22 10:30:51 +00:00
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
showBodyThermometer(getHeaterInfo().getTemperature_HeatExchg());
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
showRunState(runstate, errstate);
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-12-01 18:25:10 +00:00
|
|
|
bool
|
2018-11-25 04:45:17 +00:00
|
|
|
CScreen1::animate()
|
2018-11-22 10:30:51 +00:00
|
|
|
{
|
2018-12-01 18:25:10 +00:00
|
|
|
bool retval = CScreenHeader::animate();
|
2018-11-22 10:30:51 +00:00
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
if(_animatePump || _animateRPM || _animateGlow) {
|
2018-11-22 10:30:51 +00:00
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
if(_animatePump) {
|
2018-11-22 10:30:51 +00:00
|
|
|
// erase region of fuel icon
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.fillRect(X_FUEL_ICON, Y_FUEL_ICON, W_FUEL_ICON, H_FUEL_ICON + 4, BLACK);
|
|
|
|
_display.drawBitmap(X_FUEL_ICON, Y_FUEL_ICON+(_dripAnimationState/2), FuelIcon, W_FUEL_ICON, H_FUEL_ICON, WHITE);
|
|
|
|
_dripAnimationState++;
|
|
|
|
_dripAnimationState &= 0x07;
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
if(_animateRPM) {
|
2018-11-22 10:30:51 +00:00
|
|
|
// erase region of fuel icon
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.fillRect(X_FAN_ICON, Y_FAN_ICON, W_FAN_ICON, H_FAN_ICON, BLACK);
|
|
|
|
switch(_fanAnimationState) {
|
|
|
|
case 0: _display.drawBitmap(X_FAN_ICON, Y_FAN_ICON, FanIcon1, W_FAN_ICON, H_FAN_ICON, WHITE); break;
|
|
|
|
case 1: _display.drawBitmap(X_FAN_ICON, Y_FAN_ICON, FanIcon2, W_FAN_ICON, H_FAN_ICON, WHITE); break;
|
|
|
|
case 2: _display.drawBitmap(X_FAN_ICON, Y_FAN_ICON, FanIcon3, W_FAN_ICON, H_FAN_ICON, WHITE); break;
|
|
|
|
case 3: _display.drawBitmap(X_FAN_ICON, Y_FAN_ICON, FanIcon4, W_FAN_ICON, H_FAN_ICON, WHITE); break;
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
2018-11-25 04:45:17 +00:00
|
|
|
_fanAnimationState++;
|
|
|
|
_fanAnimationState &= 0x03;
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
if(_animateGlow) {
|
|
|
|
_display.fillRect(X_GLOW_ICON, Y_GLOW_ICON, 17, 10, BLACK);
|
|
|
|
_display.drawBitmap(X_GLOW_ICON, Y_GLOW_ICON, GlowPlugIcon, 16, 9, WHITE);
|
|
|
|
_display.drawBitmap(X_GLOW_ICON, Y_GLOW_ICON + 2 + _heatAnimationState, GlowHeatIcon, 17, 2, WHITE);
|
|
|
|
_heatAnimationState -= 2;
|
|
|
|
_heatAnimationState &= 0x07;
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
2018-12-20 06:29:00 +00:00
|
|
|
|
|
|
|
retval = true;
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
2018-12-20 06:29:00 +00:00
|
|
|
retval |= CScreen::animate();
|
2018-12-01 18:25:10 +00:00
|
|
|
return retval;
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
void
|
|
|
|
CScreen1::keyHandler(uint8_t event)
|
2018-11-24 11:03:47 +00:00
|
|
|
{
|
2018-12-01 00:36:25 +00:00
|
|
|
|
2018-11-24 11:03:47 +00:00
|
|
|
if(event & keyPressed) {
|
2018-11-25 04:45:17 +00:00
|
|
|
_keyRepeatCount = 0; // unlock tracking of repeat events
|
2018-11-24 11:03:47 +00:00
|
|
|
if(event & key_Left) {
|
2018-11-29 11:11:50 +00:00
|
|
|
_ScreenManager.prevScreen();
|
2018-11-24 11:03:47 +00:00
|
|
|
}
|
|
|
|
if(event & key_Right) {
|
2018-11-29 11:11:50 +00:00
|
|
|
_ScreenManager.nextScreen();
|
2018-11-24 11:03:47 +00:00
|
|
|
}
|
|
|
|
if(event & key_Up) {
|
2018-12-20 06:29:00 +00:00
|
|
|
if(reqTempDelta(+1))
|
|
|
|
_showTarget = millis() + 3500;
|
|
|
|
else
|
|
|
|
_reqOEMWarning();
|
2018-11-24 11:03:47 +00:00
|
|
|
}
|
|
|
|
if(event & key_Down) {
|
2018-12-20 06:29:00 +00:00
|
|
|
if(reqTempDelta(-1))
|
|
|
|
_showTarget = millis() + 3500;
|
|
|
|
else
|
|
|
|
_reqOEMWarning();
|
2018-11-24 11:03:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// require hold to turn ON or OFF
|
|
|
|
if(event & keyRepeat) {
|
2018-11-25 04:45:17 +00:00
|
|
|
if(_keyRepeatCount >= 0) {
|
|
|
|
_keyRepeatCount++;
|
2018-11-24 11:03:47 +00:00
|
|
|
if(event & key_Centre) {
|
2018-12-01 00:36:25 +00:00
|
|
|
if(getHeaterInfo().getRunState()) {
|
2018-11-25 04:45:17 +00:00
|
|
|
if(_keyRepeatCount > 5) {
|
|
|
|
_keyRepeatCount = -1; // prevent double handling
|
2018-11-24 11:03:47 +00:00
|
|
|
requestOff();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2018-11-25 04:45:17 +00:00
|
|
|
if(_keyRepeatCount > 3) {
|
|
|
|
_keyRepeatCount = -1;
|
2018-11-24 11:03:47 +00:00
|
|
|
requestOn();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-11-25 04:45:17 +00:00
|
|
|
// release event
|
2018-11-24 11:03:47 +00:00
|
|
|
if(event & keyReleased) {
|
2018-11-25 04:45:17 +00:00
|
|
|
_keyRepeatCount = -1;
|
2018-11-24 11:03:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-12-09 03:00:40 +00:00
|
|
|
#define TEMP_YPOS(A) ((20 - int(A)) + 27) // 26 is location of 20deg tick
|
2018-11-25 04:45:17 +00:00
|
|
|
void
|
|
|
|
CScreen1::showThermometer(float desired, float actual)
|
2018-11-22 10:30:51 +00:00
|
|
|
{
|
|
|
|
char msg[16];
|
|
|
|
// draw bulb design
|
2018-12-09 03:00:40 +00:00
|
|
|
_display.drawBitmap(X_BULB, Y_BULB, ambientThermometerIcon, W_BULB_ICON, H_BULB_ICON, WHITE);
|
2019-01-11 05:40:25 +00:00
|
|
|
|
|
|
|
if(actual > 0) {
|
|
|
|
// draw mercury
|
|
|
|
int yPos = Y_BULB + TEMP_YPOS(actual);
|
|
|
|
_display.drawLine(X_BULB + 3, yPos, X_BULB + 3, Y_BULB + 42, WHITE);
|
|
|
|
_display.drawLine(X_BULB + 4, yPos, X_BULB + 4, Y_BULB + 42, WHITE);
|
|
|
|
}
|
2018-11-22 10:30:51 +00:00
|
|
|
// print actual temperature
|
2019-01-11 05:40:25 +00:00
|
|
|
if(actual > -80) {
|
2018-11-22 10:30:51 +00:00
|
|
|
#ifdef MINI_TEMPLABEL
|
2018-12-01 00:36:25 +00:00
|
|
|
CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font
|
2018-11-29 11:11:50 +00:00
|
|
|
sprintf(msg, "%.1f`C", actual);
|
2018-11-22 10:30:51 +00:00
|
|
|
#else
|
2018-11-29 11:11:50 +00:00
|
|
|
sprintf(msg, "%.1f", actual);
|
2018-11-22 10:30:51 +00:00
|
|
|
#endif
|
2018-12-07 04:18:24 +00:00
|
|
|
_printMenuText(0, Y_BASELINE, msg);
|
2018-11-29 11:11:50 +00:00
|
|
|
}
|
2019-01-11 05:40:25 +00:00
|
|
|
else {
|
|
|
|
_printInverted(1, Y_BASELINE-2, "N/A", true);
|
|
|
|
}
|
2018-11-22 10:30:51 +00:00
|
|
|
|
2018-11-24 11:03:47 +00:00
|
|
|
// draw target setting
|
2018-11-22 10:30:51 +00:00
|
|
|
if(desired) {
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.drawBitmap(X_TARGET_ICON, Y_TARGET_ICON, TargetIcon, W_TARGET_ICON, H_TARGET_ICON, WHITE); // set indicator against bulb
|
2018-11-22 10:30:51 +00:00
|
|
|
char msg[16];
|
|
|
|
if(desired > 0) {
|
|
|
|
int yPos = Y_BULB + TEMP_YPOS(desired) - 2;
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.drawBitmap(X_BULB-1, yPos, thermoPtr, 3, 5, WHITE); // set indicator against bulb
|
2018-11-22 10:30:51 +00:00
|
|
|
sprintf(msg, "%.0f`C", desired);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(msg, "%.1fHz", -desired);
|
|
|
|
}
|
|
|
|
#ifdef MINI_TARGETLABEL
|
2018-12-01 00:36:25 +00:00
|
|
|
CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font
|
2018-11-22 10:30:51 +00:00
|
|
|
#endif
|
2018-12-07 04:18:24 +00:00
|
|
|
_printMenuText(X_TARGET_ICON + (W_TARGET_ICON/2), Y_BASELINE, msg, false, eCentreJustify);
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#define BODY_YPOS(A) ((((100 - A) * 3) / 16) + 22) // 100degC centre - ticks +- 80C
|
2018-11-25 04:45:17 +00:00
|
|
|
void
|
|
|
|
CScreen1::showBodyThermometer(int actual)
|
2018-11-22 10:30:51 +00:00
|
|
|
{
|
|
|
|
// draw bulb design
|
2018-12-09 03:00:40 +00:00
|
|
|
_display.drawBitmap(X_BODY_BULB, Y_BULB, bodyThermometerIcon, 8, 50, WHITE);
|
2018-11-22 10:30:51 +00:00
|
|
|
// draw mercury
|
|
|
|
int yPos = Y_BULB + BODY_YPOS(actual);
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.drawLine(X_BODY_BULB + 3, yPos, X_BODY_BULB + 3, Y_BULB + 42, WHITE);
|
|
|
|
_display.drawLine(X_BODY_BULB + 4, yPos, X_BODY_BULB + 4, Y_BULB + 42, WHITE);
|
2018-11-22 10:30:51 +00:00
|
|
|
// print actual temperature
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.setTextColor(WHITE);
|
2018-11-22 10:30:51 +00:00
|
|
|
char label[16];
|
|
|
|
// determine width and position right justified
|
|
|
|
#ifdef MINI_BODYLABEL
|
2018-12-01 00:36:25 +00:00
|
|
|
CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font
|
2018-11-22 10:30:51 +00:00
|
|
|
sprintf(label, "%d`C", actual);
|
|
|
|
#else
|
|
|
|
sprintf(label, "%d", actual);
|
|
|
|
#endif
|
2018-12-07 04:18:24 +00:00
|
|
|
_printMenuText(_display.width(), Y_BASELINE, label, false, eRightJustify);
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
void
|
2018-11-28 11:15:23 +00:00
|
|
|
CScreen1::showGlowPlug(float power)
|
2018-11-22 10:30:51 +00:00
|
|
|
{
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.drawBitmap(X_GLOW_ICON, Y_GLOW_ICON, GlowPlugIcon, W_GLOW_ICON, H_GLOW_ICON, WHITE);
|
|
|
|
// _animateGlow = true;
|
2018-11-22 10:30:51 +00:00
|
|
|
char msg[16];
|
2018-11-28 11:15:23 +00:00
|
|
|
sprintf(msg, "%.0fW", power);
|
2018-11-24 00:51:09 +00:00
|
|
|
#ifdef MINI_GLOWLABEL
|
2018-12-01 00:36:25 +00:00
|
|
|
CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font
|
2018-11-22 10:30:51 +00:00
|
|
|
#endif
|
2018-12-07 04:18:24 +00:00
|
|
|
_printMenuText(X_GLOW_ICON + (W_GLOW_ICON/2),
|
2018-11-30 13:33:49 +00:00
|
|
|
Y_GLOW_ICON + H_GLOW_ICON + 3,
|
|
|
|
msg, false, eCentreJustify);
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
void
|
|
|
|
CScreen1::showFan(int RPM)
|
2018-11-22 10:30:51 +00:00
|
|
|
{
|
|
|
|
// NOTE: fan rotation animation performed in animateOLED
|
2018-11-25 04:45:17 +00:00
|
|
|
_animateRPM = RPM != 0; // used by animation routine
|
2018-11-22 10:30:51 +00:00
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.setTextColor(WHITE);
|
2018-11-22 10:30:51 +00:00
|
|
|
char msg[16];
|
|
|
|
sprintf(msg, "%d", RPM);
|
|
|
|
#ifdef MINI_FANLABEL
|
2018-12-01 00:36:25 +00:00
|
|
|
CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font
|
2018-11-22 10:30:51 +00:00
|
|
|
#endif
|
2018-12-07 04:18:24 +00:00
|
|
|
_printMenuText(X_FAN_ICON + (W_FAN_ICON/2), Y_BASELINE, msg, false, eCentreJustify);
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
void
|
|
|
|
CScreen1::showFuel(float rate)
|
2018-11-22 10:30:51 +00:00
|
|
|
{
|
|
|
|
// NOTE: fuel drop animation performed in animateOLED
|
2018-11-25 04:45:17 +00:00
|
|
|
_animatePump = rate != 0; // used by animation routine
|
2018-11-22 10:30:51 +00:00
|
|
|
if(rate) {
|
|
|
|
char msg[16];
|
|
|
|
sprintf(msg, "%.1f", rate);
|
|
|
|
#ifdef MINI_FUELLABEL
|
2018-12-01 00:36:25 +00:00
|
|
|
CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font
|
2018-11-22 10:30:51 +00:00
|
|
|
#endif
|
2018-12-07 04:18:24 +00:00
|
|
|
_printMenuText(X_FUEL_ICON + (W_FUEL_ICON/2), Y_BASELINE, msg, false, eCentreJustify);
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
void
|
|
|
|
CScreen1::showRunState(int runstate, int errstate)
|
2018-11-22 10:30:51 +00:00
|
|
|
{
|
|
|
|
static bool toggle = false;
|
|
|
|
const char* toPrint = NULL;
|
|
|
|
int yPos = 25;
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.setTextColor(WHITE, BLACK);
|
2018-11-22 10:30:51 +00:00
|
|
|
if(runstate >= 0 && runstate <= 8) {
|
|
|
|
if(((runstate == 0) || (runstate > 5)) && errstate) {
|
|
|
|
// create an "E-XX" message to display
|
|
|
|
char msg[16];
|
|
|
|
sprintf(msg, "E-%02d", errstate);
|
|
|
|
if(runstate > 5)
|
2018-12-01 18:25:10 +00:00
|
|
|
yPos -= _display.textHeight();
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.setCursor(_display.xCentre(), yPos);
|
2018-11-22 10:30:51 +00:00
|
|
|
// flash error code
|
|
|
|
toggle = !toggle;
|
|
|
|
if(toggle)
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.printCentreJustified(msg);
|
2018-11-22 10:30:51 +00:00
|
|
|
else {
|
2018-11-25 04:45:17 +00:00
|
|
|
_display.printCentreJustified(" ");
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
2018-12-01 18:25:10 +00:00
|
|
|
yPos += _display.textHeight();
|
|
|
|
toPrint = getHeaterInfo().getErrStateStr();
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
else {
|
2018-12-01 18:25:10 +00:00
|
|
|
toPrint = getHeaterInfo().getRunStateStr();
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(toPrint) {
|
2018-12-07 04:18:24 +00:00
|
|
|
_printMenuText(_display.xCentre(), yPos, toPrint, false, eCentreJustify);
|
2018-11-22 10:30:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-25 04:45:17 +00:00
|
|
|
|