add restart reason: OTA completed
This commit is contained in:
3
Ota.cpp
3
Ota.cpp
@@ -1,6 +1,7 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "Ota.h"
|
#include "Ota.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
#include "RestartReason.h"
|
||||||
|
|
||||||
#define FULL_PACKET 1436 // HTTP_UPLOAD_BUFLEN in WebServer,h
|
#define FULL_PACKET 1436 // HTTP_UPLOAD_BUFLEN in WebServer,h
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ void Ota::updateFirmware(uint8_t* buf, size_t size)
|
|||||||
if (ESP_OK == esp_ota_set_boot_partition(esp_ota_get_next_update_partition(NULL)))
|
if (ESP_OK == esp_ota_set_boot_partition(esp_ota_get_next_update_partition(NULL)))
|
||||||
{
|
{
|
||||||
delay(2000);
|
delay(2000);
|
||||||
esp_restart();
|
restartEsp(RestartReason::OTACompleted);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ enum class RestartReason
|
|||||||
NetworkDeviceCriticalFailure,
|
NetworkDeviceCriticalFailure,
|
||||||
ConfigurationUpdated,
|
ConfigurationUpdated,
|
||||||
RestartTimer,
|
RestartTimer,
|
||||||
|
OTACompleted,
|
||||||
OTATimeout,
|
OTATimeout,
|
||||||
OTAAborted,
|
OTAAborted,
|
||||||
OTAUnknownState,
|
OTAUnknownState,
|
||||||
@@ -60,8 +61,14 @@ inline static String getRestartReason()
|
|||||||
return "ConfigurationUpdated";
|
return "ConfigurationUpdated";
|
||||||
case RestartReason::RestartTimer:
|
case RestartReason::RestartTimer:
|
||||||
return "RestartTimer";
|
return "RestartTimer";
|
||||||
|
case RestartReason::OTACompleted:
|
||||||
|
return "OTACompleted";
|
||||||
case RestartReason::OTATimeout:
|
case RestartReason::OTATimeout:
|
||||||
return "OTATimeout";
|
return "OTATimeout";
|
||||||
|
case RestartReason::OTAAborted:
|
||||||
|
return "OTAAborted";
|
||||||
|
case RestartReason::OTAUnknownState:
|
||||||
|
return "OTAUnknownState";
|
||||||
case RestartReason::DeviceUnpaired:
|
case RestartReason::DeviceUnpaired:
|
||||||
return "DeviceUnpaired";
|
return "DeviceUnpaired";
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user