Board detect bug fix. New icons for GPIO setup/status
This commit is contained in:
parent
4873fa8c71
commit
d7e083b837
|
@ -1,5 +1,5 @@
|
|||
REM Firmware
|
||||
esptool.exe --chip esp32 --port COM16 --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 AfterburnerV3.0.2.bin 0x8000 Afterburner.partitions.bin
|
||||
esptool.exe --chip esp32 --port COM16 --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 AfterburnerV3.0.3.bin 0x8000 Afterburner.partitions.bin
|
||||
REM SPIFFS
|
||||
esptool.exe --chip esp32 --port COM16 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_size detect 0x3d0000 spiffs.bin
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 182 B |
Binary file not shown.
After Width: | Height: | Size: 190 B |
Binary file not shown.
After Width: | Height: | Size: 154 B |
Binary file not shown.
After Width: | Height: | Size: 190 B |
|
@ -64,19 +64,19 @@ sample code bearing this copyright.
|
|||
|
||||
#undef OW_DEBUG
|
||||
|
||||
// reference for bus timings:
|
||||
// https://www.maximintegrated.com/en/app-notes/index.mvp/id/126
|
||||
|
||||
|
||||
// bus reset: duration of low phase [us]
|
||||
#define OW_DURATION_RESET 480
|
||||
// overall slot duration
|
||||
//#define OW_DURATION_SLOT 75
|
||||
#define OW_DURATION_SLOT 70
|
||||
#define OW_DURATION_SLOT 75 // > 'A' + 'B' OR 'C' + 'D' in timing spec
|
||||
// write 1 slot and read slot durations [us]
|
||||
//#define OW_DURATION_1_LOW 2
|
||||
#define OW_DURATION_1_LOW 6
|
||||
#define OW_DURATION_1_LOW 6 // 'A' in timing spec
|
||||
#define OW_DURATION_1_HIGH (OW_DURATION_SLOT - OW_DURATION_1_LOW)
|
||||
// write 0 slot durations [us]
|
||||
//#define OW_DURATION_0_LOW 65
|
||||
#define OW_DURATION_0_LOW 60
|
||||
#define OW_DURATION_0_LOW 60 // 'C' in timing spec
|
||||
#define OW_DURATION_0_HIGH (OW_DURATION_SLOT - OW_DURATION_0_LOW)
|
||||
// sample time for read slot
|
||||
//#define OW_DURATION_SAMPLE (15-2)
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
|
||||
const int FirmwareRevision = 30;
|
||||
const int FirmwareSubRevision = 3;
|
||||
const char* FirmwareDate = "7 Aug 2019";
|
||||
const char* FirmwareDate = "10 Aug 2019";
|
||||
|
||||
|
||||
#ifdef ESP32
|
||||
|
|
|
@ -330,7 +330,7 @@ CDetailedScreen::showThermometer(float fDesired, float fActual, float fPump)
|
|||
// may be suppressed if not in normal start or run state
|
||||
if((fDesired != 0) || (fPump != 0)) {
|
||||
if(getThermostatModeActive() && getExternalThermostatModeActive()) {
|
||||
_drawBitmap(X_TARGET_ICON-2, Y_TARGET_ICON+1, ExtThermoIconInfo); // draw external input #2 icon
|
||||
_drawBitmap(X_TARGET_ICON-1, Y_TARGET_ICON, ExtThermo2IconInfo); // draw external input #2 icon
|
||||
if(getExternalThermostatOn())
|
||||
_drawBitmap(X_TARGET_ICON-2, Y_TARGET_ICON+9, CloseIconInfo); // draw external input #2 icon
|
||||
else
|
||||
|
|
|
@ -42,8 +42,8 @@ extern CGPIOalg GPIOalg;
|
|||
static const int Line3 = 14;
|
||||
static const int Line2 = 27;
|
||||
static const int Line1 = 40;
|
||||
static const int Column1 = 26;
|
||||
static const int Column2 = 85;
|
||||
static const int Column1 = 19;
|
||||
static const int Column2 = 83;
|
||||
|
||||
CGPIOSetupScreen::CGPIOSetupScreen(C128x64_OLED& display, CScreenManager& mgr) : CPasswordScreen(display, mgr)
|
||||
{
|
||||
|
@ -84,58 +84,66 @@ CGPIOSetupScreen::show()
|
|||
_showConfirmMessage();
|
||||
}
|
||||
else {
|
||||
_showTitle("GPIO Settings");
|
||||
_drawBitmap(0, 14, (getBoardRevision() != BRD_V2_GPIO_NOALG) ? GPIOIconInfo : GPIOIconNoAlgInfo);
|
||||
_showTitle("GPIO Configuration");
|
||||
_drawBitmap(0, Line3, InputIconInfo);
|
||||
_drawBitmap(11, Line3, _1IconInfo);
|
||||
{
|
||||
const char* msgText = NULL;
|
||||
switch(_GPIOparams.in1Mode) {
|
||||
case CGPIOin1::Disabled: msgText = "1: --- "; break;
|
||||
case CGPIOin1::On: msgText = "1:Start"; break;
|
||||
case CGPIOin1::Hold: msgText = "1: Run "; break;
|
||||
case CGPIOin1::OnOff: msgText = animated ? "1:Start" : "1: Stop"; break;
|
||||
case CGPIOin1::Disabled: msgText = " --- "; break;
|
||||
case CGPIOin1::Start: msgText = "Start"; break;
|
||||
case CGPIOin1::Run: msgText = "Run "; break;
|
||||
case CGPIOin1::StartStop: msgText = animated ? "Start" : "Stop "; break;
|
||||
}
|
||||
if(msgText)
|
||||
_printMenuText(Column1, Line3, msgText, _rowSel == 4);
|
||||
_printMenuText(Column1, Line3, msgText, _rowSel == 3);
|
||||
}
|
||||
_drawBitmap(0, Line2, InputIconInfo);
|
||||
_drawBitmap(11, Line2, _2IconInfo);
|
||||
{
|
||||
const char* msgText = NULL;
|
||||
switch(_GPIOparams.in2Mode) {
|
||||
case CGPIOin2::Disabled: msgText = "2: ---"; break;
|
||||
case CGPIOin2::Off: msgText = "2:Stop"; break;
|
||||
case CGPIOin2::Thermostat: msgText = "2: \352T "; break;
|
||||
}
|
||||
if(msgText)
|
||||
_printMenuText(Column2, Line3, msgText, _rowSel == 5);
|
||||
}
|
||||
|
||||
{
|
||||
const char* msgText = NULL;
|
||||
switch(_GPIOparams.out1Mode) {
|
||||
case CGPIOout1::Disabled: msgText = "1: --- "; break;
|
||||
case CGPIOout1::Status: msgText = "1:Status"; break;
|
||||
case CGPIOout1::User: msgText = "1: User "; break;
|
||||
case CGPIOin2::Disabled: msgText = " --- "; break;
|
||||
case CGPIOin2::Stop: msgText = "Stop "; break;
|
||||
case CGPIOin2::Thermostat: msgText = "\352T "; break;
|
||||
}
|
||||
if(msgText)
|
||||
_printMenuText(Column1, Line2, msgText, _rowSel == 2);
|
||||
}
|
||||
|
||||
_drawBitmap(65, Line3, OutputIconInfo);
|
||||
_drawBitmap(75, Line3, _1IconInfo);
|
||||
{
|
||||
const char* msgText = NULL;
|
||||
switch(_GPIOparams.out1Mode) {
|
||||
case CGPIOout1::Disabled: msgText = " --- "; break;
|
||||
case CGPIOout1::Status: msgText = "Status"; break;
|
||||
case CGPIOout1::User: msgText = "User "; break;
|
||||
}
|
||||
if(msgText)
|
||||
_printMenuText(Column2, Line3, msgText, _rowSel == 5);
|
||||
}
|
||||
_drawBitmap(65, Line2, OutputIconInfo);
|
||||
_drawBitmap(75, Line2, _2IconInfo);
|
||||
{
|
||||
const char* msgText = NULL;
|
||||
switch(_GPIOparams.out2Mode) {
|
||||
case CGPIOout2::Disabled: msgText = "2: ---"; break;
|
||||
case CGPIOout2::User: msgText = "2:User"; break;
|
||||
case CGPIOout2::Disabled: msgText = " --- "; break;
|
||||
case CGPIOout2::User: msgText = "User "; break;
|
||||
}
|
||||
if(msgText)
|
||||
_printMenuText(Column2, Line2, msgText, _rowSel == 3);
|
||||
_printMenuText(Column2, Line2, msgText, _rowSel == 4);
|
||||
}
|
||||
|
||||
if(getBoardRevision() != BRD_V2_GPIO_NOALG) { // Not No Analog support
|
||||
if(getBoardRevision() == BRD_V2_FULLGPIO || getBoardRevision() == BRD_V1_FULLGPIO) {
|
||||
_drawBitmap(0, Line1-1, algIconInfo);
|
||||
const char* msgText = NULL;
|
||||
switch(_GPIOparams.algMode) {
|
||||
case CGPIOalg::Disabled: msgText = "Disabled"; break;
|
||||
case CGPIOalg::HeatDemand: msgText = "Ip1 allows"; break;
|
||||
case CGPIOalg::HeatDemand: msgText = "Enabled"; break;
|
||||
}
|
||||
if(msgText)
|
||||
_printMenuText(Column1, Line1, msgText, _rowSel == 1);
|
||||
_printMenuText(23, Line1, msgText, _rowSel == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +175,7 @@ CGPIOSetupScreen::animate()
|
|||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 5:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
switch(_GPIOparams.out1Mode) {
|
||||
case CGPIOout1::Disabled: pMsg = " Output 1: DISABLED. "; break;
|
||||
|
@ -177,7 +185,7 @@ CGPIOSetupScreen::animate()
|
|||
if(pMsg)
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
switch(_GPIOparams.out2Mode) {
|
||||
case CGPIOout2::Disabled: pMsg = " Output 2: DISABLED. "; break;
|
||||
|
@ -187,22 +195,22 @@ CGPIOSetupScreen::animate()
|
|||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case 3:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
switch(_GPIOparams.in1Mode) {
|
||||
case CGPIOin1::Disabled: pMsg = " Input 1: DISABLED. "; break;
|
||||
case CGPIOin1::On: pMsg = " Input 1: Starts heater upon closure. "; break;
|
||||
case CGPIOin1::Hold: pMsg = " Input 1: Starts heater when held closed, stops when opened. "; break;
|
||||
case CGPIOin1::OnOff: pMsg = " Input 1: Starts or Stops heater upon closure. "; break;
|
||||
case CGPIOin1::Disabled: pMsg = " Input 1: DISABLED. "; break;
|
||||
case CGPIOin1::Start: pMsg = " Input 1: Starts heater upon closure. "; break;
|
||||
case CGPIOin1::Run: pMsg = " Input 1: Starts heater when held closed, stops when opened. "; break;
|
||||
case CGPIOin1::StartStop: pMsg = " Input 1: Starts or Stops heater upon closure. "; break;
|
||||
}
|
||||
if(pMsg)
|
||||
_scrollMessage(56, pMsg, _scrollChar);
|
||||
break;
|
||||
case 5:
|
||||
case 2:
|
||||
_display.drawFastHLine(0, 52, 128, WHITE);
|
||||
switch(_GPIOparams.in2Mode) {
|
||||
case CGPIOin2::Disabled: pMsg = " Input 2: DISABLED. "; break;
|
||||
case CGPIOin2::Off: pMsg = " Input 2: Stops heater upon closure. "; break;
|
||||
case CGPIOin2::Stop: pMsg = " Input 2: Stops heater upon closure. "; break;
|
||||
case CGPIOin2::Thermostat: pMsg = " Input 2: External thermostat. Max fuel when closed, min fuel when open. "; break;
|
||||
}
|
||||
if(pMsg)
|
||||
|
@ -325,25 +333,25 @@ CGPIOSetupScreen::_adjust(int dir)
|
|||
WRAPLIMITS(tVal, 0, 1);
|
||||
_GPIOparams.algMode = (CGPIOalg::Modes)tVal;
|
||||
break;
|
||||
case 2: // outputs mode
|
||||
case 5: // outputs mode
|
||||
tVal = _GPIOparams.out1Mode;
|
||||
tVal += dir;
|
||||
WRAPLIMITS(tVal, 0, 2);
|
||||
_GPIOparams.out1Mode = (CGPIOout1::Modes)tVal;
|
||||
break;
|
||||
case 3: // outputs mode
|
||||
case 4: // outputs mode
|
||||
tVal = _GPIOparams.out2Mode;
|
||||
tVal += dir;
|
||||
WRAPLIMITS(tVal, 0, 1);
|
||||
_GPIOparams.out2Mode = (CGPIOout2::Modes)tVal;
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
tVal = _GPIOparams.in1Mode;
|
||||
tVal += dir;
|
||||
WRAPLIMITS(tVal, 0, 3);
|
||||
_GPIOparams.in1Mode = (CGPIOin1::Modes)tVal;
|
||||
break;
|
||||
case 5:
|
||||
case 2:
|
||||
tVal = _GPIOparams.in2Mode;
|
||||
tVal += dir;
|
||||
WRAPLIMITS(tVal, 0, 2);
|
||||
|
@ -354,7 +362,7 @@ CGPIOSetupScreen::_adjust(int dir)
|
|||
|
||||
|
||||
|
||||
CGPIOInfoScreen::CGPIOInfoScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreenHeader(display, mgr)
|
||||
CGPIOInfoScreen::CGPIOInfoScreen(C128x64_OLED& display, CScreenManager& mgr) : CScreen(display, mgr)
|
||||
{
|
||||
_keyRepeatCount = -1;
|
||||
}
|
||||
|
@ -365,55 +373,92 @@ CGPIOInfoScreen::_initUI()
|
|||
}
|
||||
|
||||
bool
|
||||
CGPIOInfoScreen::show()
|
||||
CGPIOInfoScreen::animate()
|
||||
{
|
||||
CScreenHeader::show(false);
|
||||
char msg[16];
|
||||
|
||||
_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);
|
||||
_display.clearDisplay();
|
||||
_showTitle("GPIO status");
|
||||
|
||||
_drawBitmap(0, 14, InputIconInfo);
|
||||
_drawBitmap(11, 14, _1IconInfo);
|
||||
_drawBitmap(0, 27, InputIconInfo);
|
||||
_drawBitmap(11, 27, _2IconInfo);
|
||||
_drawBitmap(75, 14, OutputIconInfo);
|
||||
_drawBitmap(86, 14, _1IconInfo);
|
||||
_drawBitmap(75, 27, OutputIconInfo);
|
||||
_drawBitmap(86, 27, _2IconInfo);
|
||||
|
||||
if(getBoardRevision() == BRD_V2_FULLGPIO || getBoardRevision() == BRD_V1_FULLGPIO)
|
||||
_printMenuText(55, Line1, "Analogue:", false, eRightJustify);
|
||||
_printMenuText(0, Line1, "Analogue:", false, eRightJustify);
|
||||
|
||||
// if(NVstore.getUserSettings().GPIO.in1Mode == CGPIOin1::Disabled) {
|
||||
// _display.drawFastHLine(7, 23, 7, WHITE);
|
||||
// }
|
||||
_drawBitmap(4, 29, GPIOin.getState(0) ? CloseIconInfo : OpenIconInfo);
|
||||
switch(NVstore.getUserSettings().GPIO.in1Mode) {
|
||||
case CGPIOin1::Disabled:
|
||||
_drawBitmap(23, 14, CrossLgIconInfo);
|
||||
break;
|
||||
case CGPIOin1::Start:
|
||||
_drawBitmap(23, 14, StartIconInfo);
|
||||
break;
|
||||
case CGPIOin1::Run:
|
||||
_drawBitmap(23, 14, RunIconInfo);
|
||||
break;
|
||||
case CGPIOin1::StartStop:
|
||||
_drawBitmap(23, 14, StartIconInfo);
|
||||
_drawBitmap(30, 14, StopIconInfo);
|
||||
break;
|
||||
}
|
||||
_drawBitmap(40, 16, GPIOin.getState(0) ? CloseIconInfo : OpenIconInfo);
|
||||
|
||||
// if(NVstore.getUserSettings().GPIO.in2Mode == CGPIOin2::Disabled) {
|
||||
// _display.drawFastHLine(29, 23, 9, WHITE);
|
||||
// }
|
||||
_drawBitmap(27, 29, GPIOin.getState(1) ? CloseIconInfo : OpenIconInfo);
|
||||
switch(NVstore.getUserSettings().GPIO.in2Mode) {
|
||||
case CGPIOin2::Disabled:
|
||||
_drawBitmap(23, 27, CrossLgIconInfo);
|
||||
break;
|
||||
case CGPIOin2::Stop:
|
||||
_drawBitmap(23, 27, StopIconInfo);
|
||||
break;
|
||||
case CGPIOin2::Thermostat:
|
||||
_printMenuText(23, 27, "\352T");
|
||||
break;
|
||||
}
|
||||
_drawBitmap(40, 28, GPIOin.getState(1) ? CloseIconInfo : OpenIconInfo);
|
||||
|
||||
|
||||
if(NVstore.getUserSettings().GPIO.out1Mode == CGPIOout1::Disabled) {
|
||||
_drawBitmap(87, 28, CrossLgIconInfo);
|
||||
int bulbmode = GPIOout.getState(0);
|
||||
static bool iconstate = false;
|
||||
switch(NVstore.getUserSettings().GPIO.out1Mode) {
|
||||
case CGPIOout1::Disabled:
|
||||
_drawBitmap(99, 14, CrossLgIconInfo);
|
||||
break;
|
||||
case CGPIOout1::Status:
|
||||
_drawBitmap(99, 14, InfoIconInfo);
|
||||
if(iconstate && bulbmode == 2) // animate bulb icon when status is PWM mode
|
||||
_drawBitmap(110, 13, BulbOn2IconInfo);
|
||||
else
|
||||
_drawBitmap(110, 13, bulbmode ? BulbOnIconInfo : BulbOffIconInfo);
|
||||
iconstate = !iconstate;
|
||||
break;
|
||||
case CGPIOout1::User:
|
||||
_drawBitmap(99, 15, UserIconInfo);
|
||||
_drawBitmap(110, 13, bulbmode ? BulbOnIconInfo : BulbOffIconInfo);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
_drawBitmap(86, 29, GPIOout.getState(0) ? BulbOnIconInfo : BulbOffIconInfo);
|
||||
}
|
||||
if(NVstore.getUserSettings().GPIO.out2Mode == CGPIOout2::Disabled) {
|
||||
_drawBitmap(114, 28, CrossLgIconInfo);
|
||||
}
|
||||
else {
|
||||
_drawBitmap(113, 29, GPIOout.getState(1) ? BulbOnIconInfo : BulbOffIconInfo);
|
||||
|
||||
switch(NVstore.getUserSettings().GPIO.out2Mode) {
|
||||
case CGPIOout2::Disabled: _drawBitmap(99, 27, CrossLgIconInfo); break;
|
||||
case CGPIOout2::User:
|
||||
_drawBitmap(99, 27, UserIconInfo);
|
||||
_drawBitmap(110, 26, GPIOout.getState(1) ? BulbOnIconInfo : BulbOffIconInfo);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(getBoardRevision() == BRD_V2_FULLGPIO || getBoardRevision() == BRD_V1_FULLGPIO) {
|
||||
_drawBitmap(0, Line1-1, algIconInfo);
|
||||
if(NVstore.getUserSettings().GPIO.algMode == CGPIOalg::Disabled) {
|
||||
_drawBitmap(58, Line1, CrossLgIconInfo);
|
||||
_drawBitmap(23, Line1, CrossLgIconInfo);
|
||||
}
|
||||
else {
|
||||
sprintf(msg, "%d%%", GPIOalg.getValue() * 100 / 4096);
|
||||
_printMenuText(58, Line1, msg);
|
||||
_printMenuText(23, Line1, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,6 +466,12 @@ CGPIOInfoScreen::show()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CGPIOInfoScreen::show()
|
||||
{
|
||||
return false;// CScreenHeader::show(false);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
CGPIOInfoScreen::keyHandler(uint8_t event)
|
||||
|
|
|
@ -45,13 +45,14 @@ public:
|
|||
void onSelect();
|
||||
};
|
||||
|
||||
class CGPIOInfoScreen : public CScreenHeader
|
||||
class CGPIOInfoScreen : public CScreen
|
||||
{
|
||||
int _keyRepeatCount;
|
||||
void _initUI();
|
||||
public:
|
||||
CGPIOInfoScreen(C128x64_OLED& display, CScreenManager& mgr);
|
||||
bool show();
|
||||
bool animate();
|
||||
bool keyHandler(uint8_t event);
|
||||
};
|
||||
|
||||
|
|
|
@ -668,6 +668,21 @@ const uint8_t PROGMEM BulbOnIcon[] =
|
|||
};
|
||||
const BITMAP_INFO BulbOnIconInfo(9, 8, BulbOnIcon);
|
||||
|
||||
|
||||
const uint8_t PROGMEM bulbOn2aBitmap[] =
|
||||
{
|
||||
0x14, 0x00, // # #
|
||||
0x80, 0x80, // # #
|
||||
0x1C, 0x00, // ###
|
||||
0xA2, 0x80, // # # # #
|
||||
0x22, 0x00, // # #
|
||||
0x1C, 0x00, // ###
|
||||
0x14, 0x00, // # #
|
||||
0x1C, 0x00, // ###
|
||||
};
|
||||
const BITMAP_INFO BulbOn2IconInfo(9, 8, bulbOn2aBitmap);
|
||||
|
||||
|
||||
const uint8_t PROGMEM BulbOffIcon[] =
|
||||
{
|
||||
0x00, 0x00, //
|
||||
|
@ -1169,3 +1184,133 @@ const uint8_t PROGMEM ExtThermoIcon[] =
|
|||
0x00, 0x9c, // # ###
|
||||
};
|
||||
const BITMAP_INFO ExtThermoIconInfo(14, 7, ExtThermoIcon);
|
||||
|
||||
const uint8_t PROGMEM ExtThermo2Icon[] =
|
||||
{
|
||||
0x33, 0xE0, // ## #####
|
||||
0x42, 0xA0, // # # # #
|
||||
0x30, 0x80, // ## #
|
||||
0x70, 0x80, // ### #
|
||||
0x88, 0x80, // # # #
|
||||
0x88, 0x80, // # # #
|
||||
0x70, 0x80, // ### #
|
||||
};
|
||||
const BITMAP_INFO ExtThermo2IconInfo(11, 7, ExtThermo2Icon);
|
||||
|
||||
const uint8_t PROGMEM inputIcon[] =
|
||||
{
|
||||
0x00, 0x80, // #
|
||||
0x04, 0x80, // # #
|
||||
0x02, 0x80, // # #
|
||||
0xFF, 0x80, // #########
|
||||
0x02, 0x80, // # #
|
||||
0x04, 0x80, // # #
|
||||
0x00, 0x80, // #
|
||||
};
|
||||
const BITMAP_INFO InputIconInfo(9, 7, inputIcon);
|
||||
|
||||
const uint8_t PROGMEM outputIcon[] =
|
||||
{
|
||||
0x80, 0x00, // #
|
||||
0x82, 0x00, // # #
|
||||
0x81, 0x00, // # #
|
||||
0xFF, 0x80, // #########
|
||||
0x81, 0x00, // # #
|
||||
0x82, 0x00, // # #
|
||||
0x80, 0x00, // #
|
||||
};
|
||||
const BITMAP_INFO OutputIconInfo(9, 7, outputIcon);
|
||||
|
||||
const uint8_t PROGMEM _1Icon[] =
|
||||
{
|
||||
0x00, //
|
||||
0x44, // # #
|
||||
0xC0, // ##
|
||||
0x40, // #
|
||||
0x44, // # #
|
||||
0x40, // #
|
||||
0xE0, // ###
|
||||
};
|
||||
const BITMAP_INFO _1IconInfo(7, 7, _1Icon);
|
||||
|
||||
const uint8_t PROGMEM _2Icon[] =
|
||||
{
|
||||
0x00, //
|
||||
0x64, // ## #
|
||||
0x90, // # #
|
||||
0x10, // #
|
||||
0x24, // # #
|
||||
0x40, // #
|
||||
0xF0, // ####
|
||||
};
|
||||
const BITMAP_INFO _2IconInfo(7, 7, _2Icon);
|
||||
|
||||
const uint8_t PROGMEM algIcon[] =
|
||||
{
|
||||
0x08, 0x00, // #
|
||||
0x09, 0x00, // # #
|
||||
0x05, 0x00, // # #
|
||||
0x24, 0x08, // # # #
|
||||
0x02, 0x00, // #
|
||||
0x02, 0x00, // #
|
||||
0x01, 0x00, // #
|
||||
0xC3, 0x86, // ## ### ##
|
||||
0x01, 0x80, // ##
|
||||
};
|
||||
const BITMAP_INFO algIconInfo(15, 9, algIcon);
|
||||
|
||||
//
|
||||
// Image data for run
|
||||
//
|
||||
|
||||
const uint8_t PROGMEM runBitmap[] =
|
||||
{
|
||||
0x03, // ##
|
||||
0x03, // ##
|
||||
0x30, // ##
|
||||
0x4E, // # ###
|
||||
0x05, // # #
|
||||
0x08, // #
|
||||
0x14, // # #
|
||||
0x22, // # #
|
||||
0x44, // # #
|
||||
};
|
||||
const BITMAP_INFO RunIconInfo(8, 9, runBitmap);
|
||||
|
||||
//
|
||||
// Image data for info
|
||||
//
|
||||
|
||||
const uint8_t PROGMEM infoBitmap[] =
|
||||
{
|
||||
0x3C, 0x00, // ####
|
||||
0x66, 0x00, // ## ##
|
||||
0xE7, 0x00, // ### ###
|
||||
0xFF, 0x00, // ########
|
||||
0xE7, 0x00, // ### ###
|
||||
0xE7, 0x00, // ### ###
|
||||
0xE7, 0x00, // ### ###
|
||||
0x66, 0x00, // ## ##
|
||||
0x3C, 0x00, // ####
|
||||
};
|
||||
const BITMAP_INFO InfoIconInfo(9, 9, infoBitmap);
|
||||
|
||||
//
|
||||
// Image data for user
|
||||
//
|
||||
|
||||
const uint8_t PROGMEM userBitmap[] =
|
||||
{
|
||||
0x18, // ##
|
||||
0x3C, // ####
|
||||
0x3C, // ####
|
||||
0x18, // ##
|
||||
0x24, // # #
|
||||
0x7E, // ######
|
||||
0xFF, // ########
|
||||
0xFF, // ########
|
||||
0xFF, // ########
|
||||
};
|
||||
const BITMAP_INFO UserIconInfo(8, 9, userBitmap);
|
||||
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ extern const BITMAP_INFO CloseIconInfo;
|
|||
|
||||
// Bitmap for BulbOn
|
||||
extern const BITMAP_INFO BulbOnIconInfo;
|
||||
extern const BITMAP_INFO BulbOn2IconInfo;
|
||||
|
||||
// Bitmap for BulbOff
|
||||
extern const BITMAP_INFO BulbOffIconInfo;
|
||||
|
@ -144,3 +145,12 @@ extern const BITMAP_INFO ThermostatHzIconInfo;
|
|||
extern const BITMAP_INFO resetIconInfo;
|
||||
extern const BITMAP_INFO miniThermoIconInfo;
|
||||
extern const BITMAP_INFO ExtThermoIconInfo;
|
||||
extern const BITMAP_INFO ExtThermo2IconInfo;
|
||||
extern const BITMAP_INFO RunIconInfo;
|
||||
extern const BITMAP_INFO InfoIconInfo;
|
||||
extern const BITMAP_INFO UserIconInfo;
|
||||
extern const BITMAP_INFO InputIconInfo;
|
||||
extern const BITMAP_INFO OutputIconInfo;
|
||||
extern const BITMAP_INFO _1IconInfo;
|
||||
extern const BITMAP_INFO _2IconInfo;
|
||||
extern const BITMAP_INFO algIconInfo;
|
||||
|
|
|
@ -78,22 +78,15 @@ void
|
|||
CGPIOin1::manage(bool active)
|
||||
{
|
||||
switch (_Mode) {
|
||||
case Disabled:
|
||||
break;
|
||||
case On:
|
||||
_doOn(active);
|
||||
break;
|
||||
case Hold:
|
||||
_doOnHold(active);
|
||||
break;
|
||||
case OnOff:
|
||||
_doOnOff(active);
|
||||
break;
|
||||
case Disabled: break;
|
||||
case Start: _doStart(active); break;
|
||||
case Run: _doRun(active); break;
|
||||
case StartStop: _doStartStop(active); break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CGPIOin1::_doOn(bool active)
|
||||
CGPIOin1::_doStart(bool active)
|
||||
{
|
||||
if(active) {
|
||||
requestOn();
|
||||
|
@ -103,7 +96,7 @@ CGPIOin1::_doOn(bool active)
|
|||
// mode where heater runs if input 1 is shorted
|
||||
// stops when open
|
||||
void
|
||||
CGPIOin1::_doOnHold(bool active)
|
||||
CGPIOin1::_doRun(bool active)
|
||||
{
|
||||
if(active) {
|
||||
requestOn();
|
||||
|
@ -116,7 +109,7 @@ CGPIOin1::_doOnHold(bool active)
|
|||
// mode where heater runs if input 1 is shorted
|
||||
// stops when open
|
||||
void
|
||||
CGPIOin1::_doOnOff(bool active)
|
||||
CGPIOin1::_doStartStop(bool active)
|
||||
{
|
||||
if(active) {
|
||||
if(getHeaterInfo().getRunStateEx())
|
||||
|
@ -146,19 +139,14 @@ void
|
|||
CGPIOin2::manage(bool active)
|
||||
{
|
||||
switch (_Mode) {
|
||||
case Disabled:
|
||||
break;
|
||||
case Off:
|
||||
_doOff(active);
|
||||
break;
|
||||
case Thermostat:
|
||||
_doThermostat(active);
|
||||
break;
|
||||
case Disabled: break;
|
||||
case Stop: _doStop(active); break;
|
||||
case Thermostat: _doThermostat(active); break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CGPIOin2::_doOff(bool active)
|
||||
CGPIOin2::_doStop(bool active)
|
||||
{
|
||||
if(active) {
|
||||
requestOff();
|
||||
|
@ -303,7 +291,7 @@ CGPIOout::setState(int channel, bool state)
|
|||
_Out1.setState(state);
|
||||
}
|
||||
|
||||
bool
|
||||
uint8_t
|
||||
CGPIOout::getState(int channel)
|
||||
{
|
||||
if(channel)
|
||||
|
@ -411,6 +399,7 @@ CGPIOout1::_doStatus()
|
|||
case 0:
|
||||
ledcDetachPin(_pin); // detach PWM from IO line
|
||||
digitalWrite(_pin, LOW);
|
||||
_ledState = 0;
|
||||
break;
|
||||
case 1:
|
||||
ledcAttachPin(_pin, 0); // attach PWM to GPIO line
|
||||
|
@ -420,6 +409,7 @@ CGPIOout1::_doStatus()
|
|||
case 2:
|
||||
ledcDetachPin(_pin); // detach PWM from IO line
|
||||
digitalWrite(_pin, HIGH);
|
||||
_ledState = 1;
|
||||
break;
|
||||
case 3:
|
||||
ledcAttachPin(_pin, 0); // attach PWM to GPIO line
|
||||
|
@ -461,6 +451,7 @@ CGPIOout1::_doStartMode() // breath up PWM
|
|||
_statusState &= 0xff;
|
||||
ledcWrite(0, _statusState);
|
||||
}
|
||||
_ledState = 2;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -473,25 +464,34 @@ CGPIOout1::_doStopMode() // breath down PWM
|
|||
_statusState -= expo;
|
||||
_statusState &= 0xff;
|
||||
ledcWrite(0, _statusState);
|
||||
|
||||
}
|
||||
_ledState = 2;
|
||||
}
|
||||
|
||||
void
|
||||
CGPIOout1::_doSuspendMode() // brief flash
|
||||
{
|
||||
static unsigned long stretch = 0;
|
||||
|
||||
long tDelta = millis() - _breatheDelay;
|
||||
if(tDelta >= 0) {
|
||||
_statusState++;
|
||||
if(_statusState & 0x01) {
|
||||
_breatheDelay += ONFLASHINTERVAL; // brief flash on
|
||||
digitalWrite(_pin, HIGH);
|
||||
stretch = (millis() + 250) | 1; // pulse extend for UI purposes, ensure non zero
|
||||
}
|
||||
else {
|
||||
_breatheDelay += (FLASHPERIOD - ONFLASHINTERVAL); // extended off
|
||||
digitalWrite(_pin, LOW);
|
||||
}
|
||||
}
|
||||
if(stretch) {
|
||||
tDelta = millis() - stretch;
|
||||
if(tDelta >= 0)
|
||||
stretch = 0;
|
||||
}
|
||||
_ledState = stretch ? 1 : 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -500,10 +500,14 @@ CGPIOout1::setState(bool state)
|
|||
_userState = state;
|
||||
}
|
||||
|
||||
bool
|
||||
uint8_t
|
||||
CGPIOout1::getState()
|
||||
{
|
||||
return _userState;
|
||||
switch(_Mode) {
|
||||
case User: return _userState;
|
||||
case Status: return _ledState; // special pulse extender for suspend mode
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************************************
|
||||
|
@ -565,7 +569,7 @@ CGPIOout2::setState(bool state)
|
|||
_userState = state;
|
||||
}
|
||||
|
||||
bool
|
||||
uint8_t
|
||||
CGPIOout2::getState()
|
||||
{
|
||||
return _userState;
|
||||
|
|
|
@ -39,9 +39,9 @@ class CGPIOin1 {
|
|||
public:
|
||||
enum Modes {
|
||||
Disabled,
|
||||
On, // input 1 closure, heater starts; input2 closure, heater stops
|
||||
Hold, // hold input 1 closure, heater runs; input 1 open, heater stops
|
||||
OnOff // alternate input 1 closures start or stop the heater
|
||||
Start, // input 1 closure, heater starts; input2 closure, heater stops
|
||||
Run, // hold input 1 closure, heater runs; input 1 open, heater stops
|
||||
StartStop // alternate input 1 closures start or stop the heater
|
||||
};
|
||||
CGPIOin1();
|
||||
void setMode(Modes mode) { _Mode = mode; };
|
||||
|
@ -50,17 +50,17 @@ public:
|
|||
Modes getMode() const;
|
||||
private:
|
||||
Modes _Mode;
|
||||
void _doOn(bool active);
|
||||
void _doOnHold(bool active);
|
||||
void _doOnOff(bool active);
|
||||
void _doStart(bool active);
|
||||
void _doRun(bool active);
|
||||
void _doStartStop(bool active);
|
||||
};
|
||||
|
||||
class CGPIOin2 {
|
||||
public:
|
||||
enum Modes {
|
||||
Disabled,
|
||||
Off, // input 2 closure stops heater
|
||||
Thermostat // input 2 used to max/min heater if closed/open
|
||||
Stop, // input 2 closure stops heater
|
||||
Thermostat // input 2 used to max/min heater if closed/open
|
||||
};
|
||||
CGPIOin2();
|
||||
void setMode(Modes mode) { _Mode = mode; };
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
Modes getMode() const;
|
||||
private:
|
||||
Modes _Mode;
|
||||
void _doOff(bool active);
|
||||
void _doStop(bool active);
|
||||
void _doThermostat(bool active);
|
||||
};
|
||||
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
void setMode(Modes mode);
|
||||
void manage();
|
||||
void setState(bool state);
|
||||
bool getState();
|
||||
uint8_t getState();
|
||||
Modes getMode() const;
|
||||
private:
|
||||
Modes _Mode;
|
||||
|
@ -117,6 +117,7 @@ private:
|
|||
int _statusDelay;
|
||||
unsigned long _breatheDelay;
|
||||
bool _userState;
|
||||
uint8_t _ledState;
|
||||
void _doStartMode();
|
||||
void _doStopMode();
|
||||
void _doSuspendMode();
|
||||
|
@ -133,7 +134,7 @@ public:
|
|||
void setMode(Modes mode);
|
||||
void manage();
|
||||
void setState(bool state);
|
||||
bool getState();
|
||||
uint8_t getState();
|
||||
Modes getMode() const;
|
||||
private:
|
||||
Modes _Mode;
|
||||
|
@ -151,7 +152,7 @@ public:
|
|||
void begin(int pin1, int pin2, CGPIOout1::Modes mode1, CGPIOout2::Modes mode2);
|
||||
void manage();
|
||||
void setState(int channel, bool state);
|
||||
bool getState(int channel);
|
||||
uint8_t getState(int channel);
|
||||
CGPIOout1::Modes getMode1() const;
|
||||
CGPIOout2::Modes getMode2() const;
|
||||
};
|
||||
|
|
|
@ -104,19 +104,28 @@ int BoardDetect()
|
|||
int pin33 = digitalRead(33);
|
||||
int pin26 = digitalRead(26);
|
||||
|
||||
if((pin33 == HIGH) && (pin26 == HIGH) && (pin25 == HIGH)) {
|
||||
revision = BRD_V2_FULLGPIO;
|
||||
// all pins to header strip and pulled high - V1 PCB
|
||||
if((pin33 == HIGH) && (pin26 == HIGH) && (pin25 == HIGH)) {
|
||||
revision = BRD_V1_FULLGPIO;
|
||||
DebugPort.println("Board detect: digital input test reveals V1.x PCB");
|
||||
}
|
||||
else if((pin33 == LOW) && (pin26 == HIGH) && (pin25 == LOW)) {
|
||||
revision = BRD_V2_NOGPIO;
|
||||
DebugPort.println("Board detect: digital input test reveals V2.2 PCB - no GPIO (V2.0 userID) ");
|
||||
}
|
||||
else if((pin33 == HIGH) && (pin26 == LOW) && (pin25 == HIGH)) {
|
||||
// original V2 PCB, no traces cut n shunted, unusable Alg to pin 26 pulls high, dig inputs pulled low by transistors
|
||||
else if((pin33 == LOW) && (pin26 == HIGH) && (pin25 == LOW)) {
|
||||
revision = BRD_V2_GPIO_NOALG;
|
||||
DebugPort.println("Board detect: digital input test reveals V2.0 PCB - Digital only GPIO (V2.1 userID)");
|
||||
}
|
||||
else if((pin33 == HIGH) && (pin26 == LOW) && (pin25 == LOW)) {
|
||||
// original V2 PCB, no traces cut n shunted, pin 26 grounded via 0R instead of 100n cap, dig inputs pulled low by transistors
|
||||
else if((pin33 == LOW) && (pin26 == LOW) && (pin25 == LOW)) {
|
||||
revision = BRD_V2_GPIO_NOALG;
|
||||
DebugPort.println("Board detect: digital input test reveals V2.0 PCB - Digital only GPIO (V2.1 userID)");
|
||||
}
|
||||
// original V2 PCB, pin 26 grounded via 0R instead of 100n cap, digio transistors not fitted dig in pins pull high
|
||||
else if((pin33 == HIGH) && (pin26 == LOW) && (pin25 == HIGH)) {
|
||||
revision = BRD_V2_NOGPIO;
|
||||
DebugPort.println("Board detect: digital input test reveals V2.2 PCB - no GPIO (V2.0 userID) ");
|
||||
}
|
||||
// modified V2 PCB or new V2.1PCB, pins 25 & 33 swapped, Alg routed to usuable pin 33 // cap, dig inputs pulled low by transistors
|
||||
else if((pin33 == HIGH) && (pin26 == LOW) && (pin25 == LOW)) {
|
||||
revision = BRD_V2_FULLGPIO;
|
||||
DebugPort.println("Board detect: digital input test reveals V2.1 PCB - Full GPIO (V2.2 userID)");
|
||||
}
|
||||
|
|
|
@ -351,9 +351,9 @@ sUserSettings::load()
|
|||
GPIO.in1Mode = CGPIOin1::Disabled;
|
||||
GPIO.in2Mode = CGPIOin2::Disabled;
|
||||
switch(tVal) {
|
||||
case 1: GPIO.in1Mode = CGPIOin1::On; GPIO.in2Mode = CGPIOin2::Off; break;
|
||||
case 2: GPIO.in1Mode = CGPIOin1::Hold; GPIO.in2Mode = CGPIOin2::Thermostat; break;
|
||||
case 3: GPIO.in1Mode = CGPIOin1::OnOff; break;
|
||||
case 1: GPIO.in1Mode = CGPIOin1::Start; GPIO.in2Mode = CGPIOin2::Stop; break;
|
||||
case 2: GPIO.in1Mode = CGPIOin1::Run; GPIO.in2Mode = CGPIOin2::Thermostat; break;
|
||||
case 3: GPIO.in1Mode = CGPIOin1::StartStop; break;
|
||||
case 4: GPIO.in2Mode = CGPIOin2::Thermostat; break;
|
||||
}
|
||||
preferences.putUChar("GPIOinMode", 0xff); // cancel old
|
||||
|
|
Loading…
Reference in New Issue