fix hass setup
This commit is contained in:
9
Ota.cpp
9
Ota.cpp
@@ -1,5 +1,6 @@
|
||||
#include <Arduino.h>
|
||||
#include "Ota.h"
|
||||
#include "Logger.h"
|
||||
|
||||
#define FULL_PACKET 1436 // HTTP_UPLOAD_BUFLEN in WebServer,h
|
||||
|
||||
@@ -7,13 +8,13 @@ void Ota::updateFirmware(uint8_t* buf, size_t size)
|
||||
{
|
||||
if(!_updateStarted && size == 0)
|
||||
{
|
||||
Serial.println("OTA upload cancelled, size is 0.");
|
||||
Log->println("OTA upload cancelled, size is 0.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_updateStarted)
|
||||
{ //If it's the first packet of OTA since bootup, begin OTA
|
||||
Serial.println("BeginOTA");
|
||||
Log->println("BeginOTA");
|
||||
esp_ota_begin(esp_ota_get_next_update_partition(NULL), OTA_SIZE_UNKNOWN, &otaHandler);
|
||||
_updateStarted = true;
|
||||
}
|
||||
@@ -21,7 +22,7 @@ void Ota::updateFirmware(uint8_t* buf, size_t size)
|
||||
if (size != FULL_PACKET)
|
||||
{
|
||||
esp_ota_end(otaHandler);
|
||||
Serial.println("EndOTA");
|
||||
Log->println("EndOTA");
|
||||
if (ESP_OK == esp_ota_set_boot_partition(esp_ota_get_next_update_partition(NULL)))
|
||||
{
|
||||
delay(2000);
|
||||
@@ -29,7 +30,7 @@ void Ota::updateFirmware(uint8_t* buf, size_t size)
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.println("Upload Error");
|
||||
Log->println("Upload Error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user