Rework priming menu, can now reset fuel gauge. JSON added for fuel usage & cal.

This commit is contained in:
Ray Jones 2019-07-20 16:08:43 +10:00
parent 04ae988d2d
commit dd5e62c8cb
26 changed files with 628 additions and 112 deletions

4
.gitignore vendored
View File

@ -21,3 +21,7 @@ Arduino/Afterburner/src/*
/Releases
/webdev
/case
/DieselHeaterV2.PcbDoc
/StandardResponse.txt
/HeaterHack-Tested.zip
/OTA_COM.txt

10
Partitions.txt Normal file
View File

@ -0,0 +1,10 @@
PLATFORMIO MIN_SPIFFS PARTITION ARDUINO MIN_SPIFFS PARTITION
# Name, Type, SubType, Offset, Size, Flags # Name, Type, SubType, Offset, Size, Flags
Same nvs, data, nvs, 0x9000, 0x5000, nvs, data, nvs, 0x9000, 0x5000,
Same otadata, data, ota, 0xe000, 0x2000, otadata, data, ota, 0xe000, 0x2000,
Same app0, app, ota_0, 0x10000, 0x1E0000, app0, app, ota_0, 0x10000, 0x1E0000,
Same app1, app, ota_1, 0x1F0000,0x1E0000, app1, app, ota_1, 0x1F0000,0x1E0000,
Diff eeprom, data, 0x99, 0x3D0000,0x1000, spiffs, data, spiffs, 0x3D0000,0x30000,
Diff spiffs, data, spiffs, 0x3D1000,0x2F000,

BIN
icons/DegC.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

BIN
icons/DegF.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

BIN
icons/Reset.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

BIN
icons/ThermostatC.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

BIN
icons/ThermostatF.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

BIN
icons/ThermostatHz.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

View File

@ -11,6 +11,7 @@
[env:esp32dev]
platform = espressif32
lib_extra_dirs = ~/Documents/Arduino/libraries
;lib_dir = src/Afterburner/src
board = esp32dev
framework = arduino
board_build.partitions = min_spiffs.csv
@ -22,5 +23,6 @@ upload_flags =
monitor_speed = 115200
extra_scripts = post:add_CRC.py
; replace shitty Arduino millis with a linear time version
build_flags = -Wl,--wrap,millis
build_flags =
-Wl,--wrap,millis

View File

@ -29,8 +29,6 @@
#include "../Utility/NVStorage.h"
#include "../Utility/FuelGauge.h"
extern CFuelGauge FuelGauge;
#define MINIFONT miniFontInfo
@ -135,7 +133,7 @@ CDetailedScreen::show()
}
if(!bGlowActive) {
showBowser(FuelGauge.Used_mL());
showBowser(FuelGauge.Used_ml());
}
showRunState(runstate, errstate);
return true;

View File

@ -24,6 +24,7 @@
#include "KeyPad.h"
#include "../Utility/helpers.h"
#include "../Utility/macros.h"
#include "../Utility/NVStorage.h"
#include "../Protocol/Protocol.h"
///////////////////////////////////////////////////////////////////////////
@ -246,3 +247,215 @@ CHeaterSettingsScreen::_adjust(int dir)
break;
}
}
CFuelCalScreen::CFuelCalScreen(C128x64_OLED& display, CScreenManager& mgr) : CPasswordScreen(display, mgr)
{
_initUI();
_mlPerStroke = 0.02;
}
void
CFuelCalScreen::onSelect()
{
CPasswordScreen::onSelect();
_initUI();
_mlPerStroke = NVstore.getHeaterTuning().pumpCal;
}
void
CFuelCalScreen::_initUI()
{
_rowSel = 0;
_animateCount = 0;
}
bool
CFuelCalScreen::show()
{
char msg[20];
_display.clearDisplay();
if(!CPasswordScreen::show()) { // for showing "saving settings"
if(_rowSel == 4) {
_printInverted(_display.xCentre(), 0, " Saving Settings ", true, eCentreJustify);
_printMenuText(_display.xCentre(), 35, "Press UP to", false, eCentreJustify);
_printMenuText(_display.xCentre(), 43, "confirm save", false, eCentreJustify);
}
else {
int col = 80;
_printInverted(_display.xCentre(), 0, " Fuel Calibration ", true, eCentreJustify);
_printMenuText(col, Line1, "ml / stroke:", false, eRightJustify);
sprintf(msg, "%.03f", _mlPerStroke);
_printMenuText(col+1, Line1, msg, _rowSel == 1);
// navigation line
int yPos = 53;
int xPos = _display.xCentre();
switch(_rowSel) {
case 0:
_printMenuText(xPos, yPos, " \021 Exit \020 ", true, eCentreJustify);
break;
default:
_display.drawFastHLine(0, 52, 128, WHITE);
_printMenuText(xPos, 56, "\030\031Sel \033\032 Adj", false, eCentreJustify);
_printMenuText(xPos, 56, "Save", false, eCentreJustify);
break;
}
}
}
return true;
}
bool
CFuelCalScreen::animate()
{
/* char msg[16];
if(isPasswordBusy() || (_rowSel == 4)) { // Password screen activity
_printMenuText(Column, Line2, " ");
_printMenuText(Column, Line1, " ");
if(_rowSel == 4)
_printMenuText(_display.xCentre(), 43, "Confirm save", false, eCentreJustify);
}
else {
_animateCount++;
WRAPUPPERLIMIT(_animateCount, 9, 0);
if(_rowSel == 1) {
_display.drawRect(Column-border, Line1-border, 34, 8+2*border, BLACK);
_display.drawRoundRect(Column-border, Line1-border, 34, 8+2*border, radius, WHITE);
}
else {
_printMenuText(Column, Line1, " ");
}
if(_animateCount < 4)
sprintf(msg, "PF-%d ", _glowDrive);
else
sprintf(msg, "(%dW)", plugPowers[_glowDrive-1]);
_printMenuText(Column, Line1, msg);
int xPos = Column;
_printMenuText(xPos, Line2, " ", _rowSel == 2); // erase, but create selection loop
if(_animateCount < 4) {
sprintf(msg, "SN-%d", _fanSensor);
_printMenuText(Column, Line2, msg);
}
else {
sprintf(msg, "(\365%d)", _fanSensor); // \365 is division character
_printMenuText(xPos, Line2, msg);
}
}*/
return true;
}
bool
CFuelCalScreen::keyHandler(uint8_t event)
{
sHeaterTuning tuning;
if(event & keyPressed) {
// press LEFT to select previous screen
if(event & key_Left) {
switch(_rowSel) {
case 0:
_ScreenManager.prevMenu();
break;
case 1:
case 2:
case 3:
_adjust(-1);
break;
case 4:
_rowSel = 0; // abort save
break;
}
}
// press RIGHT to select next screen
if(event & key_Right) {
switch(_rowSel) {
case 0:
_ScreenManager.nextMenu();
break;
case 1:
case 2:
case 3:
_adjust(+1);
break;
case 4:
_rowSel = 0; // abort save
break;
}
}
if(event & key_Down) {
_rowSel--;
LOWERLIMIT(_rowSel, 0);
}
// UP press
if(event & key_Up) {
switch(_rowSel) {
case 0:
case 1:
case 2:
case 3:
_rowSel++;
UPPERLIMIT(_rowSel, 3);
break;
case 4: // confirmed save
_showStoringMessage();
tuning = NVstore.getHeaterTuning();
tuning.pumpCal = _mlPerStroke;
NVstore.setHeaterTuning(tuning);
saveNV();
_rowSel = 0;
break;
}
}
// CENTRE press
if(event & key_Centre) {
switch(_rowSel) {
case 0:
_ScreenManager.selectMenu(CScreenManager::RootMenuLoop);
break;
case 1:
case 2:
case 3:
_rowSel = 4;
break;
}
}
_ScreenManager.reqUpdate();
}
return true;
}
void
CFuelCalScreen::_adjust(int dir)
{
switch(_rowSel) {
case 1:
_mlPerStroke += dir * 0.001;
break;
case 2:
break;
case 3:
break;
}
}

