GPIO screen now uses icons for inputs and outputs
This commit is contained in:
parent
45330be305
commit
a2fe5e969d
|
@ -41,8 +41,9 @@
|
||||||
|
|
||||||
CBasicScreen::CBasicScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreenHeader(display, mgr)
|
CBasicScreen::CBasicScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreenHeader(display, mgr)
|
||||||
{
|
{
|
||||||
_showSetMode = 0;
|
_showSetModeTime = 0;
|
||||||
_showMode = 0;
|
_showModeTime = 0;
|
||||||
|
_feedbackType = 0;
|
||||||
_nModeSel = 0;
|
_nModeSel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,11 +80,11 @@ CBasicScreen::show()
|
||||||
// Current heat demand setting
|
// Current heat demand setting
|
||||||
// Run state of heater
|
// Run state of heater
|
||||||
|
|
||||||
if(_showMode) {
|
if(_showModeTime) {
|
||||||
const int border = 3;
|
const int border = 3;
|
||||||
const int radius = 4;
|
const int radius = 4;
|
||||||
// Show selection between Fixed or Thermostat mode
|
// Show selection between Fixed or Thermostat mode
|
||||||
long tDelta = millis() - _showMode;
|
long tDelta = millis() - _showModeTime;
|
||||||
if(tDelta < 0) {
|
if(tDelta < 0) {
|
||||||
|
|
||||||
yPos = _display.height() - _display.textHeight() - border; // bottom of screen, with room for box
|
yPos = _display.height() - _display.textHeight() - border; // bottom of screen, with room for box
|
||||||
|
@ -102,35 +103,46 @@ CBasicScreen::show()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// cancel selection mode, apply whatever is boxed
|
// cancel selection mode, apply whatever is boxed
|
||||||
_showMode = 0;
|
_showModeTime = 0;
|
||||||
_showSetMode = millis() + 5000; // then make the new mode setting be shown
|
_showSetModeTime = millis() + 5000; // then make the new mode setting be shown
|
||||||
|
_feedbackType = 0;
|
||||||
|
_ScreenManager.reqUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((_showMode == 0) && _showSetMode) {
|
if((_showModeTime == 0) && _showSetModeTime) {
|
||||||
long tDelta = millis() - _showSetMode;
|
long tDelta = millis() - _showSetModeTime;
|
||||||
if(tDelta < 0) {
|
if(tDelta < 0) {
|
||||||
// Show current heat demand setting
|
switch(_feedbackType) {
|
||||||
if(getThermostatModeActive()) {
|
case 0:
|
||||||
float fTemp = getTemperatureDesired();
|
// Show current heat demand setting
|
||||||
if(NVstore.getDegFMode()) {
|
|
||||||
fTemp = fTemp * 9 / 5 + 32;
|
if(getThermostatModeActive()) {
|
||||||
sprintf(msg, "Setpoint = %.0f`F", fTemp);
|
float fTemp = getTemperatureDesired();
|
||||||
}
|
if(NVstore.getDegFMode()) {
|
||||||
else {
|
fTemp = fTemp * 9 / 5 + 32;
|
||||||
sprintf(msg, "Setpoint = %.0f`C", fTemp);
|
sprintf(msg, "Setpoint = %.0f`F", fTemp);
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
sprintf(msg, "Setpoint = %.0f`C", fTemp);
|
||||||
sprintf(msg, "Setpoint = %.1fHz", getHeaterInfo().getPump_Fixed());
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sprintf(msg, "Setpoint = %.1fHz", getHeaterInfo().getPump_Fixed());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
sprintf(msg, "GPIO output #%d %s", _feedbackType, getGPIO(_feedbackType-1) ? "ON" : "OFF");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
// centre message at bottom of screen
|
// centre message at bottom of screen
|
||||||
_printMenuText(_display.xCentre(), _display.height() - _display.textHeight(), msg, false, eCentreJustify);
|
_printMenuText(_display.xCentre(), _display.height() - _display.textHeight(), msg, false, eCentreJustify);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_showSetMode = 0;
|
_showSetModeTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((_showMode == 0) && (_showSetMode == 0)) {
|
if((_showModeTime == 0) && (_showSetModeTime == 0)) {
|
||||||
showRunState();
|
showRunState();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -144,51 +156,11 @@ CBasicScreen::keyHandler(uint8_t event)
|
||||||
|
|
||||||
if(event & keyPressed) {
|
if(event & keyPressed) {
|
||||||
repeatCount = 0; // unlock tracking of repeat events
|
repeatCount = 0; // unlock tracking of repeat events
|
||||||
/* // press LEFT to select previous screen, or Fixed Hz mode when in mode select
|
|
||||||
if(event & key_Left) {
|
|
||||||
if(!_showMode)
|
|
||||||
_ScreenManager.prevMenu();
|
|
||||||
else {
|
|
||||||
if(hasOEMcontroller())
|
|
||||||
_reqOEMWarning();
|
|
||||||
else {
|
|
||||||
_showMode = millis() + 5000;
|
|
||||||
_nModeSel = 0;
|
|
||||||
setThermostatMode(1); // set the new mode
|
|
||||||
NVstore.save();
|
|
||||||
}
|
|
||||||
_ScreenManager.reqUpdate();
|
|
||||||
}
|
|
||||||
}**/
|
|
||||||
/* // press RIGHT to select next screen, or Thermostat mode when in mode select
|
|
||||||
if(event & key_Right) {
|
|
||||||
if(!_showMode)
|
|
||||||
_ScreenManager.nextMenu();
|
|
||||||
else {
|
|
||||||
if(hasOEMcontroller())
|
|
||||||
_reqOEMWarning();
|
|
||||||
else {
|
|
||||||
_showMode = millis() + 5000;
|
|
||||||
_nModeSel = 1;
|
|
||||||
setThermostatMode(0); // set the new mode
|
|
||||||
NVstore.save();
|
|
||||||
}
|
|
||||||
_ScreenManager.reqUpdate();
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
// press UP & DOWN to toggle thermostat / fixed Hz mode
|
|
||||||
// impossible with 5 way switch!
|
|
||||||
uint8_t doubleKey = key_Down | key_Up;
|
|
||||||
if((event & doubleKey) == doubleKey) {
|
|
||||||
if(reqThermoToggle()) {
|
|
||||||
_showSetMode = millis() + 2000;
|
|
||||||
NVstore.save();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_reqOEMWarning();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
// use repeat function for key hold detection
|
// use repeat function for key hold detection
|
||||||
|
//
|
||||||
if(event & keyRepeat) {
|
if(event & keyRepeat) {
|
||||||
if(repeatCount >= 0) {
|
if(repeatCount >= 0) {
|
||||||
repeatCount++;
|
repeatCount++;
|
||||||
|
@ -197,6 +169,9 @@ CBasicScreen::keyHandler(uint8_t event)
|
||||||
if(repeatCount > 2) {
|
if(repeatCount > 2) {
|
||||||
repeatCount = -1; // prevent double handling
|
repeatCount = -1; // prevent double handling
|
||||||
setGPIO(0, !getGPIO(0)); // toggle GPIO output #1
|
setGPIO(0, !getGPIO(0)); // toggle GPIO output #1
|
||||||
|
_showSetModeTime = millis() + 2000;
|
||||||
|
_feedbackType = 1;
|
||||||
|
_ScreenManager.reqUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// hold RIGHT to toggle GPIO output #2
|
// hold RIGHT to toggle GPIO output #2
|
||||||
|
@ -204,13 +179,16 @@ CBasicScreen::keyHandler(uint8_t event)
|
||||||
if(repeatCount > 2) {
|
if(repeatCount > 2) {
|
||||||
repeatCount = -1; // prevent double handling
|
repeatCount = -1; // prevent double handling
|
||||||
setGPIO(1, !getGPIO(1)); // toggle GPIO output #2
|
setGPIO(1, !getGPIO(1)); // toggle GPIO output #2
|
||||||
|
_showSetModeTime = millis() + 2000;
|
||||||
|
_feedbackType = 2;
|
||||||
|
_ScreenManager.reqUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// hold DOWN to enter thermostat / fixed mode selection
|
// hold DOWN to enter thermostat / fixed mode selection
|
||||||
if(event & key_Down) {
|
if(event & key_Down) {
|
||||||
if(repeatCount > 2) {
|
if(repeatCount > 2) {
|
||||||
repeatCount = -1; // prevent double handling
|
repeatCount = -1; // prevent double handling
|
||||||
_showMode = millis() + 5000;
|
_showModeTime = millis() + 5000;
|
||||||
_nModeSel = getThermostatModeActive() ? 0 : 1;
|
_nModeSel = getThermostatModeActive() ? 0 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,7 +196,7 @@ CBasicScreen::keyHandler(uint8_t event)
|
||||||
if(event & key_Up) {
|
if(event & key_Up) {
|
||||||
if(repeatCount > 2) {
|
if(repeatCount > 2) {
|
||||||
repeatCount = -1; // prevent double handling
|
repeatCount = -1; // prevent double handling
|
||||||
_showMode = millis() + 5000;
|
_showModeTime = millis() + 5000;
|
||||||
NVstore.setDegFMode(NVstore.getDegFMode() ? 0 : 1);
|
NVstore.setDegFMode(NVstore.getDegFMode() ? 0 : 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,33 +219,43 @@ CBasicScreen::keyHandler(uint8_t event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// key released handling
|
||||||
|
//
|
||||||
if(event & keyReleased) {
|
if(event & keyReleased) {
|
||||||
if(!_showMode) {
|
if(!_showModeTime) {
|
||||||
// release DOWN key to reduce set demand, provided we are not in mode select
|
// release DOWN key to reduce set demand, provided we are not in mode select
|
||||||
if(event & key_Down) {
|
if(event & key_Down) {
|
||||||
if(reqTempDelta(-1))
|
if(reqTempDelta(-1)) {
|
||||||
_showSetMode = millis() + 2000;
|
_showSetModeTime = millis() + 2000;
|
||||||
|
_feedbackType = 0;
|
||||||
|
_ScreenManager.reqUpdate();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_reqOEMWarning();
|
_reqOEMWarning();
|
||||||
}
|
}
|
||||||
// release UP key to increase set demand, provided we are not in mode select
|
// release UP key to increase set demand, provided we are not in mode select
|
||||||
if(event & key_Up) {
|
if(event & key_Up) {
|
||||||
if(reqTempDelta(+1))
|
if(reqTempDelta(+1)) {
|
||||||
_showSetMode = millis() + 2000;
|
_showSetModeTime = millis() + 2000;
|
||||||
|
_feedbackType = 0;
|
||||||
|
_ScreenManager.reqUpdate();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_reqOEMWarning();
|
_reqOEMWarning();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(event & key_Left) {
|
if(event & key_Left) {
|
||||||
if(repeatCount >= 0) {
|
if(repeatCount >= 0) {
|
||||||
if(!_showMode) {
|
if(!_showModeTime) {
|
||||||
_ScreenManager.prevMenu();
|
_ScreenManager.prevMenu();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(hasOEMcontroller())
|
if(hasOEMcontroller())
|
||||||
_reqOEMWarning();
|
_reqOEMWarning();
|
||||||
else {
|
else {
|
||||||
_showMode = millis() + 5000;
|
_showModeTime = millis() + 5000;
|
||||||
_nModeSel = 0;
|
_nModeSel = 0;
|
||||||
setThermostatMode(1); // set the new mode
|
setThermostatMode(1); // set the new mode
|
||||||
NVstore.save();
|
NVstore.save();
|
||||||
|
@ -278,13 +266,13 @@ CBasicScreen::keyHandler(uint8_t event)
|
||||||
}
|
}
|
||||||
if(event & key_Right) {
|
if(event & key_Right) {
|
||||||
if(repeatCount >= 0) {
|
if(repeatCount >= 0) {
|
||||||
if(!_showMode)
|
if(!_showModeTime)
|
||||||
_ScreenManager.nextMenu();
|
_ScreenManager.nextMenu();
|
||||||
else {
|
else {
|
||||||
if(hasOEMcontroller())
|
if(hasOEMcontroller())
|
||||||
_reqOEMWarning();
|
_reqOEMWarning();
|
||||||
else {
|
else {
|
||||||
_showMode = millis() + 5000;
|
_showModeTime = millis() + 5000;
|
||||||
_nModeSel = 1;
|
_nModeSel = 1;
|
||||||
setThermostatMode(0); // set the new mode
|
setThermostatMode(0); // set the new mode
|
||||||
NVstore.save();
|
NVstore.save();
|
||||||
|
@ -296,10 +284,11 @@ CBasicScreen::keyHandler(uint8_t event)
|
||||||
// release CENTRE to accept new mode, and/or show current setting
|
// release CENTRE to accept new mode, and/or show current setting
|
||||||
if(event & key_Centre) {
|
if(event & key_Centre) {
|
||||||
if(repeatCount != -2) { // prevent after off commands
|
if(repeatCount != -2) { // prevent after off commands
|
||||||
if(_showMode) {
|
if(_showModeTime) {
|
||||||
_showMode = millis(); // force immediate cancellation of showmode (via screen update)
|
_showModeTime = millis(); // force immediate cancellation of showmode (via screen update)
|
||||||
}
|
}
|
||||||
_showSetMode = millis() + 2000;
|
_showSetModeTime = millis() + 2000;
|
||||||
|
_feedbackType = 0;
|
||||||
}
|
}
|
||||||
_ScreenManager.reqUpdate();
|
_ScreenManager.reqUpdate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,9 @@ class CProtocolPackage;
|
||||||
|
|
||||||
class CBasicScreen : public CScreenHeader
|
class CBasicScreen : public CScreenHeader
|
||||||
{
|
{
|
||||||
unsigned long _showSetMode;
|
unsigned long _showSetModeTime;
|
||||||
unsigned long _showMode;
|
unsigned char _feedbackType;
|
||||||
|
unsigned long _showModeTime;
|
||||||
unsigned char _nModeSel;
|
unsigned char _nModeSel;
|
||||||
void showRunState();
|
void showRunState();
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -79,14 +79,6 @@ CClockScreen::keyHandler(uint8_t event)
|
||||||
{
|
{
|
||||||
if(event & keyPressed) {
|
if(event & keyPressed) {
|
||||||
_keyRepeatCount = 0; // unlock tracking of repeat events
|
_keyRepeatCount = 0; // unlock tracking of repeat events
|
||||||
// press LEFT
|
|
||||||
/* if(event & key_Left) {
|
|
||||||
_ScreenManager.prevMenu();
|
|
||||||
}
|
|
||||||
// press RIGHT
|
|
||||||
if(event & key_Right) {
|
|
||||||
_ScreenManager.nextMenu();
|
|
||||||
}*/
|
|
||||||
// press UP
|
// press UP
|
||||||
if(event & key_Up) {
|
if(event & key_Up) {
|
||||||
_ScreenManager.selectMenu(CScreenManager::BranchMenu, CScreenManager::SetClockUI); // switch to clock set screen
|
_ScreenManager.selectMenu(CScreenManager::BranchMenu, CScreenManager::SetClockUI); // switch to clock set screen
|
||||||
|
|
|
@ -176,12 +176,6 @@ CDetailedScreen::keyHandler(uint8_t event)
|
||||||
|
|
||||||
if(event & keyPressed) {
|
if(event & keyPressed) {
|
||||||
_keyRepeatCount = 0; // unlock tracking of repeat events
|
_keyRepeatCount = 0; // unlock tracking of repeat events
|
||||||
/* if(event & key_Left) {
|
|
||||||
_ScreenManager.prevMenu();
|
|
||||||
}
|
|
||||||
if(event & key_Right) {
|
|
||||||
_ScreenManager.nextMenu();
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
// require hold to turn ON or OFF
|
// require hold to turn ON or OFF
|
||||||
if(event & keyRepeat) {
|
if(event & keyRepeat) {
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "../Utility/UtilClasses.h"
|
#include "../Utility/UtilClasses.h"
|
||||||
#include "../Utility/NVStorage.h"
|
#include "../Utility/NVStorage.h"
|
||||||
#include "../Utility/GPIO.h"
|
#include "../Utility/GPIO.h"
|
||||||
|
#include "fonts/Icons.h"
|
||||||
|
|
||||||
extern CGPIOout GPIOout;
|
extern CGPIOout GPIOout;
|
||||||
extern CGPIOin GPIOin;
|
extern CGPIOin GPIOin;
|
||||||
|
@ -296,3 +297,100 @@ CGPIOScreen::_adjust(int dir)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CGPIOInfoScreen::CGPIOInfoScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreenHeader(display, mgr)
|
||||||
|
{
|
||||||
|
_keyRepeatCount = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CGPIOInfoScreen::onSelect()
|
||||||
|
{
|
||||||
|
CScreenHeader::onSelect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CGPIOInfoScreen::_initUI()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CGPIOInfoScreen::show()
|
||||||
|
{
|
||||||
|
CScreenHeader::show();
|
||||||
|
|
||||||
|
_display.writeFillRect(49, 18, 30, 12, WHITE);
|
||||||
|
_printInverted(64, 20, "GPIO", true, eCentreJustify);
|
||||||
|
_printMenuText(22, 18, "In", false, eCentreJustify);
|
||||||
|
_printMenuText(104, 18, "Out", false, eCentreJustify);
|
||||||
|
_printMenuText(11, 20, "1", false, eCentreJustify);
|
||||||
|
_printMenuText(34, 20, "2", false, eCentreJustify);
|
||||||
|
_printMenuText(91, 20, "1", false, eCentreJustify);
|
||||||
|
_printMenuText(118, 20, "2", false, eCentreJustify);
|
||||||
|
|
||||||
|
_printMenuText(55, Line1, "Analogue:", false, eRightJustify);
|
||||||
|
|
||||||
|
_display.drawBitmap(4, 29, GPIOin.getState(0) ? CloseIcon : OpenIcon, CloseIconWidth, CloseIconHeight, WHITE);
|
||||||
|
_display.drawBitmap(27, 29, GPIOin.getState(1) ? CloseIcon : OpenIcon, CloseIconWidth, CloseIconHeight, WHITE);
|
||||||
|
|
||||||
|
_display.drawBitmap(86, 29, GPIOout.getState(0) ? BulbOnIcon : BulbOffIcon, BulbOnIconWidth, BulbOnIconHeight, WHITE);
|
||||||
|
_display.drawBitmap(113, 29, GPIOout.getState(1) ? BulbOnIcon : BulbOffIcon, BulbOnIconWidth, BulbOnIconHeight, WHITE);
|
||||||
|
|
||||||
|
_printMenuText(_display.xCentre(), 53, " \021 \030Edit \020 ", true, eCentreJustify);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
CGPIOInfoScreen::keyHandler(uint8_t event)
|
||||||
|
{
|
||||||
|
if(event & keyPressed) {
|
||||||
|
_keyRepeatCount = 0; // unlock tracking of repeat events
|
||||||
|
// UP press
|
||||||
|
if(event & key_Up) {
|
||||||
|
}
|
||||||
|
// CENTRE press
|
||||||
|
if(event & key_Centre) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(event & keyRepeat) {
|
||||||
|
if(_keyRepeatCount >= 0) {
|
||||||
|
_keyRepeatCount++;
|
||||||
|
// hold LEFT to toggle GPIO output #1
|
||||||
|
if(event & key_Left) {
|
||||||
|
if(_keyRepeatCount > 2) {
|
||||||
|
_keyRepeatCount = -1; // prevent double handling
|
||||||
|
setGPIO(0, !getGPIO(0)); // toggle GPIO output #1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// hold RIGHT to toggle GPIO output #2
|
||||||
|
if(event & key_Right) {
|
||||||
|
if(_keyRepeatCount > 2) {
|
||||||
|
_keyRepeatCount = -1; // prevent double handling
|
||||||
|
setGPIO(1, !getGPIO(1)); // toggle GPIO output #2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// release event
|
||||||
|
if(event & keyReleased) {
|
||||||
|
if(_keyRepeatCount == 0) { // short Up press - lower target
|
||||||
|
// press LEFT to select previous screen
|
||||||
|
if(event & key_Left) {
|
||||||
|
_ScreenManager.prevMenu();
|
||||||
|
}
|
||||||
|
// press RIGHT to select next screen
|
||||||
|
if(event & key_Right) {
|
||||||
|
_ScreenManager.nextMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_keyRepeatCount = -1;
|
||||||
|
}
|
||||||
|
_ScreenManager.reqUpdate();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,4 +46,15 @@ public:
|
||||||
void onSelect();
|
void onSelect();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CGPIOInfoScreen : public CScreenHeader
|
||||||
|
{
|
||||||
|
int _keyRepeatCount;
|
||||||
|
void _initUI();
|
||||||
|
public:
|
||||||
|
CGPIOInfoScreen(C128x64_OLED& display, CScreenManager& mgr);
|
||||||
|
bool show();
|
||||||
|
bool keyHandler(uint8_t event);
|
||||||
|
void onSelect();
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,17 +35,28 @@
|
||||||
|
|
||||||
#define MINIFONT miniFontInfo
|
#define MINIFONT miniFontInfo
|
||||||
|
|
||||||
#define X_BATT_ICON 103
|
|
||||||
#define Y_BATT_ICON 0
|
|
||||||
#define X_WIFI_ICON 19
|
|
||||||
#define Y_WIFI_ICON 0
|
|
||||||
#define X_BT_ICON 10
|
#define X_BT_ICON 10
|
||||||
#define Y_BT_ICON 0
|
#define Y_BT_ICON 0
|
||||||
#define X_TIMER1_ICON 69
|
#define X_WIFI_ICON 19
|
||||||
#define X_TIMER2_ICON 83
|
#define Y_WIFI_ICON 0
|
||||||
#define Y_TIMER_ICON 0
|
#define X_CLOCK 50
|
||||||
#define X_CLOCK 52
|
|
||||||
#define Y_CLOCK 0
|
#define Y_CLOCK 0
|
||||||
|
#define X_TIMER_ICON 83
|
||||||
|
#define Y_TIMER_ICON 0
|
||||||
|
#define X_BATT_ICON 103
|
||||||
|
#define Y_BATT_ICON 0
|
||||||
|
|
||||||
|
/*#define X_BT_ICON 20
|
||||||
|
#define Y_BT_ICON 0
|
||||||
|
#define X_WIFI_ICON 29
|
||||||
|
#define Y_WIFI_ICON 0
|
||||||
|
#define X_GPIO_ICON 9
|
||||||
|
#define X_CLOCK 56
|
||||||
|
#define Y_CLOCK 0
|
||||||
|
#define X_TIMER_ICON 84
|
||||||
|
#define Y_TIMER_ICON 0
|
||||||
|
#define X_BATT_ICON 103
|
||||||
|
#define Y_BATT_ICON 0*/
|
||||||
|
|
||||||
|
|
||||||
CScreenHeader::CScreenHeader(C128x64_OLED& disp, CScreenManager& mgr) : CScreen(disp, mgr)
|
CScreenHeader::CScreenHeader(C128x64_OLED& disp, CScreenManager& mgr) : CScreen(disp, mgr)
|
||||||
|
@ -73,6 +84,9 @@ CScreenHeader::show()
|
||||||
// timers
|
// timers
|
||||||
int numTimers = showTimers();
|
int numTimers = showTimers();
|
||||||
|
|
||||||
|
// // GPIO
|
||||||
|
// showGPIO();
|
||||||
|
|
||||||
// clock
|
// clock
|
||||||
showTime(numTimers);
|
showTime(numTimers);
|
||||||
|
|
||||||
|
@ -142,7 +156,7 @@ CScreenHeader::animate()
|
||||||
void
|
void
|
||||||
CScreenHeader::showBTicon()
|
CScreenHeader::showBTicon()
|
||||||
{
|
{
|
||||||
if(getBluetoothClient().isConnected()) {
|
if(getBluetoothClient().isConnected() || true) {
|
||||||
_display.drawBitmap(X_BT_ICON, Y_BT_ICON, BTicon, W_BT_ICON, H_BT_ICON, WHITE);
|
_display.drawBitmap(X_BT_ICON, Y_BT_ICON, BTicon, W_BT_ICON, H_BT_ICON, WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,7 +221,7 @@ CScreenHeader::showTimers()
|
||||||
{
|
{
|
||||||
int nextTimer = CTimerManager::getNextTimer();
|
int nextTimer = CTimerManager::getNextTimer();
|
||||||
if(nextTimer) {
|
if(nextTimer) {
|
||||||
int xPos = X_TIMER2_ICON; // both are enabled - draw icon 1 to the left, otherwise leave to the right
|
int xPos = X_TIMER_ICON;
|
||||||
_display.drawBitmap(xPos, Y_TIMER_ICON, largeTimerIcon, W_TIMER_ICON, H_TIMER_ICON, WHITE);
|
_display.drawBitmap(xPos, Y_TIMER_ICON, largeTimerIcon, W_TIMER_ICON, H_TIMER_ICON, WHITE);
|
||||||
if(nextTimer & 0x80)
|
if(nextTimer & 0x80)
|
||||||
_display.drawBitmap(xPos-3, Y_TIMER_ICON, verticalRepeatIcon, verticalRepeatWidthPixels, verticalRepeatHeightPixels, WHITE);
|
_display.drawBitmap(xPos-3, Y_TIMER_ICON, verticalRepeatIcon, verticalRepeatWidthPixels, verticalRepeatHeightPixels, WHITE);
|
||||||
|
@ -248,11 +262,31 @@ CScreenHeader::showTime(int numTimers)
|
||||||
int xPos = X_WIFI_ICON + W_WIFI_ICON + W_WIFIIN_ICON; // rhs of wifi conglomeration
|
int xPos = X_WIFI_ICON + W_WIFI_ICON + W_WIFIIN_ICON; // rhs of wifi conglomeration
|
||||||
if(isWifiAP()) xPos += 4; // add more if an Access Point
|
if(isWifiAP()) xPos += 4; // add more if an Access Point
|
||||||
|
|
||||||
switch(numTimers) {
|
/* switch(numTimers) {
|
||||||
case 0: xPos = _display.xCentre(); break;
|
case 0: xPos = _display.xCentre(); break;
|
||||||
case 1: xPos += (X_TIMER2_ICON - xPos) / 2; break;
|
case 1: xPos += (X_TIMER_ICON - xPos) / 2; break;
|
||||||
case 2: xPos += (X_TIMER1_ICON - xPos) / 2; break;
|
|
||||||
}
|
}
|
||||||
_printMenuText(xPos, Y_CLOCK, msg, false, eCentreJustify);
|
_printMenuText(xPos, Y_CLOCK, msg, false, eCentreJustify);*/
|
||||||
|
_printMenuText(X_CLOCK, Y_CLOCK, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CScreenHeader::showGPIO()
|
||||||
|
{
|
||||||
|
/* int xPos = X_GPIO_ICON; // both are enabled - draw icon 1 to the left, otherwise leave to the right
|
||||||
|
CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font
|
||||||
|
_display.setCursor(xPos, 0);
|
||||||
|
_display.print("1");
|
||||||
|
_display.drawBitmap(xPos + 4, 0, getGPIO(0) ? TickIcon : CrossIcon, TickIconWidth, TickIconHeight, WHITE);
|
||||||
|
_display.setCursor(xPos, 6);
|
||||||
|
_display.print("2");
|
||||||
|
_display.drawBitmap(xPos + 4, 6, getGPIO(1) ? TickIcon : CrossIcon, TickIconWidth, TickIconHeight, WHITE);*/
|
||||||
|
}
|
||||||
|
/*void
|
||||||
|
CScreenHeader::showGPIO()
|
||||||
|
{
|
||||||
|
int xPos = X_GPIO_ICON; // both are enabled - draw icon 1 to the left, otherwise leave to the right
|
||||||
|
_display.drawBitmap(xPos, 0, getGPIO(0) ? GPIO1ONIcon : GPIO1OFFIcon, GPIOIconWidthPixels, GPIOIconHeightPixels, WHITE);
|
||||||
|
_display.drawBitmap(xPos, 8, getGPIO(1) ? GPIO2ONIcon : GPIO2OFFIcon, GPIOIconWidthPixels, GPIOIconHeightPixels, WHITE);
|
||||||
|
}*/
|
||||||
|
|
|
@ -38,6 +38,7 @@ protected:
|
||||||
void showBatteryIcon(float voltage);
|
void showBatteryIcon(float voltage);
|
||||||
int showTimers();
|
int showTimers();
|
||||||
virtual void showTime(int numTimers); // x location depends upon how many timers are active
|
virtual void showTime(int numTimers); // x location depends upon how many timers are active
|
||||||
|
void showGPIO();
|
||||||
public:
|
public:
|
||||||
CScreenHeader(C128x64_OLED& disp, CScreenManager& mgr);
|
CScreenHeader(C128x64_OLED& disp, CScreenManager& mgr);
|
||||||
bool show();
|
bool show();
|
||||||
|
|
|
@ -180,7 +180,8 @@ CScreenManager::begin(bool bNoClock)
|
||||||
menuloop.push_back(new CClockScreen(*_pDisplay, *this)); // clock
|
menuloop.push_back(new CClockScreen(*_pDisplay, *this)); // clock
|
||||||
menuloop.push_back(new CPrimingScreen(*_pDisplay, *this)); // mode / priming
|
menuloop.push_back(new CPrimingScreen(*_pDisplay, *this)); // mode / priming
|
||||||
menuloop.push_back(new CWiFiScreen(*_pDisplay, *this)); // comms info
|
menuloop.push_back(new CWiFiScreen(*_pDisplay, *this)); // comms info
|
||||||
menuloop.push_back(new CSettingsScreen(*_pDisplay, *this)); // tuning info
|
menuloop.push_back(new CGPIOInfoScreen(*_pDisplay, *this)); // GPIO info
|
||||||
|
menuloop.push_back(new CSettingsScreen(*_pDisplay, *this)); // Tuning info
|
||||||
_Screens.push_back(menuloop);
|
_Screens.push_back(menuloop);
|
||||||
// create timer screens loop
|
// create timer screens loop
|
||||||
menuloop.clear();
|
menuloop.clear();
|
||||||
|
|
|
@ -44,7 +44,7 @@ class CScreenManager {
|
||||||
void _changeSubMenu(int dir);
|
void _changeSubMenu(int dir);
|
||||||
public:
|
public:
|
||||||
enum eUIMenuSets { RootMenuLoop, TimerMenuLoop, TuningMenuLoop, UserSettingsLoop, BranchMenu };
|
enum eUIMenuSets { RootMenuLoop, TimerMenuLoop, TuningMenuLoop, UserSettingsLoop, BranchMenu };
|
||||||
enum eUIRootMenus { DetailedControlUI, BasicControlUI, ClockUI, ModeUI, CommsUI, SettingsUI };
|
enum eUIRootMenus { DetailedControlUI, BasicControlUI, ClockUI, ModeUI, CommsUI, GPIOInfoUI, SettingsUI };
|
||||||
enum eUITimerMenus { TimerOverviewUI, Timer1UI, Timer2UI, Timer3UI, Timer4UI, Timer5UI, Timer6UI, Timer7UI,
|
enum eUITimerMenus { TimerOverviewUI, Timer1UI, Timer2UI, Timer3UI, Timer4UI, Timer5UI, Timer6UI, Timer7UI,
|
||||||
Timer8UI, Timer9UI, Timer10UI, Timer11UI, Timer12UI, Timer13UI, Timer14UI };
|
Timer8UI, Timer9UI, Timer10UI, Timer11UI, Timer12UI, Timer13UI, Timer14UI };
|
||||||
enum eUITuningMenus { MixtureUI, HeaterSettingsUI };
|
enum eUITuningMenus { MixtureUI, HeaterSettingsUI };
|
||||||
|
|
|
@ -178,4 +178,120 @@ const uint8_t PROGMEM verticalRepeatIcon [] =
|
||||||
0x20, // #
|
0x20, // #
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint8_t PROGMEM GPIO1OFFIcon[] =
|
||||||
|
{
|
||||||
|
0x3E, 0x00, // #####
|
||||||
|
0x41, 0x00, // # #
|
||||||
|
0x88, 0x80, // # # #
|
||||||
|
0x98, 0x80, // # ## #
|
||||||
|
0x88, 0x80, // # # #
|
||||||
|
0x88, 0x80, // # # #
|
||||||
|
0x9C, 0x80, // # ### #
|
||||||
|
0x41, 0x00, // # #
|
||||||
|
0x3E, 0x00, // #####
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t PROGMEM GPIO1ONIcon[] =
|
||||||
|
{
|
||||||
|
0x3E, 0x00, // #####
|
||||||
|
0x7F, 0x00, // #######
|
||||||
|
0xF7, 0x80, // #### ####
|
||||||
|
0xE7, 0x80, // ### ####
|
||||||
|
0xF7, 0x80, // #### ####
|
||||||
|
0xF7, 0x80, // #### ####
|
||||||
|
0xE3, 0x80, // ### ###
|
||||||
|
0x7F, 0x00, // #######
|
||||||
|
0x3E, 0x00, // #####
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t PROGMEM GPIO2OFFIcon[] =
|
||||||
|
{
|
||||||
|
0x3E, 0x00, // #####
|
||||||
|
0x41, 0x00, // # #
|
||||||
|
0x9C, 0x80, // # ### #
|
||||||
|
0x84, 0x80, // # # #
|
||||||
|
0x9C, 0x80, // # ### #
|
||||||
|
0x90, 0x80, // # # #
|
||||||
|
0x9C, 0x80, // # ### #
|
||||||
|
0x41, 0x00, // # #
|
||||||
|
0x3E, 0x00, // #####
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t PROGMEM GPIO2ONIcon[] =
|
||||||
|
{
|
||||||
|
0x3E, 0x00, // #####
|
||||||
|
0x7F, 0x00, // #######
|
||||||
|
0xE3, 0x80, // ### ###
|
||||||
|
0xFB, 0x80, // ##### ###
|
||||||
|
0xE3, 0x80, // ### ###
|
||||||
|
0xEF, 0x80, // ### #####
|
||||||
|
0xE3, 0x80, // ### ###
|
||||||
|
0x7F, 0x00, // #######
|
||||||
|
0x3E, 0x00, // #####
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t PROGMEM CrossIcon[] =
|
||||||
|
{
|
||||||
|
0x88, // # #
|
||||||
|
0x50, // # #
|
||||||
|
0x20, // #
|
||||||
|
0x50, // # #
|
||||||
|
0x88, // # #
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t PROGMEM TickIcon[] =
|
||||||
|
{
|
||||||
|
0x00, //
|
||||||
|
0x08, // #
|
||||||
|
0x10, // #
|
||||||
|
0xa0, // # #
|
||||||
|
0x40, // #
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t PROGMEM OpenIcon[] =
|
||||||
|
{
|
||||||
|
0x1F, 0xC0, // #######
|
||||||
|
0x02, 0x00, // #
|
||||||
|
0x02, 0x00, // #
|
||||||
|
0x3A, 0xE0, // ### # ###
|
||||||
|
0xEA, 0xB8, // ### # # # ###
|
||||||
|
0x3A, 0xE0, // ### # ###
|
||||||
|
0x00, 0x00, //
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t PROGMEM CloseIcon[] =
|
||||||
|
{
|
||||||
|
0x00, 0x00, //
|
||||||
|
0x00, 0x00, //
|
||||||
|
0x3F, 0xE0, // #########
|
||||||
|
0x3A, 0xE0, // ### # ###
|
||||||
|
0xFA, 0xF8, // ##### # #####
|
||||||
|
0x3A, 0xE0, // ### # ###
|
||||||
|
0x02, 0x00, // #
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const uint8_t PROGMEM BulbOnIcon[] =
|
||||||
|
{
|
||||||
|
0x08, 0x00, // #
|
||||||
|
0x41, 0x00, // # #
|
||||||
|
0x1C, 0x00, // ###
|
||||||
|
0x22, 0x00, // # #
|
||||||
|
0xA2, 0x80, // # # # #
|
||||||
|
0x1C, 0x00, // ###
|
||||||
|
0x14, 0x00, // # #
|
||||||
|
0x1C, 0x00, // ###
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t PROGMEM BulbOffIcon[] =
|
||||||
|
{
|
||||||
|
0x00, 0x00, //
|
||||||
|
0x00, 0x00, //
|
||||||
|
0x1C, 0x00, // ###
|
||||||
|
0x22, 0x00, // # #
|
||||||
|
0x22, 0x00, // # #
|
||||||
|
0x1C, 0x00, // ###
|
||||||
|
0x14, 0x00, // # #
|
||||||
|
0x1C, 0x00, // ###
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,41 @@ extern const unsigned char timerID2Icon [];
|
||||||
extern const unsigned char timerIcon [];
|
extern const unsigned char timerIcon [];
|
||||||
extern const unsigned char largeTimerIcon [];
|
extern const unsigned char largeTimerIcon [];
|
||||||
extern const uint8_t verticalRepeatIcon [];
|
extern const uint8_t verticalRepeatIcon [];
|
||||||
|
extern const uint8_t GPIO1OFFIcon[];
|
||||||
|
extern const uint8_t GPIO1ONIcon[];
|
||||||
|
extern const uint8_t GPIO2OFFIcon[];
|
||||||
|
extern const uint8_t GPIO2ONIcon[];
|
||||||
|
extern const uint8_t CrossIcon[];
|
||||||
|
extern const uint8_t TickIcon[];
|
||||||
// Bitmap sizes for verticalRepeat
|
// Bitmap sizes for verticalRepeat
|
||||||
const uint8_t verticalRepeatWidthPixels = 6;
|
const uint8_t verticalRepeatWidthPixels = 6;
|
||||||
const uint8_t verticalRepeatHeightPixels = 15;
|
const uint8_t verticalRepeatHeightPixels = 15;
|
||||||
|
|
||||||
|
// Bitmap sizes for GPIOIcons
|
||||||
|
const uint8_t GPIOIconWidthPixels = 9;
|
||||||
|
const uint8_t GPIOIconHeightPixels = 9;
|
||||||
|
|
||||||
|
// Bitmap sizes for TickIcons
|
||||||
|
const uint8_t TickIconWidth = 5;
|
||||||
|
const uint8_t TickIconHeight = 5;
|
||||||
|
|
||||||
|
// Bitmap for open
|
||||||
|
extern const uint8_t OpenIcon[];
|
||||||
|
const uint8_t OpenIconWidth = 13;
|
||||||
|
const uint8_t OpenIconHeight = 7;
|
||||||
|
|
||||||
|
// Bitmap for close
|
||||||
|
extern const uint8_t CloseIcon[];
|
||||||
|
const uint8_t CloseIconWidth = 13;
|
||||||
|
const uint8_t CloseIconHeight = 7;
|
||||||
|
|
||||||
|
// Bitmap for BulbOn
|
||||||
|
extern const uint8_t BulbOnIcon[];
|
||||||
|
const uint8_t BulbOnIconWidth = 9;
|
||||||
|
const uint8_t BulbOnIconHeight = 8;
|
||||||
|
|
||||||
|
// Bitmap for BulbOff
|
||||||
|
extern const uint8_t BulbOffIcon[];
|
||||||
|
const uint8_t BulbOffIconWidth = 9;
|
||||||
|
const uint8_t BulbOffIconHeight = 8;
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,13 @@ CGPIOin::begin(int pin1, int pin2, GPIOinModes mode)
|
||||||
setMode(mode);
|
setMode(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t
|
||||||
|
CGPIOin::getState(int channel)
|
||||||
|
{
|
||||||
|
int mask = 0x01 << (channel & 0x01);
|
||||||
|
return (_debouncedPins & mask) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CGPIOin::manage()
|
CGPIOin::manage()
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
void setMode(GPIOinModes mode) { _Mode = mode; };
|
void setMode(GPIOinModes mode) { _Mode = mode; };
|
||||||
void begin(int pin1, int pin2, GPIOinModes mode);
|
void begin(int pin1, int pin2, GPIOinModes mode);
|
||||||
void manage();
|
void manage();
|
||||||
|
uint8_t getState(int channel);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CGPIOout {
|
class CGPIOout {
|
||||||
|
|
1
Bootload/COM.bat
Normal file
1
Bootload/COM.bat
Normal file
|
@ -0,0 +1 @@
|
||||||
|
esptool.exe --chip esp32 --port COM11 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 boot_app0.bin 0x1000 bootloader_qio_80m.bin 0x10000 BTCDieselHeater.ino.bin 0x8000 BTCDieselHeater.ino.partitions.bin
|
1
Bootload/OTA.bat
Normal file
1
Bootload/OTA.bat
Normal file
|
@ -0,0 +1 @@
|
||||||
|
espota.exe -i 192.168.20.40 -p 3232 --auth= -f BTCDieselHeater.ino.bin
|
BIN
Bootload/bootload.zip
Normal file
BIN
Bootload/bootload.zip
Normal file
Binary file not shown.
BIN
Bootload/espota.exe
Normal file
BIN
Bootload/espota.exe
Normal file
Binary file not shown.
BIN
Bootload/esptool.exe
Normal file
BIN
Bootload/esptool.exe
Normal file
Binary file not shown.
Loading…
Reference in a new issue