Added some FreeRTOS tasks to avoid blocking issues - still very unreliable
This commit is contained in:
parent
b58ed90432
commit
baf8678e99
|
@ -381,6 +381,10 @@ void setup() {
|
||||||
DebugPort.setBufferSize(8192);
|
DebugPort.setBufferSize(8192);
|
||||||
DebugPort.begin(115200);
|
DebugPort.begin(115200);
|
||||||
DebugPort.println("_______________________________________________________________");
|
DebugPort.println("_______________________________________________________________");
|
||||||
|
|
||||||
|
DebugPort.printf("Arduino task priority was %d\r\n", uxTaskPriorityGet(NULL));
|
||||||
|
vTaskPrioritySet(NULL, TASKPRIORITY_ARDUINO);
|
||||||
|
DebugPort.printf("Arduino task priority now %d\r\n", uxTaskPriorityGet(NULL));
|
||||||
|
|
||||||
DebugPort.printf("Getting NVS stats\r\n");
|
DebugPort.printf("Getting NVS stats\r\n");
|
||||||
|
|
||||||
|
@ -554,6 +558,8 @@ void setup() {
|
||||||
TempSensor.getDS18B20().mapSensor(2, NVstore.getHeaterTuning().DS18B20probe[2].romCode);
|
TempSensor.getDS18B20().mapSensor(2, NVstore.getHeaterTuning().DS18B20probe[2].romCode);
|
||||||
|
|
||||||
delay(1000); // just to hold the splash screeen for while
|
delay(1000); // just to hold the splash screeen for while
|
||||||
|
|
||||||
|
ScreenManager.clearDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -628,7 +634,7 @@ void loop()
|
||||||
|
|
||||||
if(bReportRecyleEvents)
|
if(bReportRecyleEvents)
|
||||||
DebugPort.println("Recycling blue wire serial interface");
|
DebugPort.println("Recycling blue wire serial interface");
|
||||||
initBlueWireSerial();
|
// initBlueWireSerial();
|
||||||
CommState.set(CommStates::TemperatureRead); // revert to idle mode, after passing thru temperature mode
|
CommState.set(CommStates::TemperatureRead); // revert to idle mode, after passing thru temperature mode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1051,7 +1057,7 @@ bool validateFrame(const CProtocol& frame, const char* name)
|
||||||
// Bad CRC - restart blue wire Serial port
|
// Bad CRC - restart blue wire Serial port
|
||||||
DebugPort.printf("\007Bad CRC detected for %s frame - restarting blue wire's serial port\r\n", name);
|
DebugPort.printf("\007Bad CRC detected for %s frame - restarting blue wire's serial port\r\n", name);
|
||||||
DebugReportFrame("BAD CRC:", frame, "\r\n");
|
DebugReportFrame("BAD CRC:", frame, "\r\n");
|
||||||
initBlueWireSerial();
|
// initBlueWireSerial();
|
||||||
CommState.set(CommStates::TemperatureRead);
|
CommState.set(CommStates::TemperatureRead);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1623,7 +1629,7 @@ void feedWatchdog()
|
||||||
#if USE_SW_WATCHDOG == 1 && USE_JTAG == 0
|
#if USE_SW_WATCHDOG == 1 && USE_JTAG == 0
|
||||||
// BEST NOT USE WATCHDOG WITH JTAG DEBUG :-)
|
// BEST NOT USE WATCHDOG WITH JTAG DEBUG :-)
|
||||||
// DebugPort.printf("\r %ld Watchdog fed", millis());
|
// DebugPort.printf("\r %ld Watchdog fed", millis());
|
||||||
DebugPort.print("~");
|
// DebugPort.print("~");
|
||||||
WatchdogTick = 1500;
|
WatchdogTick = 1500;
|
||||||
#else
|
#else
|
||||||
WatchdogTick = -1;
|
WatchdogTick = -1;
|
||||||
|
@ -1648,7 +1654,7 @@ void doStreaming()
|
||||||
if(NVstore.getUserSettings().wifiMode) {
|
if(NVstore.getUserSettings().wifiMode) {
|
||||||
doWiFiManager();
|
doWiFiManager();
|
||||||
#if USE_OTA == 1
|
#if USE_OTA == 1
|
||||||
doOTA();
|
// doOTA();
|
||||||
#endif // USE_OTA
|
#endif // USE_OTA
|
||||||
#if USE_WEBSERVER == 1
|
#if USE_WEBSERVER == 1
|
||||||
bHaveWebClient = doWebServer();
|
bHaveWebClient = doWebServer();
|
||||||
|
|
|
@ -33,7 +33,7 @@ protected:
|
||||||
virtual void foldbackDesiredTemp() {};
|
virtual void foldbackDesiredTemp() {};
|
||||||
public:
|
public:
|
||||||
virtual void begin() {};
|
virtual void begin() {};
|
||||||
virtual void send(const char* Str) {};
|
virtual bool send(const char* Str) { return false; };
|
||||||
virtual void check() {};
|
virtual void check() {};
|
||||||
virtual void collectRxData(char rxVal) {
|
virtual void collectRxData(char rxVal) {
|
||||||
// provide common behviour for bytes received from a bluetooth client
|
// provide common behviour for bytes received from a bluetooth client
|
||||||
|
|
|
@ -85,7 +85,7 @@ CBluetoothESP32Classic::check()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
CBluetoothESP32Classic::send(const char* Str)
|
CBluetoothESP32Classic::send(const char* Str)
|
||||||
{
|
{
|
||||||
if(isConnected()) {
|
if(isConnected()) {
|
||||||
|
@ -95,12 +95,14 @@ CBluetoothESP32Classic::send(const char* Str)
|
||||||
#endif
|
#endif
|
||||||
SerialBT.write((uint8_t*)Str, strlen(Str));
|
SerialBT.write((uint8_t*)Str, strlen(Str));
|
||||||
delay(10);
|
delay(10);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DebugPort.println("No Bluetooth client");
|
DebugPort.println("No Bluetooth client");
|
||||||
#if BT_LED == 1
|
#if BT_LED == 1
|
||||||
digitalWrite(LED_Pin, 0);
|
digitalWrite(LED_Pin, 0);
|
||||||
#endif
|
#endif
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +263,7 @@ CBluetoothESP32BLE::sendFrame(const char* pHdr, const CProtocol& Frame, bool lin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
void
|
bool
|
||||||
CBluetoothESP32BLE::send(const char* Str)
|
CBluetoothESP32BLE::send(const char* Str)
|
||||||
{
|
{
|
||||||
char fullMsg[32];
|
char fullMsg[32];
|
||||||
|
@ -275,12 +277,14 @@ CBluetoothESP32BLE::send(const char* Str)
|
||||||
|
|
||||||
BLE_Send(txData);
|
BLE_Send(txData);
|
||||||
delay(10);
|
delay(10);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DebugPort.println("No Bluetooth client");
|
DebugPort.println("No Bluetooth client");
|
||||||
#if BT_LED == 1
|
#if BT_LED == 1
|
||||||
digitalWrite(LED_Pin, 0);
|
digitalWrite(LED_Pin, 0);
|
||||||
#endif
|
#endif
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class CBluetoothESP32Classic : public CBluetoothAbstract {
|
||||||
BluetoothSerial SerialBT;
|
BluetoothSerial SerialBT;
|
||||||
public:
|
public:
|
||||||
virtual void begin();
|
virtual void begin();
|
||||||
virtual void send(const char* Str);
|
virtual bool send(const char* Str);
|
||||||
virtual void check();
|
virtual void check();
|
||||||
virtual bool isConnected();
|
virtual bool isConnected();
|
||||||
};
|
};
|
||||||
|
@ -64,7 +64,7 @@ public:
|
||||||
CBluetoothESP32BLE();
|
CBluetoothESP32BLE();
|
||||||
virtual ~CBluetoothESP32BLE();
|
virtual ~CBluetoothESP32BLE();
|
||||||
virtual void begin();
|
virtual void begin();
|
||||||
virtual void send(const char* Str);
|
virtual bool send(const char* Str);
|
||||||
virtual void check();
|
virtual void check();
|
||||||
virtual bool isConnected();
|
virtual bool isConnected();
|
||||||
|
|
||||||
|
|
|
@ -199,14 +199,16 @@ CBluetoothHC05::isConnected()
|
||||||
return digitalRead(_sensePin);
|
return digitalRead(_sensePin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
CBluetoothHC05::send(const char* Str)
|
CBluetoothHC05::send(const char* Str)
|
||||||
{
|
{
|
||||||
if(isConnected() && !_bTest) {
|
if(isConnected() && !_bTest) {
|
||||||
HC05_SerialPort.print(Str);
|
HC05_SerialPort.print(Str);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// DebugPort.print("No Bluetooth client");
|
// DebugPort.print("No Bluetooth client");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class CBluetoothHC05 : public CBluetoothAbstract {
|
||||||
public:
|
public:
|
||||||
CBluetoothHC05(int keyPin, int sensePin);
|
CBluetoothHC05(int keyPin, int sensePin);
|
||||||
void begin();
|
void begin();
|
||||||
void send(const char* Str);
|
bool send(const char* Str);
|
||||||
void check();
|
void check();
|
||||||
virtual bool isConnected();
|
virtual bool isConnected();
|
||||||
const char* getMAC();
|
const char* getMAC();
|
||||||
|
|
|
@ -468,6 +468,7 @@ CScreenManager::_loadScreens()
|
||||||
_bReload = false;
|
_bReload = false;
|
||||||
reqUpdate();
|
reqUpdate();
|
||||||
_enterScreen();
|
_enterScreen();
|
||||||
|
showSplash();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -790,6 +791,34 @@ CScreenManager::showSplash()
|
||||||
_pDisplay->display();
|
_pDisplay->display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CScreenManager::showBootMsg(const char* msg)
|
||||||
|
{
|
||||||
|
CTransientFont AF(*_pDisplay, &arialItalic_7ptFontInfo);
|
||||||
|
_pDisplay->fillRect(0, 50, 128, 14, BLACK);
|
||||||
|
_pDisplay->setCursor(0, 50);
|
||||||
|
_pDisplay->print(msg);
|
||||||
|
_pDisplay->display();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CScreenManager::showBootWait(int show)
|
||||||
|
{
|
||||||
|
static int idx = 0;
|
||||||
|
// idx++;
|
||||||
|
BITMAP_INFO bitmap = hourGlassIcon0Info;
|
||||||
|
switch(idx++ & 0x03) {
|
||||||
|
case 0: bitmap = hourGlassIcon0Info; break;
|
||||||
|
case 1: bitmap = hourGlassIcon1Info; break;
|
||||||
|
case 2: bitmap = hourGlassIcon2Info; break;
|
||||||
|
case 3: bitmap = hourGlassIcon3Info; break;
|
||||||
|
}
|
||||||
|
_pDisplay->fillRect(80, 50, bitmap.width, bitmap.height, BLACK);
|
||||||
|
if(show)
|
||||||
|
_pDisplay->drawBitmap(80, 50, bitmap.pBitmap, bitmap.width, bitmap.height, WHITE);
|
||||||
|
_pDisplay->display();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CScreenManager::selectHomeMenu()
|
CScreenManager::selectHomeMenu()
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,6 +73,8 @@ public:
|
||||||
void selectMenu(eUIMenuSets menuset, int specific = -1); // use to select loop menus, including the root or branches
|
void selectMenu(eUIMenuSets menuset, int specific = -1); // use to select loop menus, including the root or branches
|
||||||
void returnMenu(); // use to select loop menus, including the root or branches
|
void returnMenu(); // use to select loop menus, including the root or branches
|
||||||
void showRebootMsg(const char* content[2], long delayTime);
|
void showRebootMsg(const char* content[2], long delayTime);
|
||||||
|
void showBootMsg(const char* msg);
|
||||||
|
void showBootWait(int show);
|
||||||
void showOTAMessage(int percent, eOTAmodes updateType);
|
void showOTAMessage(int percent, eOTAmodes updateType);
|
||||||
void clearDisplay();
|
void clearDisplay();
|
||||||
void bumpTimeout();
|
void bumpTimeout();
|
||||||
|
|
|
@ -2918,11 +2918,11 @@ const uint8_t PROGMEM arialItalic_7ptBitmaps [] =
|
||||||
0x10, 0x00, // #
|
0x10, 0x00, // #
|
||||||
|
|
||||||
// @458 'T' (5 pixels wide)
|
// @458 'T' (5 pixels wide)
|
||||||
0x40, 0x00, // #
|
0x20, 0x00, // #
|
||||||
0x47, 0x00, // # ###
|
0x23, 0x80, // # ###
|
||||||
0x78, 0x00, // ####
|
0x3c, 0x00, // ####
|
||||||
0x40, 0x00, // #
|
0x20, 0x00, // #
|
||||||
0x40, 0x00, // #
|
0x20, 0x00, // #
|
||||||
|
|
||||||
// @468 'U' (6 pixels wide)
|
// @468 'U' (6 pixels wide)
|
||||||
0x07, 0x00, // ###
|
0x07, 0x00, // ###
|
||||||
|
|
|
@ -1360,3 +1360,60 @@ const uint8_t PROGMEM humidityIcon[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
const BITMAP_INFO humidityIconInfo(15, 14, humidityIcon);
|
const BITMAP_INFO humidityIconInfo(15, 14, humidityIcon);
|
||||||
|
|
||||||
|
|
||||||
|
const uint8_t PROGMEM HourGlass0_Icon[] =
|
||||||
|
{
|
||||||
|
0x01, 0xFF, // #########
|
||||||
|
0x00, 0xFE, // #######
|
||||||
|
0x00, 0xFE, // #######
|
||||||
|
0x00, 0x7C, // #####
|
||||||
|
0x00, 0x38, // ###
|
||||||
|
0x00, 0x44, // # #
|
||||||
|
0x00, 0x82, // # #
|
||||||
|
0x00, 0x82, // # #
|
||||||
|
0x00, 0x82, // # #
|
||||||
|
0x01, 0xFF, // #########
|
||||||
|
};const uint8_t PROGMEM HourGlass1_Icon[] =
|
||||||
|
{
|
||||||
|
0x01, 0xFF, // #########
|
||||||
|
0x00, 0x82, // # #
|
||||||
|
0x00, 0xEE, // ### ###
|
||||||
|
0x00, 0x7C, // #####
|
||||||
|
0x00, 0x38, // ###
|
||||||
|
0x00, 0x44, // # #
|
||||||
|
0x00, 0x82, // # #
|
||||||
|
0x00, 0x92, // # # #
|
||||||
|
0x00, 0xBA, // # ### #
|
||||||
|
0x01, 0xFF, // #########
|
||||||
|
};const uint8_t PROGMEM HourGlass2_Icon[] =
|
||||||
|
{
|
||||||
|
0x01, 0xFF, // #########
|
||||||
|
0x00, 0x82, // # #
|
||||||
|
0x00, 0x82, // # #
|
||||||
|
0x00, 0x7C, // #####
|
||||||
|
0x00, 0x38, // ###
|
||||||
|
0x00, 0x44, // # #
|
||||||
|
0x00, 0x92, // # # #
|
||||||
|
0x00, 0xBA, // # ### #
|
||||||
|
0x00, 0xFE, // #######
|
||||||
|
0x01, 0xFF, // #########
|
||||||
|
};const uint8_t PROGMEM HourGlass3_Icon[] =
|
||||||
|
{
|
||||||
|
0x01, 0xFF, // #########
|
||||||
|
0x00, 0x82, // # #
|
||||||
|
0x00, 0x82, // # #
|
||||||
|
0x00, 0x44, // # #
|
||||||
|
0x00, 0x28, // # #
|
||||||
|
0x00, 0x44, // # #
|
||||||
|
0x00, 0xBA, // # ### #
|
||||||
|
0x00, 0xFE, // #######
|
||||||
|
0x00, 0xFE, // #######
|
||||||
|
0x01, 0xFF, // #########
|
||||||
|
};
|
||||||
|
|
||||||
|
const BITMAP_INFO hourGlassIcon0Info(16, 10, HourGlass0_Icon);
|
||||||
|
const BITMAP_INFO hourGlassIcon1Info(16, 10, HourGlass1_Icon);
|
||||||
|
const BITMAP_INFO hourGlassIcon2Info(16, 10, HourGlass2_Icon);
|
||||||
|
const BITMAP_INFO hourGlassIcon3Info(16, 10, HourGlass3_Icon);
|
||||||
|
|
||||||
|
|
|
@ -162,3 +162,8 @@ extern const BITMAP_INFO threshIconInfo;
|
||||||
extern const BITMAP_INFO onOffIconInfo;
|
extern const BITMAP_INFO onOffIconInfo;
|
||||||
extern const BITMAP_INFO frostIconInfo;
|
extern const BITMAP_INFO frostIconInfo;
|
||||||
extern const BITMAP_INFO humidityIconInfo;
|
extern const BITMAP_INFO humidityIconInfo;
|
||||||
|
|
||||||
|
extern const BITMAP_INFO hourGlassIcon0Info;
|
||||||
|
extern const BITMAP_INFO hourGlassIcon1Info;
|
||||||
|
extern const BITMAP_INFO hourGlassIcon2Info;
|
||||||
|
extern const BITMAP_INFO hourGlassIcon3Info;
|
||||||
|
|
|
@ -562,14 +562,23 @@ void Expand(std::string& str)
|
||||||
|
|
||||||
void sendJSONtext(const char* jsonStr)
|
void sendJSONtext(const char* jsonStr)
|
||||||
{
|
{
|
||||||
|
std::string dest;
|
||||||
DebugPort.print("1");
|
DebugPort.print("1");
|
||||||
sendWebSocketString( jsonStr );
|
if(sendWebSocketString( jsonStr ))
|
||||||
|
dest += "W";
|
||||||
DebugPort.print("2");
|
DebugPort.print("2");
|
||||||
mqttPublishJSON(jsonStr);
|
if(mqttPublishJSON(jsonStr))
|
||||||
|
dest += "M";
|
||||||
DebugPort.print("3");
|
DebugPort.print("3");
|
||||||
std::string expand = jsonStr;
|
std::string expand = jsonStr;
|
||||||
Expand(expand);
|
Expand(expand);
|
||||||
getBluetoothClient().send( expand.c_str() );
|
if(getBluetoothClient().send( expand.c_str() ))
|
||||||
|
dest += "B";
|
||||||
|
|
||||||
|
if(!dest.empty()) {
|
||||||
|
DebugPort.printf(" to %s", dest.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void doJSONreboot(uint16_t PIN)
|
void doJSONreboot(uint16_t PIN)
|
||||||
|
|
|
@ -600,6 +600,8 @@ sCredentials::load()
|
||||||
validatedLoad("APpassword", APpassword, 31, "thereisnospoon");
|
validatedLoad("APpassword", APpassword, 31, "thereisnospoon");
|
||||||
validatedLoad("webUpdateUser", webUpdateUsername, 31, "Afterburner");
|
validatedLoad("webUpdateUser", webUpdateUsername, 31, "Afterburner");
|
||||||
validatedLoad("webUpdatePass", webUpdatePassword, 31, "BurnBabyBurn");
|
validatedLoad("webUpdatePass", webUpdatePassword, 31, "BurnBabyBurn");
|
||||||
|
validatedLoad("webUser", webUsername, 31, "Afterburner");
|
||||||
|
validatedLoad("webPass", webPassword, 31, "WebAccess");
|
||||||
preferences.end();
|
preferences.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,6 +614,8 @@ sCredentials::save()
|
||||||
preferences.putString("APpassword", APpassword);
|
preferences.putString("APpassword", APpassword);
|
||||||
preferences.putString("webUpdateUser", webUpdateUsername);
|
preferences.putString("webUpdateUser", webUpdateUsername);
|
||||||
preferences.putString("webUpdatePass", webUpdatePassword);
|
preferences.putString("webUpdatePass", webUpdatePassword);
|
||||||
|
preferences.putString("webUser", webUsername);
|
||||||
|
preferences.putString("webPass", webPassword);
|
||||||
preferences.end();
|
preferences.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,11 +235,15 @@ struct sCredentials : public CESP32_NVStorage {
|
||||||
char APpassword[32];
|
char APpassword[32];
|
||||||
char webUpdateUsername[32];
|
char webUpdateUsername[32];
|
||||||
char webUpdatePassword[32];
|
char webUpdatePassword[32];
|
||||||
|
char webUsername[32];
|
||||||
|
char webPassword[32];
|
||||||
void init() {
|
void init() {
|
||||||
strcpy(APSSID, "Afterburner");
|
strcpy(APSSID, "Afterburner");
|
||||||
strcpy(APpassword, "thereisnospoon");
|
strcpy(APpassword, "thereisnospoon");
|
||||||
strcpy(webUpdateUsername, "Afterburner");
|
strcpy(webUpdateUsername, "Afterburner");
|
||||||
strcpy(webUpdatePassword, "BurnBabyBurn");
|
strcpy(webUpdatePassword, "BurnBabyBurn");
|
||||||
|
strcpy(webUsername, "Afterburner");
|
||||||
|
strcpy(webPassword, "WebAccess");
|
||||||
};
|
};
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
|
@ -249,6 +253,8 @@ struct sCredentials : public CESP32_NVStorage {
|
||||||
strcpy(APpassword, rhs.APpassword);
|
strcpy(APpassword, rhs.APpassword);
|
||||||
strcpy(webUpdateUsername, rhs.webUpdateUsername);
|
strcpy(webUpdateUsername, rhs.webUpdateUsername);
|
||||||
strcpy(webUpdatePassword, rhs.webUpdatePassword);
|
strcpy(webUpdatePassword, rhs.webUpdatePassword);
|
||||||
|
strcpy(webUsername, rhs.webUsername);
|
||||||
|
strcpy(webPassword, rhs.webPassword);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -94,7 +94,9 @@ bool initWifi()
|
||||||
wm.setEnableConfigPortal(shouldBootIntoConfigPortal());
|
wm.setEnableConfigPortal(shouldBootIntoConfigPortal());
|
||||||
//REMOVED - UNSTABLE WHETHER WE GET 192.168.4.1 or 192.168.100.1 ????
|
//REMOVED - UNSTABLE WHETHER WE GET 192.168.4.1 or 192.168.100.1 ????
|
||||||
// REMOVED wm.setAPStaticIPConfig(IPAddress(192, 168, 100, 1), IPAddress(192, 168, 100, 1), IPAddress(255,255,255,0));
|
// REMOVED wm.setAPStaticIPConfig(IPAddress(192, 168, 100, 1), IPAddress(192, 168, 100, 1), IPAddress(255,255,255,0));
|
||||||
|
|
||||||
|
ScreenManager.showBootMsg("Starting WiFi");
|
||||||
|
|
||||||
bool res = wm.autoConnect(creds.APSSID, creds.APpassword); // User definable AP name & password
|
bool res = wm.autoConnect(creds.APSSID, creds.APpassword); // User definable AP name & password
|
||||||
DebugPort.printf("WifiMode after autoConnect = "); DebugPort.println(WiFi.getMode());
|
DebugPort.printf("WifiMode after autoConnect = "); DebugPort.println(WiFi.getMode());
|
||||||
|
|
||||||
|
@ -106,6 +108,7 @@ bool initWifi()
|
||||||
DebugPort.println("WiFimanager failed STA connection. Setting up AP...");
|
DebugPort.println("WiFimanager failed STA connection. Setting up AP...");
|
||||||
WiFi.disconnect(); // apparently needed for AP only OTA to reboot properly!!!
|
WiFi.disconnect(); // apparently needed for AP only OTA to reboot properly!!!
|
||||||
startAP = true;
|
startAP = true;
|
||||||
|
ScreenManager.showBootMsg("STA failed");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// runs through here if STA connected OK
|
// runs through here if STA connected OK
|
||||||
|
@ -120,10 +123,12 @@ bool initWifi()
|
||||||
if(isSTA) {
|
if(isSTA) {
|
||||||
if(NVstore.getUserSettings().wifiMode & 0x02) { // Check for STA only mode
|
if(NVstore.getUserSettings().wifiMode & 0x02) { // Check for STA only mode
|
||||||
DebugPort.println(" Using STA only mode.");
|
DebugPort.println(" Using STA only mode.");
|
||||||
|
ScreenManager.showBootMsg("STA only");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DebugPort.println("Now promoting to STA+AP mode...");
|
DebugPort.println("Now promoting to STA+AP mode...");
|
||||||
startAP = true;
|
startAP = true;
|
||||||
|
ScreenManager.showBootMsg("STA+AP");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if USE_AP_ALWAYS == 1
|
#if USE_AP_ALWAYS == 1
|
||||||
|
@ -140,6 +145,8 @@ bool initWifi()
|
||||||
// DebugPort.printf(" AP SSID: %s\r\n", WiFi.softAPgetHostname());
|
// DebugPort.printf(" AP SSID: %s\r\n", WiFi.softAPgetHostname());
|
||||||
// DebugPort.printf(" AP IP address: %s\r\n", getWifiAPAddrStr());
|
// DebugPort.printf(" AP IP address: %s\r\n", getWifiAPAddrStr());
|
||||||
DebugPort.printf("WifiMode after initWifi = %d\r\n", WiFi.getMode());
|
DebugPort.printf("WifiMode after initWifi = %d\r\n", WiFi.getMode());
|
||||||
|
if(!isSTA)
|
||||||
|
ScreenManager.showBootMsg("AP only");
|
||||||
}
|
}
|
||||||
|
|
||||||
// even though we may have started in STA mode - start the config portal if demanded via the NV flag
|
// even though we may have started in STA mode - start the config portal if demanded via the NV flag
|
||||||
|
|
|
@ -103,7 +103,7 @@ sBrowserUpload::begin(String& filename, int filesize)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
sBrowserUpload::fragment(HTTPUpload& upload)
|
sBrowserUpload::fragment(HTTPUpload& upload, httpsserver::HTTPResponse * res)
|
||||||
{
|
{
|
||||||
if(isSPIFFSupload()) {
|
if(isSPIFFSupload()) {
|
||||||
// SPIFFS update (may be error state)
|
// SPIFFS update (may be error state)
|
||||||
|
@ -118,9 +118,8 @@ sBrowserUpload::fragment(HTTPUpload& upload)
|
||||||
::SPIFFS.remove(SrcFile.name.c_str()); // remove the bad file from SPIFFS
|
::SPIFFS.remove(SrcFile.name.c_str()); // remove the bad file from SPIFFS
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
#ifdef SSL_SERVER
|
if(res)
|
||||||
upload.totalSize += upload.currentSize;
|
upload.totalSize += upload.currentSize;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -130,9 +129,8 @@ sBrowserUpload::fragment(HTTPUpload& upload)
|
||||||
Update.printError(DebugPort);
|
Update.printError(DebugPort);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
#ifdef SSL_SERVER
|
if(res)
|
||||||
upload.totalSize += upload.currentSize;
|
upload.totalSize += upload.currentSize;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return upload.totalSize;
|
return upload.totalSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <SPIFFS.h>
|
#include <SPIFFS.h>
|
||||||
#include <WebServer.h>
|
#include <WebServer.h>
|
||||||
|
#include <HTTPResponse.hpp>
|
||||||
|
|
||||||
struct sBrowserUpload{
|
struct sBrowserUpload{
|
||||||
struct {
|
struct {
|
||||||
|
@ -49,7 +50,7 @@ struct sBrowserUpload{
|
||||||
}
|
}
|
||||||
void init();
|
void init();
|
||||||
int begin(String& filename, int filesize = -1);
|
int begin(String& filename, int filesize = -1);
|
||||||
int fragment(HTTPUpload& upload);
|
int fragment(HTTPUpload& upload, httpsserver::HTTPResponse * res = NULL);
|
||||||
int end(HTTPUpload& upload);
|
int end(HTTPUpload& upload);
|
||||||
bool isSPIFFSupload() const { return DstFile.state != 0; };
|
bool isSPIFFSupload() const { return DstFile.state != 0; };
|
||||||
bool isOK() const;
|
bool isOK() const;
|
||||||
|
|
|
@ -117,3 +117,9 @@
|
||||||
//
|
//
|
||||||
#define USE_SW_WATCHDOG 1
|
#define USE_SW_WATCHDOG 1
|
||||||
|
|
||||||
|
#define USE_SSL_LOOP_TASK 1
|
||||||
|
// FreeRTOS task priorities
|
||||||
|
#define TASKPRIORITY_ARDUINO 3
|
||||||
|
#define TASKPRIORITY_HEATERCOMMS 4
|
||||||
|
#define TASKPRIORITY_SSL_CERT 1
|
||||||
|
#define TASKPRIORITY_SSL_LOOP 1
|
Loading…
Reference in a new issue