Added logic to check for OTA partitions
Warning will be thrown If OTA is enabled but partition table is not configured for OTA. OTA will not be started.
This commit is contained in:
parent
98cfde8aa9
commit
3a519bdc54
|
|
@ -30,6 +30,7 @@
|
|||
#include <sodium.h>
|
||||
#include <WiFi.h>
|
||||
#include <ArduinoOTA.h>
|
||||
#include <esp_ota_ops.h>
|
||||
|
||||
#include "HomeSpan.h"
|
||||
#include "HAP.h"
|
||||
|
|
@ -445,6 +446,7 @@ void Span::checkConnect(){
|
|||
hapServer->begin();
|
||||
|
||||
if(otaEnabled){
|
||||
if(esp_ota_get_running_partition()!=esp_ota_get_next_update_partition(NULL)){
|
||||
ArduinoOTA.setHostname(hostName);
|
||||
ArduinoOTA.setPasswordHash(otaPwd);
|
||||
|
||||
|
|
@ -480,6 +482,9 @@ void Span::checkConnect(){
|
|||
Serial.print(" at ");
|
||||
Serial.print(WiFi.localIP());
|
||||
Serial.print("\n");
|
||||
} else {
|
||||
Serial.print("\n*** Warning: Can't enable OTA - Partition table used to compile this sketch is not configured for OTA.\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
Serial.print("\n");
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ void setup() {
|
|||
|
||||
Serial.begin(115200);
|
||||
|
||||
homeSpan.setLogLevel(2);
|
||||
homeSpan.setLogLevel(1);
|
||||
|
||||
// homeSpan.setHostNameSuffix("");
|
||||
homeSpan.setPortNum(1200);
|
||||
homeSpan.setMaxConnections(16);
|
||||
// homeSpan.setQRID("One1");
|
||||
homeSpan.enableOTA();
|
||||
// homeSpan.enableOTA();
|
||||
homeSpan.setSketchVersion("Test 1.2.3");
|
||||
|
||||
homeSpan.begin(Category::Lighting,"HomeSpanTest");
|
||||
|
|
|
|||
Loading…
Reference in New Issue