View File

@ -45,4 +45,19 @@ public:
void onSelect();
};
class CFuelCalScreen : public CPasswordScreen
{
int _rowSel;
void _adjust(int dir);
float _mlPerStroke;
int _animateCount;
void _initUI();
public:
CFuelCalScreen(C128x64_OLED& display, CScreenManager& mgr);
bool show();
bool animate();
bool keyHandler(uint8_t event);
void onSelect();
};
#endif

View File

@ -23,6 +23,10 @@
#include "KeyPad.h"
#include "../Utility/NVStorage.h"
#include "../Protocol/Protocol.h"
#include "fonts/Icons.h"
#include "../RTC/Clock.h"
#include "../Utility/FuelGauge.h"
///////////////////////////////////////////////////////////////////////////
//
@ -58,7 +62,7 @@ CPrimingScreen::_initUI()
{
_PrimeStop = 0;
_PrimeCheck = 0;
_rowSel = 0;
_paramSel = 0;
_colSel = 0;
}
@ -71,80 +75,134 @@ CPrimingScreen::show()
int yPos = 53;
// show next/prev menu navigation line
switch(_rowSel) {
switch(_paramSel) {
case 0:
_printMenuText(_display.xCentre(), yPos, " \021 \030Edit \020 ", _rowSel == 0, eCentreJustify);
_printMenuText(_display.xCentre(), yPos, " \021 \030Edit \020 ", _paramSel == 0, eCentreJustify);
break;
case 1:
case 2:
_display.drawFastHLine(0, 53, 128, WHITE);
_printMenuText(_display.xCentre(), 57, "\030\031 Sel \033\032 Adj", false, eCentreJustify);
_printMenuText(_display.xCentre(), 57, "\030\031 Sel \033\032 Param", false, eCentreJustify);
break;
case 3:
_display.drawFastHLine(0, 53, 128, WHITE);
if(_colSel == 2) {
_printMenuText(_display.xCentre(), 57, "\033\030\031 Stop", false, eCentreJustify);
}
else {
_printMenuText(_display.xCentre(), 57, "\032 Start \031 Sel", false, eCentreJustify);
switch(_colSel) {
case 1:
_printMenuText(_display.xCentre(), 57, "\033\030\031\032 Stop", false, eCentreJustify);
break;
case 0:
_printMenuText(_display.xCentre(), 57, "\030 Start \031 Sel", false, eCentreJustify);
break;
case -1:
_printMenuText(_display.xCentre(), 57, "\030 Sel Zero", false, eCentreJustify);
break;
}
break;
}
yPos = 40;
if(_rowSel == 1) {
int topline = 19;
int midline = 29;
int botline = 35;
// int xPos = border;
CRect loc;
loc.height = ThermostatDegCIconInfo.height;
loc.width = ThermostatDegCIconInfo.width;
loc.xPos = border;
if(_paramSel == 1) {
// follow user desired setting, heater info is laggy
_printMenuText(border, yPos, "Thermostat", _colSel == 0);
_printMenuText(_display.width()-border, yPos, "Fixed Hz", _colSel == 1, eRightJustify);
if(NVstore.getUserSettings().degF)
_drawBitmap(loc.xPos, topline-1, ThermostatDegFIconInfo);
else
_drawBitmap(loc.xPos, topline-1, ThermostatDegCIconInfo);
_drawBitmap(loc.xPos, botline+1, ThermostatHzIconInfo);
loc.yPos = (_colSel == 0) ? topline-1 : botline+1;
_drawMenuSelection(loc, border, radius);
}
else {
// follow actual heater settings
// int col = getHeaterInfo().isThermostat() ? 0 : 1;
int col = getThermostatModeActive() ? 0 : 1;
_printInverted(border, yPos, "Thermostat", col == 0);
_printInverted(_display.width()-border, yPos, "Fixed Hz", col == 1, eRightJustify);
if(getThermostatModeActive()) {
_drawBitmap(loc.xPos, midline, NVstore.getUserSettings().degF ? ThermostatDegFIconInfo : ThermostatDegCIconInfo);
}
else {
_drawBitmap(loc.xPos, midline, ThermostatHzIconInfo);
}
}
yPos = 28;
if(_rowSel == 2) {
_printMenuText(border, yPos, "degC", _colSel == 0);
_printMenuText(_display.width()-border, yPos, "degF", _colSel == 1, eRightJustify);
loc.height = DegCIconInfo.height;
loc.width = DegCIconInfo.width;
loc.xPos = 35;
if(_paramSel == 2) {
loc.yPos = (_colSel == 0) ? topline : botline;
_drawMenuSelection(loc, border, radius);
_drawBitmap(loc.xPos, topline, DegCIconInfo);
_drawBitmap(loc.xPos, botline, DegFIconInfo);
}
else {
int col = NVstore.getUserSettings().degF ? 1 : 0;
_printInverted(border, yPos, "degC", col == 0);
_printInverted(_display.width()-border, yPos, "degF", col == 1, eRightJustify);
_drawBitmap(loc.xPos, midline, NVstore.getUserSettings().degF ? DegFIconInfo : DegCIconInfo);
}
// fuel pump priming menu
yPos = 16;
_printMenuText(border, yPos, "Pump");
if(_rowSel == 3) {
_printMenuText(40, yPos, "OFF", _colSel == 1);
if(_colSel != 2) {
if(!getHeaterInfo().getRunState()) { // prevent option if heater is running
_printMenuText(70, yPos, "ON"); // becomes Hz when actually priming
loc.xPos = 67;
// yPos = 16;
// _printMenuText(border, yPos, "Pump");
loc.width = BowserIconInfo.width;
loc.height = BowserIconInfo.height;
_drawBitmap(loc.xPos, midline, BowserIconInfo);
loc.xPos = 81;
if(_paramSel == 3) {
_drawBitmap(loc.xPos, topline, FuelIconInfo);
_drawBitmap(loc.xPos, botline, resetIconInfo);
if(_colSel == -1) {
loc.yPos = botline;
loc.width = resetIconInfo.width;
loc.height = resetIconInfo.height;
_drawMenuSelection(loc, border, radius);
}
loc.yPos = _colSel == -1 ? botline : topline;
loc.width = FuelIconInfo.width + StartIconInfo.width + 2;
loc.height = FuelIconInfo.height;
if(_colSel == 0) {
_drawMenuSelection(loc, border, radius);
}
loc.xPos += FuelIconInfo.width + 2;
if(_colSel != 1) { // only show start options if not priming already
if(getHeaterInfo().getRunState() == 0) { // prevent priming option if heater is running
_drawBitmap(loc.xPos, topline+2, StartIconInfo); // becomes Hz when actually priming
}
else {
_drawBitmap(loc.xPos, topline, CrossIconInfo);
}
}
else {
if(_colSel == 1) {
float pumpHz = getHeaterInfo().getPump_Actual();
// recognise if heater has stopped pump, after an initial holdoff upon first starting
long tDelta = millis() - _PrimeCheck;
if(_PrimeCheck && tDelta > 0 && pumpHz < 0.1) {
_stopPump();
_paramSel = _colSel = 0;
}
// test if time is up, stop priming if so
tDelta = millis() - _PrimeStop;
if(_PrimeStop && tDelta > 0) {
_stopPump();
_paramSel = _colSel = 0;
}
if(_PrimeStop) {
char msg[16];
sprintf(msg, "%.1fHz", pumpHz);
_printMenuText(70, yPos, msg, true);
_printMenuText(loc.xPos+1+border, topline+3, msg, true);
_ScreenManager.bumpTimeout(); // don't allow menu timeouts whilst priming is active
}
}
}
else {
char msg[16];
sprintf(msg, "%.02fL", FuelGauge.Used_ml() * 0.001);
_printMenuText(loc.xPos+1, midline+3, msg);
}
return true;
}
@ -157,47 +215,46 @@ CPrimingScreen::keyHandler(uint8_t event)
if(event & keyPressed) {
// press LEFT
if(event & key_Left) {
switch(_rowSel) {
switch(_paramSel) {
case 0:
_ScreenManager.prevMenu();
break;
case 1:
_colSel = 0;
setThermostatMode(1);
saveNV();
default:
_paramSel--;
LOWERLIMIT(_paramSel, 0);
_colSel = 0;
switch(_paramSel) {
case 1:
_colSel = getThermostatModeActive() ? 0 : 1;
break;
case 2:
_colSel = NVstore.getUserSettings().degF ? 1 : 0;
break;
}
break;
case 2:
_colSel = 0;
setDegFMode(false);
saveNV();
break;
case 3:
_colSel = 1;
break;
case 4: break;
}
}
// press RIGHT
if(event & key_Right) {
switch(_rowSel) {
switch(_paramSel) {
case 0:
_ScreenManager.nextMenu();
break;
case 1:
_colSel = 1;
setThermostatMode(0);
saveNV();
default:
_paramSel++;
UPPERLIMIT(_paramSel, 3);
switch(_paramSel) {
case 3:
_colSel = 0; // select OFF upon entry to priming menu
break;
case 2:
_colSel = NVstore.getUserSettings().degF ? 1 : 0;
break;
case 1:
_colSel = getThermostatModeActive() ? 0 : 1;
break;
}
break;
case 2:
_colSel = 1;
setDegFMode(true);
saveNV();
break;
case 3:
if(!getHeaterInfo().getRunState())
_colSel = 2;
break;
case 4: break;
}
}
// press UP
@ -205,35 +262,90 @@ CPrimingScreen::keyHandler(uint8_t event)
if(hasOEMcontroller())
_reqOEMWarning();
else {
_rowSel++;
UPPERLIMIT(_rowSel, 3);
if(_rowSel == 3)
_colSel = 1; // select OFF upon entry to priming menu
if(_rowSel == 2)
_colSel = NVstore.getUserSettings().degF ? 1 : 0;
if(_rowSel == 1)
_colSel = getThermostatModeActive() ? 0 : 1;
switch(_paramSel) {
case 0:
_paramSel = 1;
_colSel = getThermostatModeActive() ? 0 : 1;
break;
case 1:
_colSel++;
WRAPLIMITS(_colSel, 0, 1);
setThermostatMode(_colSel == 0);
saveNV();
break;
case 2:
_colSel++;
WRAPLIMITS(_colSel, 0, 1);
setDegFMode(_colSel != 0);
saveNV();
break;
case 3:
if(_colSel == 1)
_colSel = 0;
else {
_colSel++;
UPPERLIMIT(_colSel, (getHeaterInfo().getRunState() == 0) ? 1 : 0); // prevent priming if heater is running
}
break;
case 4:
break;
}
}
}
// press DOWN
if(event & key_Down) {
if(_rowSel == 0) {
if(_paramSel == 0) {
_ScreenManager.selectMenu(CScreenManager::UserSettingsLoop, CScreenManager::VersionUI); // force return to main menu
}
else {
_rowSel--;
LOWERLIMIT(_rowSel, 0);
_colSel = 0;
if(_rowSel == 1)
// _colSel = getHeaterInfo().isThermostat() ? 0 : 1;
_colSel = getThermostatModeActive() ? 0 : 1;
if(_rowSel == 2)
_colSel = NVstore.getUserSettings().degF ? 1 : 0;
switch(_paramSel) {
case 0:
break;
case 1:
_colSel--;
WRAPLIMITS(_colSel, 0, 1);
setThermostatMode(_colSel == 0);
saveNV();
break;
case 2:
_colSel--;
WRAPLIMITS(_colSel, 0, 1);
setDegFMode(_colSel != 0);
saveNV();
break;
case 3:
_colSel--;
LOWERLIMIT(_colSel, -1);
break;
case 4:
break;
}
}
}
// press UP
if(event & key_Centre) {
if(_paramSel == 3) {
switch(_colSel) {
case 0:
if(getHeaterInfo().getRunState() == 0)
_colSel = 1;
break;
case 1:
_colSel = 0;
break;
case -1:
FuelGauge.reset();
_paramSel = _colSel = 0;
break;
}
}
else {
_paramSel = _colSel = 0;
}
}
// check if fuel priming was selected
if(_rowSel == 3 && _colSel == 2) {
if(_paramSel == 3 && _colSel == 1 ) {
reqPumpPrime(true);
_PrimeStop = millis() + 150000; // allow 2.5 minutes - much the same as the heater itself cuts out at
_PrimeCheck = millis() + 3000; // holdoff upon start before testing for heater shutting off pump
@ -253,6 +365,7 @@ CPrimingScreen::_stopPump()
reqPumpPrime(false);
_PrimeCheck = 0;
_PrimeStop = 0;
if(_colSel == 2)
_colSel = 1;
if(_paramSel == 3 && _colSel == 1) {
_colSel = 0;
}
}

View File

@ -31,7 +31,7 @@ class CScreenManager;
class CPrimingScreen : public CScreenHeader {
unsigned long _PrimeStop;
unsigned long _PrimeCheck;
int _rowSel;
int _paramSel;
int _colSel;
void _stopPump();
void _initUI();

View File

@ -91,9 +91,19 @@ CScreen::_printMenuText(int x, int y, const char* str, bool selected, eJUSTIFY j
void
CScreen::_drawMenuSelection(CRect extents, const char* str, int border, int radius)
{
_display.getTextExtents(str, extents);
extents.Expand(border);
_display.drawRoundRect(extents.xPos, extents.yPos, extents.width, extents.height, radius, WHITE);
CRect resize(extents);
_display.getTextExtents(str, resize);
// resize.Expand(border);
// _display.drawRoundRect(resize.xPos, resize.yPos, resize.width, resize.height, radius, WHITE);
_drawMenuSelection(resize, border, radius);
}
void
CScreen::_drawMenuSelection(const CRect& extents, int border, int radius)
{
CRect resize(extents);
resize.Expand(border);
_display.drawRoundRect(resize.xPos, resize.yPos, resize.width, resize.height, radius, WHITE);
}
void

View File

@ -52,6 +52,7 @@ protected:
void _printInverted(int x, int y, const char* str, bool selected, eJUSTIFY justify = eLeftJustify);
void _adjustExtents(CRect& rect, eJUSTIFY justify, const char* str);
void _drawMenuSelection(CRect extents, const char* str, int border = 3, int radius = 4);
void _drawMenuSelection(const CRect& extents, int border, int radius);
void _scrollMessage(int y, const char* str, int& charOffset);
void _reqOEMWarning();
void _drawBitmap(int x, int y, const BITMAP_INFO& info, uint16_t color = WHITE, uint16_t bg = 0xffff);

View File

@ -290,8 +290,9 @@ CScreenManager::begin(bool bNoClock)
// create heater tuning screens loop - password protected
menuloop.clear();
menuloop.push_back(new CFuelMixtureScreen(*_pDisplay, *this)); // tuning
menuloop.push_back(new CHeaterSettingsScreen(*_pDisplay, *this)); // tuning
menuloop.push_back(new CFuelMixtureScreen(*_pDisplay, *this)); // mixture tuning
menuloop.push_back(new CHeaterSettingsScreen(*_pDisplay, *this)); // heater system tuning
menuloop.push_back(new CFuelCalScreen(*_pDisplay, *this)); // fuel pump calibration
_Screens.push_back(menuloop);
// create User Settings screens loop
@ -514,26 +515,30 @@ CScreenManager::prevMenu()
void
CScreenManager::keyHandler(uint8_t event)
{
long dimTime = NVstore.getUserSettings().dimTime;
if(_bDimmed) {
if(event & keyReleased) {
_dim(false);
_DimTime_ms = (millis() + abs(dimTime)) | 1;
_MenuTimeout = (millis() + NVstore.getUserSettings().menuTimeout) | 1;
bumpTimeout();
}
return; // initial press when dimmed is always thrown away
}
// _dim(false);
_DimTime_ms = (millis() + abs(dimTime)) | 1;
_MenuTimeout = (millis() + NVstore.getUserSettings().menuTimeout) | 1;
bumpTimeout();
// call key handler for active screen
if(_menu >= 0)
_Screens[_menu][_subMenu]->keyHandler(event);
}
void
CScreenManager::bumpTimeout()
{
long dimTime = NVstore.getUserSettings().dimTime;
_DimTime_ms = (millis() + abs(dimTime)) | 1;
_MenuTimeout = (millis() + NVstore.getUserSettings().menuTimeout) | 1;
}
void
CScreenManager::selectMenu(eUIMenuSets menuSet, int specific)
{
@ -572,11 +577,8 @@ void
CScreenManager::showOTAMessage(int percent, eOTAmodes updateType)
{
static int prevPercent = -1;
static long prevTime = millis();
long tDelta = millis() - prevTime;
if(percent != prevPercent/* && tDelta > 500*/) {
prevTime = millis();
_pDisplay->clearDisplay();
_pDisplay->setCursor(64,22);
switch(updateType) {

View File

@ -49,7 +49,7 @@ public:
enum eUIRootMenus { DetailedControlUI, BasicControlUI, ClockUI, ModeUI, CommsUI, GPIOInfoUI, SettingsUI };
enum eUITimerMenus { TimerOverviewUI, Timer1UI, Timer2UI, Timer3UI, Timer4UI, Timer5UI, Timer6UI, Timer7UI,
Timer8UI, Timer9UI, Timer10UI, Timer11UI, Timer12UI, Timer13UI, Timer14UI };
enum eUITuningMenus { MixtureUI, HeaterSettingsUI };
enum eUITuningMenus { MixtureUI, HeaterSettingsUI, FuelCalUI };
enum eUIUserSettingsMenus { GPIOUI, ExThermostatUI, VersionUI, HomeMenuUI, TimeIntervalsUI };
enum eUIBranchMenus { SetClockUI, InheritSettingsUI, FontDumpUI };
public:
@ -66,6 +66,7 @@ public:
void selectMenu(eUIMenuSets menuset, int specific = -1); // use to select loop menus, including the root or branches
void showRebootMsg(const char* content[2], long delayTime);
void showOTAMessage(int percent, eOTAmodes updateType);
void bumpTimeout();
};
#endif // __SCREEN_MANAGER_H__

View File

@ -68,8 +68,8 @@ CSettingsScreen::show()
CScreenHeader::show();
_display.writeFillRect(0, 16, 96, 12, WHITE);
_printInverted(3, 18, "Heater Settings", true);
_display.writeFillRect(0, 16, 84, 12, WHITE);
_printInverted(3, 18, "Heater Tuning", true);
if(!CPasswordScreen::show()) {

View File

@ -578,6 +578,7 @@ const uint8_t PROGMEM CrossIcon[] =
0x50, // # #
0x88, // # #
};
const BITMAP_INFO CrossIconInfo(5, 5, CrossIcon);
const uint8_t PROGMEM TickIcon[] =
{
@ -961,7 +962,124 @@ const uint8_t PROGMEM bowserIcon[] =
0x7E, 0x00, // ######
0xFF, 0x00, // ########
};
const BITMAP_INFO BowserIconInfo(10, 12, bowserIcon);
//
// Image data for degC
//
const uint8_t PROGMEM degCIcon[] =
{
0x07, 0x00, 0x00, // ###
0x18, 0xC1, 0x8E, // ## ## ## ###
0x27, 0x22, 0x51, // # ### # # # # #
0x4F, 0x92, 0x50, // # ##### # # # #
0x8F, 0x89, 0x90, // # ##### # ## #
0x4F, 0x90, 0x10, // # ##### # #
0x27, 0x20, 0x11, // # ### # # #
0x18, 0xC0, 0x0E, // ## ## ###
0x07, 0x00, 0x00, // ###
};
const BITMAP_INFO DegCIconInfo(23, 9, degCIcon);
const uint8_t PROGMEM degFIcon[] =
{
0x07, 0x00, 0x00, // ###
0x18, 0xC1, 0x9E, // ## ## ## ####
0x27, 0x22, 0x50, // # ### # # # #
0x4F, 0x92, 0x50, // # ##### # # # #
0x8F, 0x89, 0x9C, // # ##### # ## ###
0x4F, 0x90, 0x10, // # ##### # #
0x27, 0x20, 0x10, // # ### # #
0x18, 0xC0, 0x10, // ## ## #
0x07, 0x00, 0x00, // ###
};
const BITMAP_INFO DegFIconInfo(23, 9, degFIcon);
//
// Image data for thermostatC
//
const uint8_t PROGMEM thermostatDegCIcon[] =
{
0x7F, 0xFF, 0xFC, // #####################
0xFF, 0xFF, 0xFE, // #######################
0xE0, 0x07, 0xDE, // ### ##### ####
0xCC, 0x73, 0x8E, // ## ## ### ### ###
0xD2, 0x8B, 0x06, // ## # # # # ## ##
0xD2, 0x83, 0xFE, // ## # # # #########
0xCC, 0x83, 0xFE, // ## ## # #########
0xC0, 0x83, 0x06, // ## # ## ##
0xC0, 0x8B, 0x8E, // ## # # ### ###
0xC0, 0x73, 0xDE, // ## ### #### ####
0xE0, 0x07, 0xFE, // ### ##########
0xFF, 0xFF, 0xFE, // #######################
0x7F, 0xFF, 0xFC, // #####################
};
const BITMAP_INFO ThermostatDegCIconInfo(23, 13, thermostatDegCIcon);
//
// Image data for thermostatDegF
//
const uint8_t PROGMEM thermostatDegFIcon[] =
{
0x7F, 0xFF, 0xFC, // #####################
0xFF, 0xFF, 0xFE, // #######################
0xE0, 0x07, 0xDE, // ### ##### ####
0xCC, 0xF3, 0x8E, // ## ## #### ### ###
0xD2, 0x83, 0x06, // ## # # # ## ##
0xD2, 0x83, 0xFE, // ## # # # #########
0xCC, 0xE3, 0xFE, // ## ## ### #########
0xC0, 0x83, 0x06, // ## # ## ##
0xC0, 0x83, 0x8E, // ## # ### ###
0xC0, 0x83, 0xDE, // ## # #### ####
0xE0, 0x07, 0xFE, // ### ##########
0xFF, 0xFF, 0xFE, // #######################
0x7F, 0xFF, 0xFC, // #####################
};
const BITMAP_INFO ThermostatDegFIconInfo(23, 13, thermostatDegFIcon);
//
// Image data for thermostatHz
//
const uint8_t PROGMEM thermostatHzIcon[] =
{
0x7F, 0xFF, 0xFC, // #####################
0xFF, 0xFF, 0xFE, // #######################
0xE0, 0x07, 0xDE, // ### ##### ####
0xC9, 0x03, 0x8E, // ## # # ### ###
0xC9, 0x03, 0x06, // ## # # ## ##
0xC9, 0x73, 0xFE, // ## # # ### #########
0xCF, 0x13, 0xFE, // ## #### # #########
0xC9, 0x23, 0x06, // ## # # # ## ##
0xC9, 0x43, 0x8E, // ## # # # ### ###
0xC9, 0x73, 0xDE, // ## # # ### #### ####
0xE0, 0x07, 0xFE, // ### ##########
0xFF, 0xFF, 0xFE, // #######################
0x7F, 0xFF, 0xFC, // #####################
};
const BITMAP_INFO ThermostatHzIconInfo(23, 13, thermostatHzIcon);
//
// Image data for reset
//
const uint8_t PROGMEM resetIcon[] =
{
0x9E, 0x00, 0x00, // # ####
0xA1, 0x07, 0x00, // # # # ###
0xC0, 0x88, 0x80, // ## # # #
0xF0, 0x49, 0x80, // #### # # ##
0x00, 0x4A, 0x80, // # # # #
0x00, 0x4C, 0x80, // # ## #
0x00, 0x48, 0x80, // # # #
0x40, 0x87, 0x00, // # # ###
0x21, 0x00, 0x00, // # #
0x1E, 0x00, 0x00, // ####
};
const BITMAP_INFO resetIconInfo(17, 10, resetIcon);

View File

@ -77,6 +77,7 @@ extern const BITMAP_INFO LargeTimerIconInfo;
extern const BITMAP_INFO VerticalRepeatIconInfo;
extern const BITMAP_INFO CrossLgIconInfo;
extern const BITMAP_INFO CrossIconInfo;
// Bitmap for open
extern const BITMAP_INFO OpenIconInfo;
@ -129,4 +130,10 @@ extern const BITMAP_INFO UpdateIconInfo;
// Bitmap sizes for www
extern const BITMAP_INFO WWWIconInfo;
extern const BITMAP_INFO BowserIconInfo;
extern const BITMAP_INFO BowserIconInfo;
extern const BITMAP_INFO DegCIconInfo;
extern const BITMAP_INFO DegFIconInfo;
extern const BITMAP_INFO ThermostatDegCIconInfo;
extern const BITMAP_INFO ThermostatDegFIconInfo;
extern const BITMAP_INFO ThermostatHzIconInfo;
extern const BITMAP_INFO resetIconInfo;

View File

@ -187,7 +187,7 @@ RTC_DS3231Ex::readData(uint8_t* pData, int len, int ofs) {
Wire.endTransmission();
}
bool
void
RTC_DS3231Ex::resetLostPower()
{
Wire.beginTransmission(DS3231_ADDRESS);

View File

@ -30,7 +30,7 @@ class RTC_DS3231Ex : public RTC_DS3231 {
public:
void writeData(uint8_t* pData, int len, int ofs=0);
void readData(uint8_t* pData, int len, int ofs=0);
bool resetLostPower();
void resetLostPower();
};

View File

@ -43,6 +43,13 @@ CFuelGauge::init(float fuelUsed)
_lastStoredVal = _pumpStrokes;
}
void
CFuelGauge::reset()
{
_pumpStrokes = 0;
_lastStoredVal = _pumpStrokes;
RTC_Store.setFuelGauge(_pumpStrokes); // uses RTC registers to store this
}
void
CFuelGauge::Integrate(float Hz)
@ -64,7 +71,13 @@ CFuelGauge::Integrate(float Hz)
}
float
CFuelGauge::Used_mL()
CFuelGauge::Used_ml()
{
return _pumpStrokes * _pumpCal; // strokes * mL / stroke
return _pumpStrokes * _pumpCal; // strokes * millilitre / stroke
}
float
CFuelGauge::Used_strokes()
{
return _pumpStrokes;
}

View File

@ -32,9 +32,12 @@ class CFuelGauge {
public:
CFuelGauge();
void init(float fuelUsed = 0);
void reset();
void Integrate(float Hz);
float Used_mL();
float Used_ml();
float Used_strokes();
};
extern CFuelGauge FuelGauge;
#endif

View File

@ -152,6 +152,12 @@ struct CRect {
CRect() {
xPos = yPos = width = height = 0;
}
CRect(const CRect& a) {
xPos = a.xPos;
yPos = a.yPos;
width = a.width;
height = a.height;
}
void Expand(int val) {
xPos -= val;
yPos -= val;