diff --git a/Arduino/BTCDieselHeater/BTCDieselHeater.ino b/Arduino/BTCDieselHeater/BTCDieselHeater.ino
index 66d0b54..36299b0 100644
--- a/Arduino/BTCDieselHeater/BTCDieselHeater.ino
+++ b/Arduino/BTCDieselHeater/BTCDieselHeater.ino
@@ -681,7 +681,8 @@ void loop()
fFilteredTemperature = fFilteredTemperature * fAlpha + (1-fAlpha) * fTemperature;
DefaultBTCParams.setTemperature_Actual((unsigned char)(fFilteredTemperature + 0.5)); // update [BTC] frame to send
TempSensor.requestTemperatures(); // prep sensor for future reading
- reqDisplayUpdate();
+// reqDisplayUpdate();
+ ScreenManager.reqUpdate();
}
CommState.set(CommStates::Idle);
break;
@@ -875,7 +876,8 @@ void reqTempChange(int val)
pNVStorage->setTemperature(curTemp);
- reqDisplayUpdate();
+// reqDisplayUpdate();
+ ScreenManager.reqUpdate();
}
int getSetTemp()
@@ -887,7 +889,7 @@ int getSetTemp()
float getFixedHz()
{
if(pRxFrame) {
- return float(pRxFrame->getPump_Fixed()) / 10.f;
+ return pRxFrame->getPump_Fixed();
}
return 0.0;
}
@@ -909,19 +911,22 @@ bool getThermostatMode()
return pNVStorage->getThermostatMode() != 0;
}
-void reqDisplayUpdate()
+/*void reqDisplayUpdate()
{
bUpdateDisplay = true;
-}
+}*/
void checkDisplayUpdate()
{
// only update OLED when not processing blue wire
- if(bUpdateDisplay) {
+/* if(bUpdateDisplay) {
if(pTxFrame && pRxFrame) {
ScreenManager.update(*pTxFrame, *pRxFrame);
bUpdateDisplay = false;
}
+ }*/
+ if(pTxFrame && pRxFrame) {
+ ScreenManager.checkUpdate(*pTxFrame, *pRxFrame);
}
long tDelta = millis() - lastAnimationTime;
@@ -939,7 +944,7 @@ void reqPumpPrime(bool on)
float getPumpHz()
{
if(pRxFrame) {
- return float(pRxFrame->getPump_Actual()) / 10.f;
+ return pRxFrame->getPump_Actual();
}
return 0.0;
}
diff --git a/Arduino/BTCDieselHeater/Index.h b/Arduino/BTCDieselHeater/Index.h
index 13f7d07..ee1cccb 100644
--- a/Arduino/BTCDieselHeater/Index.h
+++ b/Arduino/BTCDieselHeater/Index.h
@@ -20,148 +20,5 @@
*
*/
-const char MAIN_PAGE[] PROGMEM = R"=====(
-
-
-
-
-
-
-
-Chinese Diesel Heater Web Controller Interface
-
-
-
-Chinese Diesel Heater Web Control
-OFF ON
-
-Heater Is ON
-
-
Temperature Control
-
-
-
-
Desired Temp:
-
-
-
-
Current Temp:
-
-
-
-
-
-
-
-
-)=====";
\ No newline at end of file
diff --git a/Arduino/BTCDieselHeater/Protocol.h b/Arduino/BTCDieselHeater/Protocol.h
index c2af688..03b7654 100644
--- a/Arduino/BTCDieselHeater/Protocol.h
+++ b/Arduino/BTCDieselHeater/Protocol.h
@@ -165,10 +165,10 @@ public:
void setPump_Max(unsigned short Freq) { Controller.MaxPumpFreq = Freq; };
void setPump_Actual(unsigned char Freq) { Heater.ActualPumpFreq = Freq; };
void setPump_Fixed(unsigned char Freq) { Heater.FixedPumpFreq = Freq; };
- unsigned char getPump_Min() const { return Controller.MinPumpFreq; }; // Tx side, min pump freq
- unsigned char getPump_Max() const { return Controller.MaxPumpFreq; }; // Tx side, max pump freq
- unsigned char getPump_Actual() const { return Heater.ActualPumpFreq; }; // Rx style, actual
- unsigned char getPump_Fixed() const { return Heater.FixedPumpFreq; }; // Fixed mode pump frequency
+ float getPump_Min() const { return float(Controller.MinPumpFreq) * 0.1f; }; // Tx side, min pump freq
+ float getPump_Max() const { return float(Controller.MaxPumpFreq) * 0.1f; }; // Tx side, max pump freq
+ float getPump_Actual() const { return float(Heater.ActualPumpFreq) * 0.1f; }; // Rx style, actual
+ float getPump_Fixed() const { return float(Heater.FixedPumpFreq) * 0.1f; }; // Fixed mode pump frequency
void setPump_Prime(bool on) { Controller.Prime = on ? 0x5A : 0; };
// temperature set/get
void setTemperature_Desired(unsigned char degC) { Controller.DesiredTemperature = degC; };
diff --git a/Arduino/BTCDieselHeater/Screen1.cpp b/Arduino/BTCDieselHeater/Screen1.cpp
index 0b38b4d..77204bb 100644
--- a/Arduino/BTCDieselHeater/Screen1.cpp
+++ b/Arduino/BTCDieselHeater/Screen1.cpp
@@ -90,7 +90,7 @@ CScreen1::show(const CProtocol& CtlFrame, const CProtocol& HtrFrame)
if(CtlFrame.isThermostat())
desiredT = CtlFrame.getTemperature_Desired();
else
- desiredT = -HtrFrame.getPump_Fixed() * 0.1f;
+ desiredT = -HtrFrame.getPump_Fixed();
}
showThermometer(desiredT, // read values from most recently sent [BTC] frame
@@ -108,7 +108,7 @@ CScreen1::show(const CProtocol& CtlFrame, const CProtocol& HtrFrame)
showFan(HtrFrame.getFan_Actual());
- showFuel(HtrFrame.getPump_Actual() * 0.1f);
+ showFuel(HtrFrame.getPump_Actual());
showBodyThermometer(HtrFrame.getTemperature_HeatExchg());
}
diff --git a/Arduino/BTCDieselHeater/Screen2.cpp b/Arduino/BTCDieselHeater/Screen2.cpp
index 4fa0658..79f9d31 100644
--- a/Arduino/BTCDieselHeater/Screen2.cpp
+++ b/Arduino/BTCDieselHeater/Screen2.cpp
@@ -133,6 +133,13 @@ CScreen2::show(const CProtocol& CtlFrame, const CProtocol& HtrFrame)
}
+void
+CScreen2::animate()
+{
+ // do nothing!!
+};
+
+
void
CScreen2::keyHandler(uint8_t event)
{
@@ -146,7 +153,8 @@ CScreen2::keyHandler(uint8_t event)
else {
_showMode = millis() + 5000;
_nModeSel = 0;
- reqDisplayUpdate();
+// reqDisplayUpdate();
+ _Manager.reqUpdate();
}
}
// press RIGHT to selecxt next screen, or Thermostat mode when in mode select
@@ -156,7 +164,8 @@ CScreen2::keyHandler(uint8_t event)
else {
_showMode = millis() + 5000;
_nModeSel = 1;
- reqDisplayUpdate();
+// reqDisplayUpdate();
+ _Manager.reqUpdate();
}
}
// press UP & DOWN to toggle thermostat / fixed Hz mode
@@ -219,7 +228,8 @@ CScreen2::keyHandler(uint8_t event)
}
_showSetMode = millis() + 2000;
}
- reqDisplayUpdate();
+// reqDisplayUpdate();
+ _Manager.reqUpdate();
}
repeatCount = -1;
diff --git a/Arduino/BTCDieselHeater/Screen2.h b/Arduino/BTCDieselHeater/Screen2.h
index 0c62469..37eab80 100644
--- a/Arduino/BTCDieselHeater/Screen2.h
+++ b/Arduino/BTCDieselHeater/Screen2.h
@@ -35,6 +35,6 @@ class CScreen2 : public CScreen
public:
CScreen2(C128x64_OLED& display, CScreenManager& mgr);
void show(const CProtocol& CtlFrame, const CProtocol& HtrFrame);
- void animate() {};
+ void animate();
void keyHandler(uint8_t event);
};
diff --git a/Arduino/BTCDieselHeater/Screen3.cpp b/Arduino/BTCDieselHeater/Screen3.cpp
index ebe88a9..992c884 100644
--- a/Arduino/BTCDieselHeater/Screen3.cpp
+++ b/Arduino/BTCDieselHeater/Screen3.cpp
@@ -29,7 +29,7 @@ const int border = 3;
const int radius = 4;
const int Row[] = { 52, 40, 28, 16 } ;
const int Col[] = { border, 70, 100};
-const char* Label0 = "Prev/Next Screen";
+const char* Label0 = "<- ->";
const char* Label1[] = { "Thermostat",
"Fixed Hz" };
const char* Label2[] = { "Prime pump",
@@ -51,6 +51,7 @@ CScreen3::show(const CProtocol& CtlFrame, const CProtocol& HtrFrame)
{
CScreen::show(CtlFrame, HtrFrame);
+ // show next/prev screen navigation line
CRect extents;
_display.setCursor(_display.xCentre(), Row[0]);
_display.printCentreJustified(Label0);
@@ -138,6 +139,13 @@ CScreen3::show(const CProtocol& CtlFrame, const CProtocol& HtrFrame)
}
+void
+CScreen3::animate()
+{
+ // do nothing!!
+};
+
+
void
CScreen3::keyHandler(uint8_t event)
{
@@ -203,7 +211,8 @@ CScreen3::keyHandler(uint8_t event)
stopPump();
}
- reqDisplayUpdate();
+// reqDisplayUpdate();
+ _Manager.reqUpdate();
}
}
diff --git a/Arduino/BTCDieselHeater/Screen3.h b/Arduino/BTCDieselHeater/Screen3.h
index 7b2a898..3b2b221 100644
--- a/Arduino/BTCDieselHeater/Screen3.h
+++ b/Arduino/BTCDieselHeater/Screen3.h
@@ -34,6 +34,6 @@ class CScreen3 : public CScreen {
public:
CScreen3(C128x64_OLED& display, CScreenManager& mgr);
void show(const CProtocol& CtlFrame, const CProtocol& HtrFrame);
- void animate() {};
+ void animate();
void keyHandler(uint8_t event);
};
diff --git a/Arduino/BTCDieselHeater/Screen4.cpp b/Arduino/BTCDieselHeater/Screen4.cpp
index f4521f3..648878a 100644
--- a/Arduino/BTCDieselHeater/Screen4.cpp
+++ b/Arduino/BTCDieselHeater/Screen4.cpp
@@ -53,6 +53,13 @@ CScreen4::show(const CProtocol& CtlFrame, const CProtocol& HtrFrame)
}
+void
+CScreen4::animate()
+{
+ // do nothing!!
+};
+
+
void
CScreen4::keyHandler(uint8_t event)
{
diff --git a/Arduino/BTCDieselHeater/Screen4.h b/Arduino/BTCDieselHeater/Screen4.h
index fa6b83d..d83d823 100644
--- a/Arduino/BTCDieselHeater/Screen4.h
+++ b/Arduino/BTCDieselHeater/Screen4.h
@@ -29,6 +29,6 @@ class CScreen4 : public CScreen {
public:
CScreen4(C128x64_OLED& display, CScreenManager& mgr);
void show(const CProtocol& CtlFrame, const CProtocol& HtrFrame);
- void animate() {};
+ void animate();
void keyHandler(uint8_t event);
};
diff --git a/Arduino/BTCDieselHeater/Screen5.cpp b/Arduino/BTCDieselHeater/Screen5.cpp
new file mode 100644
index 0000000..ab701fd
--- /dev/null
+++ b/Arduino/BTCDieselHeater/Screen5.cpp
@@ -0,0 +1,263 @@
+/*
+ * This file is part of the "bluetoothheater" distribution
+ * (https://gitlab.com/mrjones.id.au/bluetoothheater)
+ *
+ * Copyright (C) 2018 Ray Jones
+ *
+ * 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 .
+ *
+ */
+
+#include "128x64OLED.h"
+#include "display.h"
+#include "KeyPad.h"
+#include "helpers.h"
+#include "Screen5.h"
+#include "BTCWifi.h"
+
+
+CScreen5::CScreen5(C128x64_OLED& display, CScreenManager& mgr) : CScreen(display, mgr)
+{
+ _bPWOK = false;
+ _rowSel = 0;
+ _colSel = 0;
+ for(int i= 0; i < 4; i++)
+ _PWdig[i] = -1;
+}
+
+
+void
+CScreen5::show(const CProtocol& CtlFrame, const CProtocol& HtrFrame)
+{
+ CScreen::show(CtlFrame, HtrFrame);
+
+ CRect extents;
+
+ _display.setCursor(0, 16);
+ _display.print("Fuel Settings:");
+
+ if(_rowSel == 1) {
+ _display.setCursor(0, 30);
+ _display.print("Enter password...");
+ _showPassword();
+ }
+ else {
+ char str[16];
+ int yPos = 28;
+ const int border = 4;
+ const int radius = 4;
+ const int col2 = 90;
+ const int col3 = _display.width() - border;
+ CRect extents;
+ _display.setCursor(0, yPos);
+ _display.print("Pump (Hz)");
+ _display.setCursor(col2, yPos);
+ sprintf(str, "%.1f", CtlFrame.getPump_Min());
+ _display.printRightJustified(str);
+ if(_rowSel == 3 && _colSel == 0) {
+ _display.getTextExtents(str, extents);
+ extents.xPos = col2 - extents.width;
+ extents.yPos = yPos;
+ extents.Expand(border);
+ _display.drawRoundRect(extents.xPos, extents.yPos, extents.width, extents.height, radius, WHITE);
+ }
+ _display.setCursor(col3, yPos);
+ sprintf(str, "%.1f", CtlFrame.getPump_Max());
+ _display.printRightJustified(str);
+ if(_rowSel == 3 && _colSel == 1) {
+ _display.getTextExtents(str, extents);
+ extents.xPos = col3 - extents.width;
+ extents.yPos = yPos;
+ extents.Expand(border);
+ _display.drawRoundRect(extents.xPos, extents.yPos, extents.width, extents.height, radius, WHITE);
+ }
+ yPos = 40;
+ _display.setCursor(0, yPos);
+ _display.print("Fan (RPM)");
+ _display.setCursor(col2, yPos);
+ sprintf(str, "%d", CtlFrame.getFan_Min());
+ _display.printRightJustified(str);
+ if(_rowSel == 2 && _colSel == 0) {
+ _display.getTextExtents(str, extents);
+ extents.xPos = col2 - extents.width;
+ extents.yPos = yPos;
+ extents.Expand(border);
+ _display.drawRoundRect(extents.xPos, extents.yPos, extents.width, extents.height, radius, WHITE);
+ }
+ _display.setCursor(col3, yPos);
+ sprintf(str, "%d", CtlFrame.getFan_Max());
+ _display.printRightJustified(str);
+ if(_rowSel == 2 && _colSel == 1) {
+ _display.getTextExtents(str, extents);
+ extents.xPos = col3 - extents.width;
+ extents.yPos = yPos;
+ extents.Expand(border);
+ _display.drawRoundRect(extents.xPos, extents.yPos, extents.width, extents.height, radius, WHITE);
+ }
+ }
+
+ _display.display();
+}
+
+
+void
+CScreen5::animate()
+{
+ // do nothing!!
+};
+
+
+void
+CScreen5::keyHandler(uint8_t event)
+{
+ if(event & keyPressed) {
+ // press CENTRE
+ if(event & key_Centre) {
+ if(_rowSel == 1) {
+ // match "1688"
+ if((_PWdig[0] == 1) &&
+ (_PWdig[1] == 6) &&
+ (_PWdig[2] == 8) &&
+ (_PWdig[3] == 8)) {
+ _bPWOK = true;
+ _rowSel = 2;
+ _colSel = 0;
+ }
+ else {
+ for(int i= 0; i < 4; i++)
+ _PWdig[i] = -1;
+ }
+ }
+ else {
+ _bPWOK = false;
+ _rowSel = 0;
+ }
+ return;
+ }
+ // press LEFT
+ if(event & key_Left) {
+ switch(_rowSel) {
+ case 0:
+ _Manager.prevScreen();
+ break;
+ case 1:
+ _colSel--;
+ LOWERLIMIT(_colSel, 0);
+ break;
+ case 2:
+ case 3:
+ _colSel = 0;
+ break;
+ }
+ }
+ // press RIGHT
+ if(event & key_Right) {
+ switch(_rowSel) {
+ case 0:
+ _Manager.nextScreen();
+ break;
+ case 1:
+ _colSel++;
+ UPPERLIMIT(_colSel, 3);
+ break;
+ case 2:
+ case 3:
+ _colSel = 1;
+ break;
+ }
+ }
+ // press UP
+ if(event & key_Up) {
+ switch(_rowSel) {
+ case 0:
+ _rowSel = 1;
+ _colSel = 0;
+ break;
+ case 1:
+ _PWdig[_colSel]++;
+ ROLLUPPERLIMIT(_PWdig[_colSel], 9, 0);
+ break;
+ case 2:
+ _rowSel = 3;
+ break;
+ }
+ }
+ // press DOWN
+ if(event & key_Down) {
+ switch(_rowSel) {
+ case 1:
+ _PWdig[_colSel]--;
+ ROLLLOWERLIMIT(_PWdig[_colSel], 0, 9);
+ break;
+ case 2:
+ _rowSel--; // force skip over line 1 (password)
+ // deliberately not breaking
+ case 3:
+ _rowSel--;
+ break;
+ }
+ }
+ _Manager.reqUpdate();
+ }
+
+ // escape PW entry by holding centre button
+ if(event & keyRepeat) {
+ if(event & key_Centre) {
+ _rowSel == 0;
+ }
+ }
+}
+
+void
+CScreen5::_showPassword()
+{
+ // determine metrics of character sizing
+ CRect extents;
+ _display.getTextExtents("X", extents);
+ int charWidth = extents.width;
+ _display.getTextExtents(" ", extents);
+ int spaceWidth = extents.width;
+
+ const int border = 3;
+ const int radius = 4;
+
+ for(int i =0 ; i < 4; i++) {
+
+ int xPos = _display.xCentre() - (2 - i) * (charWidth + spaceWidth);
+// Serial.print(" xPos="); Serial.print(xPos);
+ char str[8];
+
+ if(_PWdig[i] < 0) {
+ strcpy(str, "-");
+ }
+ else {
+ sprintf(str, "%d", _PWdig[i]);
+ }
+ _display.getTextExtents(str, extents);
+ extents.xPos = xPos;
+ extents.yPos = 46;
+ if(_rowSel == 1 && _colSel == i) {
+ // draw selection box
+ extents.Expand(border);
+ _display.drawRoundRect(extents.xPos, extents.yPos, extents.width, extents.height, radius, WHITE);
+ // // draw white background
+ // extents.Expand(1);
+ // _display.fillRect(extents.xPos, extents.yPos, extents.width, extents.height, WHITE);
+ extents.Expand(-border);
+ }
+ _display.setCursor(extents.xPos, extents.yPos);
+ _display.print(str);
+ }
+// Serial.println("");
+}
diff --git a/Arduino/BTCDieselHeater/Screen5.h b/Arduino/BTCDieselHeater/Screen5.h
new file mode 100644
index 0000000..bca270f
--- /dev/null
+++ b/Arduino/BTCDieselHeater/Screen5.h
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the "bluetoothheater" distribution
+ * (https://gitlab.com/mrjones.id.au/bluetoothheater)
+ *
+ * Copyright (C) 2018 Ray Jones
+ *
+ * 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 .
+ *
+ */
+
+#include "stdint.h"
+
+class C128x64_OLED;
+class CScreenManager;
+class CProtocol;
+
+class CScreen5 : public CScreen {
+ bool _bPWOK;
+ int _PWdig[4];
+ int _rowSel;
+ int _colSel;
+ void _showPassword();
+public:
+ CScreen5(C128x64_OLED& display, CScreenManager& mgr);
+ void show(const CProtocol& CtlFrame, const CProtocol& HtrFrame);
+ void animate();
+ void keyHandler(uint8_t event);
+};
diff --git a/Arduino/BTCDieselHeater/display.cpp b/Arduino/BTCDieselHeater/display.cpp
index a797aa3..70689c6 100644
--- a/Arduino/BTCDieselHeater/display.cpp
+++ b/Arduino/BTCDieselHeater/display.cpp
@@ -35,6 +35,7 @@
#include "Screen2.h"
#include "Screen3.h"
#include "Screen4.h"
+#include "Screen5.h"
#include "KeyPad.h"
#include "helpers.h"
#include "clock.h"
@@ -65,6 +66,15 @@
// 128 x 64 OLED support
SPIClass SPI; // default constructor opens HSPI on standard pins : MOSI=13,CLK=14,MISO=12(unused)
+////////////////////////////////////////////////////////////////////////////////////////////////
+// splash creen created using image2cpp http://javl.github.io/image2cpp/
+// Settings:
+// Black background
+// Invert [X]
+// Arduino code, single bitmap
+// Identifier: DieselSplash
+// Draw Mode: Horizontal
+//
const unsigned char DieselSplash [] PROGMEM = {
// 'Splash2, 128x64px
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -132,75 +142,7 @@ const unsigned char DieselSplash [] PROGMEM = {
0x11, 0x49, 0x92, 0x94, 0xa1, 0x21, 0x14, 0x25, 0x10, 0x80, 0x85, 0x29, 0x44, 0x25, 0x50, 0x80,
0x11, 0x39, 0x8e, 0x93, 0x18, 0xe1, 0x13, 0x1c, 0xcc, 0x80, 0x78, 0xc9, 0x34, 0x19, 0x4c, 0x80
};
-/*
-// 'Splash2', 128x64px
-const uint8_t DieselSplash[SH1106_LCDHEIGHT * SH1106_LCDWIDTH / 8] PROGMEM = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x88, 0x48, 0x48, 0x48, 0x48, 0x48, 0x88,
- 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40,
- 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80,
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x02, 0x12, 0x02, 0x04, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xc0, 0x40, 0xc0, 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x08, 0x08, 0x08, 0x18, 0x68, 0x88, 0x04, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x02, 0x02, 0x0c, 0x10, 0x20, 0xe0, 0x20, 0x20, 0x20, 0x60, 0x80, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa0, 0xfe, 0x44, 0xa8, 0x10, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x70, 0x0e, 0x01, 0x00, 0x00, 0x01, 0x02, 0x04, 0x18, 0x20, 0xc0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00,
- 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x3e, 0xc0, 0x00, 0x00, 0x03, 0x1c, 0xe0, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0f, 0x04, 0x02, 0x01, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x60, 0x60, 0xd0, 0x90, 0x0c,
- 0x13, 0x60, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, 0x20, 0x20, 0x10, 0x13, 0xfc, 0x08, 0x08,
- 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x03,
- 0x05, 0x04, 0x08, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x40,
- 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0xff, 0x20, 0x20, 0x20, 0x10, 0x0f, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xc0, 0x80, 0x00, 0x00, 0x01, 0x07,
- 0xfe, 0x02, 0x02, 0x03, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x0c, 0x0c, 0x0e,
- 0x0f, 0x08, 0x08, 0x08, 0x1f, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0xe0,
- 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x02, 0x02, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x04, 0x08, 0x1e, 0x11, 0x10,
- 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x02, 0x1e, 0x22, 0x22, 0x22,
- 0x21, 0x31, 0x1f, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x06, 0x03,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xfc, 0x12, 0x11, 0x12, 0xfc, 0x00, 0x70, 0x88, 0x88, 0xfe, 0x00, 0x38, 0xc0,
- 0xc0, 0x38, 0x00, 0x70, 0x88, 0x88, 0xf8, 0x00, 0xf0, 0x08, 0x08, 0xf8, 0x00, 0x70, 0x88, 0x88,
- 0x50, 0x00, 0x70, 0xa8, 0xa8, 0x30, 0x00, 0x70, 0x88, 0x88, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0x10, 0x10, 0x10, 0xff, 0x00, 0x70, 0xa8, 0xa8, 0x30, 0x00, 0x70, 0x88, 0x88, 0xf8, 0x00, 0x7e,
- 0x88, 0x88, 0x00, 0x70, 0xa8, 0xa8, 0x30, 0x00, 0xf8, 0x10, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x7e, 0x81, 0x81, 0x81, 0x81, 0x42, 0x00, 0x70, 0x88, 0x88, 0x70, 0x00, 0xf0, 0x08, 0x08, 0xf8,
- 0x00, 0x7e, 0x88, 0x88, 0x00, 0xf8, 0x10, 0x08, 0x08, 0x00, 0x70, 0x88, 0x88, 0x70, 0x00, 0xfe,
- 0x00, 0xfe, 0x00, 0x70, 0xa8, 0xa8, 0x30, 0x00, 0xf8, 0x10, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00
-};
-*/
+
CScreenManager::CScreenManager()
{
_pDisplay = NULL;
@@ -208,6 +150,7 @@ CScreenManager::CScreenManager()
for(int i = 0; i < _maxScreens; i++)
_pScreen[i] = NULL;
_currentScreen = 1;
+ _bReqUpdate = false;
}
CScreenManager::~CScreenManager()
@@ -250,16 +193,28 @@ CScreenManager::init()
_pScreen[1] = new CScreen2(*_pDisplay, *this);
_pScreen[2] = new CScreen3(*_pDisplay, *this);
_pScreen[3] = new CScreen4(*_pDisplay, *this);
+ _pScreen[4] = new CScreen5(*_pDisplay, *this);
_switchScreen();
}
void
-CScreenManager::update(const CProtocol& CtlFrame, const CProtocol& HtrFrame)
+CScreenManager::checkUpdate(const CProtocol& CtlFrame, const CProtocol& HtrFrame)
{
- if(_pActiveScreen) _pActiveScreen->show(CtlFrame, HtrFrame);
+ if(_bReqUpdate) {
+ if(_pActiveScreen) {
+ _pActiveScreen->show(CtlFrame, HtrFrame);
+ _bReqUpdate = false;
+ }
+ }
}
+void
+CScreenManager::reqUpdate()
+{
+ _bReqUpdate = true;
+}
+
void
CScreenManager::animate()
{
@@ -272,7 +227,8 @@ CScreenManager::_switchScreen()
if(_currentScreen < _maxScreens)
_pActiveScreen = _pScreen[_currentScreen];
- reqDisplayUpdate();
+ // reqDisplayUpdate();
+ reqUpdate();
}
void
diff --git a/Arduino/BTCDieselHeater/display.h b/Arduino/BTCDieselHeater/display.h
index f298a0c..e6613ee 100644
--- a/Arduino/BTCDieselHeater/display.h
+++ b/Arduino/BTCDieselHeater/display.h
@@ -30,21 +30,23 @@ class C128x64_OLED;
class CScreen;
class CScreenManager {
- static const int _maxScreens = 4;
+ static const int _maxScreens = 5;
CScreen* _pScreen[_maxScreens];
CScreen* _pActiveScreen;
C128x64_OLED* _pDisplay;
int _currentScreen;
+ bool _bReqUpdate;
void _switchScreen();
public:
CScreenManager();
~CScreenManager();
void init();
- void update(const CProtocol& CtlFrame, const CProtocol& HtrFrame);
+ void checkUpdate(const CProtocol& CtlFrame, const CProtocol& HtrFrame);
void animate();
void nextScreen();
void prevScreen();
void keyHandler(uint8_t event);
+ void reqUpdate();
};
class CScreen {
diff --git a/Arduino/BTCDieselHeater/helpers.h b/Arduino/BTCDieselHeater/helpers.h
index 210cae6..f0a3283 100644
--- a/Arduino/BTCDieselHeater/helpers.h
+++ b/Arduino/BTCDieselHeater/helpers.h
@@ -27,7 +27,7 @@ extern int getRunState();
extern int getErrState();
extern void reqTempChange(int val);
extern int getSetTemp();
-extern void reqDisplayUpdate();
+//extern void reqDisplayUpdate();
extern void reqThermoToggle();
extern void setThermostatMode(unsigned char);
extern bool getThermostatMode();
@@ -37,4 +37,6 @@ extern void reqPumpPrime(bool on);
extern float getActualTemperature();
#define LOWERLIMIT(A, B) if(A < B) A = B
-#define UPPERLIMIT(A, B) if(A > B) A = B
\ No newline at end of file
+#define UPPERLIMIT(A, B) if(A > B) A = B
+#define ROLLUPPERLIMIT(A, B, C) if(A > B) A = C
+#define ROLLLOWERLIMIT(A, B, C) if(A < B) A = C
diff --git a/Arduino/BTCDieselHeater/mainpage.cpp b/Arduino/BTCDieselHeater/mainpage.cpp
new file mode 100644
index 0000000..120944e
--- /dev/null
+++ b/Arduino/BTCDieselHeater/mainpage.cpp
@@ -0,0 +1,148 @@
+#include
+
+const char* MAIN_PAGE PROGMEM = R"=====(
+
+
+
+
+
+
+
+Chinese Diesel Heater Web Controller Interface
+
+
+
+Chinese Diesel Heater Web Control
+OFF ON
+
+Heater Is ON
+
+
Temperature Control
+
+
+
+
Desired Temp:
+
+
+
+
Current Temp:
+
+
+
+
+
+
+
+
+)=====";
+