From a8744fdf2291e5cfd45464a55b31acde2aa81283 Mon Sep 17 00:00:00 2001 From: rljonesau Date: Sun, 24 Mar 2019 16:48:03 +1100 Subject: [PATCH] Wifi enable & OTA enable in NVram. Bug fix thermostat mode in priming menu. OTA now shows in screen header against Wifi icon. --- Arduino/BTCDieselHeater/BTCDieselHeater.ino | 10 +- .../src/OLED/PrimingScreen.cpp | 11 +- .../BTCDieselHeater/src/OLED/ScreenHeader.cpp | 6 + .../BTCDieselHeater/src/OLED/WiFiScreen.cpp | 206 +++++++++++------- Arduino/BTCDieselHeater/src/OLED/WiFiScreen.h | 2 +- .../BTCDieselHeater/src/OLED/fonts/MiniFont.c | 11 +- .../BTCDieselHeater/src/Utility/NVStorage.cpp | 68 ++++-- .../BTCDieselHeater/src/Utility/NVStorage.h | 32 ++- Arduino/BTCDieselHeater/src/WiFi/BTCWifi.cpp | 20 ++ Arduino/BTCDieselHeater/src/WiFi/BTCWifi.h | 1 + Arduino/BTCDieselHeater/src/cfg/pins.h | 2 + 11 files changed, 263 insertions(+), 106 deletions(-) diff --git a/Arduino/BTCDieselHeater/BTCDieselHeater.ino b/Arduino/BTCDieselHeater/BTCDieselHeater.ino index d257fe6..fa958d5 100644 --- a/Arduino/BTCDieselHeater/BTCDieselHeater.ino +++ b/Arduino/BTCDieselHeater/BTCDieselHeater.ino @@ -369,13 +369,17 @@ void setup() { #if USE_WIFI == 1 - initWifi(WiFi_TriggerPin, FAILEDSSID, FAILEDPASSWORD); + if(NVstore.getWifiEnabled()) { + initWifi(WiFi_TriggerPin, FAILEDSSID, FAILEDPASSWORD); #if USE_OTA == 1 - initOTA(); + if(NVstore.getOTAEnabled()) { + initOTA(); + } #endif // USE_OTA #if USE_WEBSERVER == 1 - initWebServer(); + initWebServer(); #endif // USE_WEBSERVER + } #endif // USE_WIFI diff --git a/Arduino/BTCDieselHeater/src/OLED/PrimingScreen.cpp b/Arduino/BTCDieselHeater/src/OLED/PrimingScreen.cpp index eb9c8bf..b0a54a4 100644 --- a/Arduino/BTCDieselHeater/src/OLED/PrimingScreen.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/PrimingScreen.cpp @@ -99,7 +99,8 @@ CPrimingScreen::show() } else { // follow actual heater settings - int col = getHeaterInfo().isThermostat() ? 0 : 1; + // 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); } @@ -163,6 +164,7 @@ CPrimingScreen::keyHandler(uint8_t event) case 1: _colSel = 0; setThermostatMode(1); + saveNV(); break; case 2: _colSel = 0; @@ -183,6 +185,7 @@ CPrimingScreen::keyHandler(uint8_t event) case 1: _colSel = 1; setThermostatMode(0); + saveNV(); break; case 2: _colSel = 1; @@ -207,7 +210,8 @@ CPrimingScreen::keyHandler(uint8_t event) if(_rowSel == 2) _colSel = NVstore.getDegFMode(); if(_rowSel == 1) - _colSel = getHeaterInfo().isThermostat() ? 0 : 1; + // _colSel = getHeaterInfo().isThermostat() ? 0 : 1; + _colSel = getThermostatModeActive() ? 0 : 1; } } // press DOWN @@ -216,7 +220,8 @@ CPrimingScreen::keyHandler(uint8_t event) LOWERLIMIT(_rowSel, 0); _colSel = 0; if(_rowSel == 1) - _colSel = getHeaterInfo().isThermostat() ? 0 : 1; + // _colSel = getHeaterInfo().isThermostat() ? 0 : 1; + _colSel = getThermostatModeActive() ? 0 : 1; if(_rowSel == 2) _colSel = NVstore.getDegFMode(); } diff --git a/Arduino/BTCDieselHeater/src/OLED/ScreenHeader.cpp b/Arduino/BTCDieselHeater/src/OLED/ScreenHeader.cpp index 62463b5..a24ddbf 100644 --- a/Arduino/BTCDieselHeater/src/OLED/ScreenHeader.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/ScreenHeader.cpp @@ -154,6 +154,12 @@ CScreenHeader::showWifiIcon() _display.setCursor(X_WIFI_ICON+9, Y_WIFI_ICON+6); _display.print("AP"); } + if(NVstore.getOTAEnabled()) { + _display.fillRect(X_WIFI_ICON +11, Y_WIFI_ICON, 14, 6, BLACK); + CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font + _display.setCursor(X_WIFI_ICON+12, Y_WIFI_ICON); + _display.print("OTA"); + } } } diff --git a/Arduino/BTCDieselHeater/src/OLED/WiFiScreen.cpp b/Arduino/BTCDieselHeater/src/OLED/WiFiScreen.cpp index 6ceec80..2456073 100644 --- a/Arduino/BTCDieselHeater/src/OLED/WiFiScreen.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/WiFiScreen.cpp @@ -55,26 +55,31 @@ void CWiFiScreen::_initUI() { _rowSel = 0; + _colSel = 0; + _OTAsel = NVstore.getOTAEnabled(); + _colLimit = LIMIT_LEFT; // left most selection _bShowMAC = false; - if(isWifiAP()) { - if(isWifiConfigPortal()) { - _colSel = 0; // " WiFi: CFG AP only " - _colLimit = LIMIT_LEFT; // left most selection + if(NVstore.getWifiEnabled()) { + if(isWifiAP()) { + if(isWifiConfigPortal()) { + _colSel = 0; // " WiFi: CFG AP only " + _colLimit = LIMIT_LEFT; // left most selection + } + else { + _colSel = 1; // " WiFi: AP only "; + _colLimit = LIMIT_RIGHT; // right most selection + } } else { - _colSel = 1; // " WiFi: AP only "; - _colLimit = LIMIT_RIGHT; // right most selection - } - } - else { - if(isWifiConfigPortal()) { - _colSel = 2; // " WiFi: CFG STA+AP " - _colLimit = LIMIT_AWAY; // away from menu limits - } - else { - _colSel = 3; // " WiFi: STA+AP "; - _colLimit = LIMIT_RIGHT; // right most selection + if(isWifiConfigPortal()) { + _colSel = 2; // " WiFi: CFG STA+AP " + _colLimit = LIMIT_AWAY; // away from menu limits + } + else { + _colSel = 3; // " WiFi: STA+AP "; + _colLimit = LIMIT_RIGHT; // right most selection + } } } } @@ -85,30 +90,39 @@ CWiFiScreen::show() CScreenHeader::show(); int yPos = 18; - if(isWifiConnected() || isWifiAP()) { - const char* pTitle = NULL; - switch(_colSel) { - case 0: - pTitle = " WiFi: CFG AP only "; - break; - case 1: - pTitle = " WiFi: AP only "; - break; - case 2: - pTitle = " WiFi: CFG STA+AP "; - break; - case 3: - pTitle = " WiFi: STA+AP "; - break; - } + const char* pTitle = NULL; + switch(_colSel) { + case 0: + pTitle = " WiFi: DISABLED "; + break; + case 1: + pTitle = " WiFi: CFG AP only "; + break; + case 2: + pTitle = " WiFi: AP only "; + break; + case 3: + pTitle = " WiFi: CFG STA+AP "; + break; + case 4: + pTitle = " WiFi: STA+AP "; + break; + } - if(_rowSel == 0) - _printInverted(3, yPos, pTitle, true); // inverted title bar - if(_rowSel == 1) - _printMenuText(3, yPos, pTitle, true); // selection box - yPos += 3; + if(_rowSel == 0) + _printInverted(3, yPos, pTitle, true); // inverted title bar + if(_rowSel == 1) + _printMenuText(3, yPos, pTitle, true); // selection box + if(_rowSel == 2) { + if(_OTAsel == 0) + _printMenuText(3, yPos, " OTA: DISABLED ", true); // selection box + else + _printMenuText(3, yPos, " OTA: ENABLED ", true); // selection box + } + yPos += 3; + if(_colSel) { // only show STA IP address if available! if(isWifiSTA() && _repeatCount <= STA_HOLD_TIME) { yPos += _display.textHeight() + 2; @@ -126,9 +140,6 @@ CWiFiScreen::show() else _printMenuText(25, yPos, getWifiAPAddrStr()); } - else { - _printInverted(0, yPos, " WiFi Inactive ", true); - } return true; } @@ -162,6 +173,20 @@ CWiFiScreen::animate() if(pMsg) _printMenuText(_display.xCentre(), 56, pMsg, false, eCentreJustify); } + if(_rowSel == 2) { + _display.drawFastHLine(0, 52, 128, WHITE); + const char* pMsg = NULL; + switch(_OTAsel) { + case 0: + pMsg = "\031 ESC Set \032 Enable"; // only right Sel arrow + break; + case 1: + pMsg = "\031 ESC Set \033 Disable"; // only left Sel arrow + break; + } + if(pMsg) + _printMenuText(_display.xCentre(), 56, pMsg, false, eCentreJustify); + } CScreen::animate(); return true; } @@ -176,48 +201,68 @@ CWiFiScreen::keyHandler(uint8_t event) } // press LEFT if(event & key_Left) { - if(_rowSel == 0) { - _ScreenManager.prevMenu(); - } - else { - if(isWifiAP()) { - _colSel = 0; - _colLimit = LIMIT_LEFT; - } - else { - _colSel--; - LOWERLIMIT(_colSel, 0); - _colLimit = (_colSel == 0) ? LIMIT_LEFT : LIMIT_AWAY; - } + switch(_rowSel) { + case 0: + _ScreenManager.prevMenu(); + break; + case 1: + if(isWifiAP()) { + // _colSel = 0; + // _colLimit = LIMIT_LEFT; + _colSel--; + LOWERLIMIT(_colSel, 0); + _colLimit = (_colSel == 0) ? LIMIT_LEFT : LIMIT_AWAY; + } + else { + _colSel--; + LOWERLIMIT(_colSel, 0); + _colLimit = (_colSel == 0) ? LIMIT_LEFT : LIMIT_AWAY; + } + break; + case 2: + _OTAsel = 0; + break; } } // press RIGHT if(event & key_Right) { - if(_rowSel == 0) { - _ScreenManager.nextMenu(); - } - else { - if(isWifiAP()) { - _colSel = 1; - _colLimit = LIMIT_RIGHT; - } - else { - _colSel++; - UPPERLIMIT(_colSel, 3); - _colLimit = (_colSel == 3) ? LIMIT_RIGHT : LIMIT_AWAY; - } + switch(_rowSel) { + case 0: + _ScreenManager.nextMenu(); + break; + case 1: + if(isWifiAP()) { + // _colSel = 1; + // _colLimit = LIMIT_RIGHT; + _colSel++; + UPPERLIMIT(_colSel, 2); + _colLimit = (_colSel == 3) ? LIMIT_RIGHT : LIMIT_AWAY; + } + else { + _colSel++; + UPPERLIMIT(_colSel, 4); + _colLimit = (_colSel == 4) ? LIMIT_RIGHT : LIMIT_AWAY; + // UPPERLIMIT(_colSel, 3); + // _colLimit = (_colSel == 3) ? LIMIT_RIGHT : LIMIT_AWAY; + } + break; + case 2: + _OTAsel = 1; + break; } } // press UP if(event & key_Up) { - _rowSel = 1; + _rowSel++; + UPPERLIMIT(_rowSel, 2); } // press DOWN if(event & key_Down) { if(_rowSel == 0) { _bShowMAC = !_bShowMAC; // toogle MAC/IP address if on navigation row } - _rowSel = 0; + _rowSel--; + LOWERLIMIT(_rowSel, 0); } _ScreenManager.reqUpdate(); } @@ -230,23 +275,38 @@ CWiFiScreen::keyHandler(uint8_t event) if(event & keyReleased) { if(event & key_Centre) { - if(_rowSel) { + if(_rowSel == 1) { switch(_colSel) { case 0: - wifiEnterConfigPortal(true, true, 5000); // CFG AP: erase credentials, reboot into portal + wifiDisable(5000); break; case 1: - wifiEnterConfigPortal(false, true, 5000); // AP Only: erase credentials, reboot into webserver + wifiEnterConfigPortal(true, true, 5000); // CFG AP: erase credentials, reboot into portal break; case 2: - wifiEnterConfigPortal(true, false, 5000); // CFG STA+AP: keep credentials, reboot into portal + wifiEnterConfigPortal(false, true, 5000); // AP Only: erase credentials, reboot into webserver break; case 3: + wifiEnterConfigPortal(true, false, 5000); // CFG STA+AP: keep credentials, reboot into portal + break; + case 4: wifiEnterConfigPortal(false, false, 5000); // STA+AP: keep credentials, reboot into webserver break; } - _rowSel = 2; // stop ticker display + _rowSel = 3; // stop ticker display + } + if(_rowSel == 2) { + NVstore.setOTAEnabled(_OTAsel); + NVstore.save(); + const char* content[2]; + if(_OTAsel) + content[0] = "Enabling OTA"; + else + content[0] = "Disabling OTA"; + content[1] = ""; + + _ScreenManager.showRebootMsg(content, 5000); } } _repeatCount = 0; diff --git a/Arduino/BTCDieselHeater/src/OLED/WiFiScreen.h b/Arduino/BTCDieselHeater/src/OLED/WiFiScreen.h index e82c686..6f96539 100644 --- a/Arduino/BTCDieselHeater/src/OLED/WiFiScreen.h +++ b/Arduino/BTCDieselHeater/src/OLED/WiFiScreen.h @@ -37,7 +37,7 @@ public: bool keyHandler(uint8_t event); private: int _colLimit; - int _rowSel, _colSel; + int _rowSel, _colSel, _OTAsel; int _repeatCount; bool _bShowMAC; void _initUI(); diff --git a/Arduino/BTCDieselHeater/src/OLED/fonts/MiniFont.c b/Arduino/BTCDieselHeater/src/OLED/fonts/MiniFont.c index eb35ba9..b5c9c66 100644 --- a/Arduino/BTCDieselHeater/src/OLED/fonts/MiniFont.c +++ b/Arduino/BTCDieselHeater/src/OLED/fonts/MiniFont.c @@ -86,9 +86,9 @@ const uint8_t miniFontBitmaps[] PROGMEM = 0xC0, // ## // @33 'A' (3 pixels wide) - 0xf8, // ##### + 0x78, // #### 0xa0, // # # - 0xf8, // ##### + 0x78, // #### // @36 'C' (3 pixels wide) 0x70, // ### @@ -160,6 +160,11 @@ const uint8_t miniFontBitmaps[] PROGMEM = 0x40, // # 0xf8, // ##### + // @78 'O' (3 pixels wide) + 0x70, // ### + 0x88, // # # + 0x70, // ### + }; // Character descriptors for a 3x5 font @@ -199,7 +204,7 @@ const FONT_CHAR_INFO miniFontDescriptors[] PROGMEM = {3, 5, 48}, // 'L' {3, 5, 75}, // 'M' {0, 0, 0}, // 'N' - {0, 0, 0}, // 'O' + {3, 5, 78}, // 'O' {3, 5, 51}, // 'P' {0, 0, 0}, // 'Q' {3, 5, 66}, // 'R' diff --git a/Arduino/BTCDieselHeater/src/Utility/NVStorage.cpp b/Arduino/BTCDieselHeater/src/Utility/NVStorage.cpp index abea8ea..896d990 100644 --- a/Arduino/BTCDieselHeater/src/Utility/NVStorage.cpp +++ b/Arduino/BTCDieselHeater/src/Utility/NVStorage.cpp @@ -34,8 +34,7 @@ bool sNVStore::valid() { bool retval = true; - retval &= (DimTime >= 0) && (DimTime < 300000); // 5 mins - retval &= (ThermostatMethod & 0x03) < 3; // only modes 0, 1 or 2 + retval &= Options.valid(); for(int i=0; i<2; i++) { retval &= timer[i].valid(); } @@ -49,8 +48,7 @@ sNVStore::init() for(int i=0; i<2; i++) { timer[i].init(); } - DimTime = 60000; // 1 minute - ThermostatMethod = 10 << 2; // 1 degree window, normal thermostat + Options.init(); Heater.init(); } @@ -98,13 +96,13 @@ CHeaterStorage::getThermostatMode() unsigned char CHeaterStorage::getThermostatMethodMode() { - return _calValues.ThermostatMethod & 0x03; + return _calValues.Options.ThermostatMethod & 0x03; } float CHeaterStorage::getThermostatMethodWindow() { - return float((_calValues.ThermostatMethod >> 2) & 0x3f) * 0.1f; // top 5 bits / 10, then / 2 + return float((_calValues.Options.ThermostatMethod >> 2) & 0x3f) * 0.1f; // top 5 bits / 10, then / 2 } void @@ -148,16 +146,16 @@ CHeaterStorage::setThermostatMode(unsigned char val) void CHeaterStorage::setThermostatMethodMode(unsigned char val) { - _calValues.ThermostatMethod &= ~0x03; - _calValues.ThermostatMethod |= (val & 0x03); + _calValues.Options.ThermostatMethod &= ~0x03; + _calValues.Options.ThermostatMethod |= (val & 0x03); } void CHeaterStorage::setThermostatMethodWindow(float val) { - _calValues.ThermostatMethod &= 0x03; + _calValues.Options.ThermostatMethod &= 0x03; int nVal = int(val * 10 + 0.5); - _calValues.ThermostatMethod |= ((nVal & 0x3F) << 2); + _calValues.Options.ThermostatMethod |= ((nVal & 0x3F) << 2); } @@ -225,25 +223,51 @@ CHeaterStorage::setTimerInfo(int idx, const sTimer& timerInfo) unsigned long CHeaterStorage::getDimTime() { - return _calValues.DimTime; + return _calValues.Options.DimTime; } void CHeaterStorage::setDimTime(unsigned long val) { - _calValues.DimTime = val; + _calValues.Options.DimTime = val; } unsigned char CHeaterStorage::getDegFMode() { - return _calValues.degF; + return _calValues.Options.degF; } void CHeaterStorage::setDegFMode(unsigned char val) { - _calValues.degF = val; + _calValues.Options.degF = val; + save(); +} + +unsigned char +CHeaterStorage::getWifiEnabled() +{ + return _calValues.Options.enableWifi; +} + +void +CHeaterStorage::setWifiEnabled(unsigned char val) +{ + _calValues.Options.enableWifi = val; + save(); +} + +unsigned char +CHeaterStorage::getOTAEnabled() +{ + return _calValues.Options.enableOTA; +} + +void +CHeaterStorage::setOTAEnabled(unsigned char val) +{ + _calValues.Options.enableOTA = val; save(); } @@ -360,9 +384,11 @@ void CESP32HeaterStorage::loadUI() { preferences.begin("user", false); - validatedLoad("dimTime", _calValues.DimTime, 60000, s32inBounds, 0, 600000); - validatedLoad("degF", _calValues.degF, 0, u8inBounds, 0, 1); - validatedLoad("thermoMethod", _calValues.ThermostatMethod, (10 << 2), u8inBounds, 0, 2, 0x03); + validatedLoad("dimTime", _calValues.Options.DimTime, 60000, s32inBounds, 0, 600000); + validatedLoad("degF", _calValues.Options.degF, 0, u8inBounds, 0, 1); + validatedLoad("thermoMethod", _calValues.Options.ThermostatMethod, (10 << 2), u8inBounds, 0, 2, 0x03); + validatedLoad("enableWifi", _calValues.Options.enableWifi, 1, u8inBounds, 0, 1); + validatedLoad("enableOTA", _calValues.Options.enableOTA, 1, u8inBounds, 0, 1); preferences.end(); } @@ -370,9 +396,11 @@ void CESP32HeaterStorage::saveUI() { preferences.begin("user", false); - preferences.putULong("dimTime", _calValues.DimTime); - preferences.putUChar("degF", _calValues.degF); - preferences.putUChar("thermoMethod", _calValues.ThermostatMethod); + preferences.putULong("dimTime", _calValues.Options.DimTime); + preferences.putUChar("degF", _calValues.Options.degF); + preferences.putUChar("thermoMethod", _calValues.Options.ThermostatMethod); + preferences.putUChar("enableWifi", _calValues.Options.enableWifi); + preferences.putUChar("enableOTA", _calValues.Options.enableOTA); preferences.end(); } diff --git a/Arduino/BTCDieselHeater/src/Utility/NVStorage.h b/Arduino/BTCDieselHeater/src/Utility/NVStorage.h index 298af07..d0dcc60 100644 --- a/Arduino/BTCDieselHeater/src/Utility/NVStorage.h +++ b/Arduino/BTCDieselHeater/src/Utility/NVStorage.h @@ -61,13 +61,35 @@ struct sHeater { }; }; +struct sBTCoptions { + long DimTime; + uint8_t degF; + uint8_t ThermostatMethod; // 0: standard heater, 1: Narrow Hysterisis, 2:Managed Hz mode + uint8_t enableWifi; + uint8_t enableOTA; + bool valid() { + bool retval = true; + retval &= (DimTime >= 0) && (DimTime < 300000); // 5 mins + retval &= (degF == 0) || (degF == 1); + retval &= (ThermostatMethod & 0x03) < 3; // only modes 0, 1 or 2 + retval &= (enableWifi == 0) || (enableWifi == 1); + retval &= (enableOTA == 0) || (enableOTA == 1); + return retval; + } + void init() { + DimTime = 60000; + degF = 0; + ThermostatMethod = 0; + enableWifi = 1; + enableOTA = 1; + }; +}; + // the actual data stored to NV memory struct sNVStore { sHeater Heater; - long DimTime; - uint8_t degF; - uint8_t ThermostatMethod; // 0: standard heater, 1: Narrow Hysterisis, 2:Managed Hz mode + sBTCoptions Options; sTimer timer[14]; bool valid(); void init(); @@ -111,6 +133,8 @@ public: unsigned char getGlowDrive(); unsigned long getDimTime(); unsigned char getDegFMode(); + unsigned char getWifiEnabled(); + unsigned char getOTAEnabled(); void setPmin(float); void setPmax(float); @@ -125,6 +149,8 @@ public: void setGlowDrive(unsigned char val); void setDimTime(unsigned long val); void setDegFMode(unsigned char val); + void setWifiEnabled(unsigned char val); + void setOTAEnabled(unsigned char val); void getTimerInfo(int idx, sTimer& timerInfo); void setTimerInfo(int idx, const sTimer& timerInfo); diff --git a/Arduino/BTCDieselHeater/src/WiFi/BTCWifi.cpp b/Arduino/BTCDieselHeater/src/WiFi/BTCWifi.cpp index ee8c0c2..2ff0f02 100644 --- a/Arduino/BTCDieselHeater/src/WiFi/BTCWifi.cpp +++ b/Arduino/BTCDieselHeater/src/WiFi/BTCWifi.cpp @@ -28,6 +28,7 @@ #include "esp_system.h" #include +#include "../Utility/NVStorage.h" #define USE_AP @@ -193,9 +194,28 @@ void doWiFiManager() } } +void wifiDisable(long rebootDelay) +{ + NVstore.setWifiEnabled(0); + NVstore.save(); + + DebugPort.println("*** Disabling WiFi ***"); + + restartServer = (millis() + rebootDelay) | 1; // prepare to reboot in the future - ensure non zero! + + const char* content[2]; + content[0] = "WiFi Mode \032 DISABLED"; + content[1] = ""; + ScreenManager.showRebootMsg(content, rebootDelay); +} + void wifiEnterConfigPortal(bool state, bool erase, long rebootDelay) { wm.disconnect(); + + NVstore.setWifiEnabled(1); + NVstore.save(); + prepBootIntoConfigPortal(state); const char* content[2]; diff --git a/Arduino/BTCDieselHeater/src/WiFi/BTCWifi.h b/Arduino/BTCDieselHeater/src/WiFi/BTCWifi.h index cf76de2..00f052a 100644 --- a/Arduino/BTCDieselHeater/src/WiFi/BTCWifi.h +++ b/Arduino/BTCDieselHeater/src/WiFi/BTCWifi.h @@ -40,6 +40,7 @@ bool hasWebClientSpoken(bool reset = false); bool hasWebServerSpoken(bool reset = false); void wifiEnterConfigPortal(bool state, bool erase = false, long timeout = 7000); + void wifiDisable(long rebootDelay = 7000); int isWifiButton(); #endif __BTCWIFI_H__ diff --git a/Arduino/BTCDieselHeater/src/cfg/pins.h b/Arduino/BTCDieselHeater/src/cfg/pins.h index 49a3baa..51a861e 100644 --- a/Arduino/BTCDieselHeater/src/cfg/pins.h +++ b/Arduino/BTCDieselHeater/src/cfg/pins.h @@ -21,7 +21,9 @@ #include +const uint8_t UART_Tx = 1; const uint8_t LED_Pin = 2; +const uint8_t UART_Rx = 3; const uint8_t HC05_KeyPin = 4; const uint8_t TxEnbPin = 5; const uint8_t GPIO12_pin = 12; // HSPI std pins