Suite of minor bug fixes and annoyances - now Afterburner for AP and BT server names :-)
OTA was not rebooting after AP only update
This commit is contained in:
parent
b47a4606dd
commit
9861297744
|
@ -116,8 +116,8 @@
|
|||
#define RX_DATA_TIMOUT 50
|
||||
|
||||
const int FirmwareRevision = 22;
|
||||
const int FirmwareSubRevision = 2;
|
||||
const char* FirmwareDate = "9 May 2019";
|
||||
const int FirmwareSubRevision = 3;
|
||||
const char* FirmwareDate = "11 May 2019";
|
||||
|
||||
|
||||
#ifdef ESP32
|
||||
|
@ -560,8 +560,8 @@ void loop()
|
|||
// Detect the possible start of a new frame sequence from an OEM controller
|
||||
// This will be the first activity for considerable period on the blue wire
|
||||
// The heater always responds to a controller frame, but otherwise never by itself
|
||||
// if(RxTimeElapsed >= 970) {
|
||||
if(RxTimeElapsed >= NVstore.getFrameRate()) {
|
||||
|
||||
if(RxTimeElapsed >= (NVstore.getFrameRate() - 60)) { // compensate for the time spent just doing things in this state machine
|
||||
// have not seen any receive data for a second.
|
||||
// OEM controller is probably not connected.
|
||||
// Skip state machine immediately to BTC_Tx, sending our own settings.
|
||||
|
@ -1325,3 +1325,7 @@ int getBoardRevision()
|
|||
return BoardRevision;
|
||||
}
|
||||
|
||||
void ShowOTAScreen(int percent)
|
||||
{
|
||||
ScreenManager.showOTAMessage(percent);
|
||||
}
|
|
@ -107,8 +107,8 @@ CBluetoothHC05::begin()
|
|||
|
||||
DebugPort.println("HC-05 found");
|
||||
|
||||
DebugPort.print(" Setting Name to \"Diesel Heater\"... ");
|
||||
if(!ATCommand("AT+NAME=\"Diesel Heater\"\r\n")) {
|
||||
DebugPort.print(" Setting Name to \"Afterburner\"... ");
|
||||
if(!ATCommand("AT+NAME=\"Afterburner\"\r\n")) {
|
||||
DebugPort.println("FAILED");
|
||||
}
|
||||
else {
|
||||
|
@ -145,6 +145,8 @@ CBluetoothHC05::begin()
|
|||
else {
|
||||
DebugPort.println("OK");
|
||||
}*/
|
||||
flush();
|
||||
delay(100);
|
||||
openSerial(9600);
|
||||
|
||||
// leave HC-05 command mode, return to data mode
|
||||
|
@ -231,6 +233,7 @@ CBluetoothHC05::openSerial(int baudrate)
|
|||
bool
|
||||
CBluetoothHC05::ATCommand(const char* cmd)
|
||||
{
|
||||
flush(); // ensure response is for *this* command!
|
||||
HC05_SerialPort.print(cmd);
|
||||
char RxBuffer[16];
|
||||
memset(RxBuffer, 0, 16);
|
||||
|
|
|
@ -490,6 +490,25 @@ CScreenManager::showRebootMsg(const char* content[2], long delayTime)
|
|||
_dim(false);
|
||||
}
|
||||
|
||||
void
|
||||
CScreenManager::showOTAMessage(int percent)
|
||||
{
|
||||
static int prevPercent = -1;
|
||||
if(percent != prevPercent) {
|
||||
_pDisplay->clearDisplay();
|
||||
_pDisplay->setCursor(64,22);
|
||||
_pDisplay->printCentreJustified("OTA update active");
|
||||
if(percent) {
|
||||
char msg[16];
|
||||
sprintf(msg, "%d%%", percent);
|
||||
_pDisplay->setCursor(64,32);
|
||||
_pDisplay->printCentreJustified(msg);
|
||||
}
|
||||
prevPercent = percent;
|
||||
_pDisplay->display();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CScreenManager::_dim(bool state)
|
||||
{
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
void reqUpdate();
|
||||
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);
|
||||
};
|
||||
|
||||
#endif // __SCREEN_MANAGER_H__
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "../Protocol/helpers.h"
|
||||
#include "../Utility/UtilClasses.h"
|
||||
#include "fonts/Icons.h"
|
||||
#include "../Utility/NVStorage.h"
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -38,7 +39,7 @@
|
|||
static const int Line3 = 14;
|
||||
static const int Line2 = 27;
|
||||
static const int Line1 = 40;
|
||||
static const int Column = 50;
|
||||
static const int Column = 40;
|
||||
|
||||
CThermostatModeScreen::CThermostatModeScreen(C128x64_OLED& display, CScreenManager& mgr) : CPasswordScreen(display, mgr)
|
||||
{
|
||||
|
@ -81,8 +82,15 @@ CThermostatModeScreen::show()
|
|||
}
|
||||
else {
|
||||
_printInverted(_display.xCentre(), 0, " Thermostat Mode ", true, eCentreJustify);
|
||||
_display.drawBitmap(10, 14, thermostatIcon, thermostatWidth, thermostatHeight, WHITE);
|
||||
sprintf(msg, "%.1f\367C", _window); // \367 is octal for Adafruit degree symbol
|
||||
_display.drawBitmap(3, 14, thermostatIcon, thermostatWidth, thermostatHeight, WHITE);
|
||||
float fTemp = _window;
|
||||
if(NVstore.getDegFMode()) {
|
||||
fTemp = fTemp * 9 / 5;
|
||||
sprintf(msg, "%.1f\367F", fTemp);
|
||||
}
|
||||
else {
|
||||
sprintf(msg, "%.1f\367C", fTemp);
|
||||
}
|
||||
_printMenuText(Column, Line2, msg, _rowSel == 3);
|
||||
switch(_thermoMode) {
|
||||
case 1:
|
||||
|
@ -96,19 +104,33 @@ CThermostatModeScreen::show()
|
|||
break;
|
||||
}
|
||||
if(_cyclicMode.isEnabled()) {
|
||||
sprintf(msg, "> %d\367C", _cyclicMode.Stop+1); // \367 is octal for Adafruit degree symbol
|
||||
float fTemp = _cyclicMode.Stop+1;
|
||||
if(NVstore.getDegFMode()) {
|
||||
fTemp = fTemp * 9 / 5;
|
||||
sprintf(msg, "\352>%.0f\367F", fTemp);
|
||||
}
|
||||
else {
|
||||
sprintf(msg, "\352>%.0f\367C", fTemp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
strcpy(msg, "OFF");
|
||||
}
|
||||
_printMenuText(Column, Line1, msg, _rowSel == 1);
|
||||
if(_cyclicMode.isEnabled()) {
|
||||
sprintf(msg, "< %d\367C", _cyclicMode.Start); // \367 is octal for Adafruit degree symbol
|
||||
float fTemp = _cyclicMode.Start;
|
||||
if(NVstore.getDegFMode()) {
|
||||
fTemp = fTemp * 9 / 5;
|
||||
sprintf(msg, "\352<%.0f\367F", fTemp);
|
||||
}
|
||||
else {
|
||||
sprintf(msg, "\352<%.0f\367C", fTemp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
strcpy(msg, "");
|
||||
}
|
||||
_printMenuText(Column + 37, Line1, msg, _rowSel == 2);
|
||||
_printMenuText(Column + 42, Line1, msg, _rowSel == 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,7 @@ CVersionInfoScreen::show()
|
|||
_printInverted(_display.xCentre(), 0, " Version Information ", true, eCentreJustify);
|
||||
|
||||
_display.drawBitmap(10, 11, firmwareIcon, firmwareWidth, firmwareHeight, WHITE);
|
||||
sprintf(msg, "V%.3f", getVersion());
|
||||
_printMenuText(43, 14, msg);
|
||||
_printMenuText(43, 14, getVersionStr());
|
||||
_printMenuText(43, 25, getVersionDate());
|
||||
|
||||
_display.drawBitmap(20, 34, hardwareIcon, hardwareWidth, hardwareHeight, WHITE);
|
||||
|
|
|
@ -378,7 +378,7 @@ CHeaterStorage::setHomeMenu(sHomeMenuActions val)
|
|||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
// ESP32
|
||||
//
|
||||
#ifdef ESP32
|
||||
//#ifdef ESP32
|
||||
|
||||
CESP32HeaterStorage::CESP32HeaterStorage()
|
||||
{
|
||||
|
@ -521,8 +521,8 @@ CESP32HeaterStorage::saveUI()
|
|||
preferences.putUChar("thermoMethod", _calValues.Options.ThermostatMethod);
|
||||
preferences.putUChar("enableWifi", _calValues.Options.enableWifi);
|
||||
preferences.putUChar("enableOTA", _calValues.Options.enableOTA);
|
||||
preferences.putUChar("cyclicStop", _calValues.Options.cyclic.Stop);
|
||||
preferences.putUChar("cyclicStart", _calValues.Options.cyclic.Start);
|
||||
preferences.putChar("cyclicStop", _calValues.Options.cyclic.Stop);
|
||||
preferences.putChar("cyclicStart", _calValues.Options.cyclic.Start);
|
||||
preferences.putUChar("GPIOinMode", _calValues.Options.GPIOinMode);
|
||||
preferences.putUChar("GPIOoutMode", _calValues.Options.GPIOoutMode);
|
||||
preferences.putUChar("GPIOalgMode", _calValues.Options.GPIOalgMode);
|
||||
|
@ -631,4 +631,4 @@ bool s32inBounds(long test, long minLim, long maxLim)
|
|||
}
|
||||
|
||||
|
||||
#endif // ESP32
|
||||
//#endif // ESP32
|
|
@ -96,6 +96,11 @@ struct sCyclicThermostat {
|
|||
bool isEnabled() const {
|
||||
return Stop != 0;
|
||||
}
|
||||
sCyclicThermostat& operator=(const sCyclicThermostat& rhs) {
|
||||
Stop = rhs.Stop;
|
||||
Start = rhs.Start;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
struct sBTCoptions {
|
||||
|
|
|
@ -65,7 +65,7 @@ bool initWifi(int initpin,const char *failedssid, const char *failedpassword)
|
|||
DebugPort.print(" AP MAC address: "); DebugPort.println(MACstr[1]);
|
||||
|
||||
char APname[32];
|
||||
sprintf(APname, "%s-%02X%02X", failedssid, MAC[4], MAC[5]);
|
||||
sprintf(APname, "%s", failedssid);
|
||||
|
||||
//reset settings - wipe credentials for testing
|
||||
// wm.resetSettings();
|
||||
|
@ -106,6 +106,7 @@ bool initWifi(int initpin,const char *failedssid, const char *failedpassword)
|
|||
if(!res) {
|
||||
// failed STA mode
|
||||
DebugPort.println("WiFimanager failed STA connection. Setting up AP...");
|
||||
WiFi.disconnect(); // apparently needed for AP only OTA to reboot properly!!!
|
||||
}
|
||||
else {
|
||||
// runs through here if STA connected OK
|
||||
|
|
|
@ -24,6 +24,17 @@
|
|||
#if USE_SPIFFS == 1
|
||||
#include <SPIFFS.h>
|
||||
#endif
|
||||
extern void ShowOTAScreen(int percent=0);
|
||||
|
||||
|
||||
#include <esp_int_wdt.h>
|
||||
#include <esp_task_wdt.h>
|
||||
|
||||
void hard_restart() {
|
||||
esp_task_wdt_init(1,true);
|
||||
esp_task_wdt_add(NULL);
|
||||
while(true);
|
||||
}
|
||||
|
||||
void initOTA(){
|
||||
// ArduinoOTA.setHostname("myesp32");
|
||||
|
@ -41,16 +52,21 @@ void initOTA(){
|
|||
SPIFFS.end();
|
||||
DebugPort.println("Start updating " + type);
|
||||
DebugPort.handle(); // keep telnet spy alive
|
||||
ShowOTAScreen();
|
||||
|
||||
})
|
||||
.onEnd([]() {
|
||||
DebugPort.println("\nEnd");
|
||||
DebugPort.handle(); // keep telnet spy alive
|
||||
DebugPort.end(); // force graceful close of telnetspy - ensures a client will reconnect cleanly
|
||||
ESP.restart();
|
||||
delay(100);
|
||||
// DebugPort.end(); // force graceful close of telnetspy - ensures a client will reconnect cleanly
|
||||
})
|
||||
.onProgress([](unsigned int progress, unsigned int total) {
|
||||
DebugPort.printf("Progress: %u%%\r", (progress / (total / 100)));
|
||||
int percent = (progress / (total / 100));
|
||||
DebugPort.printf("Progress: %u%%\r", percent);
|
||||
DebugPort.handle(); // keep telnet spy alive
|
||||
ShowOTAScreen(percent);
|
||||
|
||||
})
|
||||
.onError([](ota_error_t error) {
|
||||
DebugPort.printf("Error[%u]: ", error);
|
||||
|
@ -59,6 +75,7 @@ void initOTA(){
|
|||
else if (error == OTA_CONNECT_ERROR) DebugPort.println("Connect Failed");
|
||||
else if (error == OTA_RECEIVE_ERROR) DebugPort.println("Receive Failed");
|
||||
else if (error == OTA_END_ERROR) DebugPort.println("End Failed");
|
||||
DebugPort.handle(); // keep telnet spy alive
|
||||
});
|
||||
|
||||
ArduinoOTA.begin();
|
||||
|
|
Loading…
Reference in a new issue