mirror of
https://github.com/scottchiefbaker/ESP-WebOTA.git
synced 2025-07-25 21:02:33 +00:00
error messages
This commit is contained in:
@ -302,7 +302,7 @@ int WebOTA::add_http_routes(WebServer *server, const char *path) {
|
||||
|
||||
if (!Update.begin(maxSketchSpace)) { //start with max available size
|
||||
if (_error_callback) {
|
||||
_error_callback();
|
||||
_error_callback(OTA_BEGIN_ERROR);
|
||||
}
|
||||
Update.printError(Serial);
|
||||
}
|
||||
@ -310,7 +310,7 @@ int WebOTA::add_http_routes(WebServer *server, const char *path) {
|
||||
/* flashing firmware to ESP*/
|
||||
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
|
||||
if (_error_callback) {
|
||||
_error_callback();
|
||||
_error_callback(OTA_END_ERROR);
|
||||
}
|
||||
Update.printError(Serial);
|
||||
}
|
||||
@ -334,7 +334,7 @@ int WebOTA::add_http_routes(WebServer *server, const char *path) {
|
||||
Serial.printf("\r\nFirmware update successful: %u bytes\r\nRebooting...\r\n", upload.totalSize);
|
||||
} else {
|
||||
if (_error_callback) {
|
||||
_error_callback();
|
||||
_error_callback(OTA_END_ERROR);
|
||||
}
|
||||
Update.printError(Serial);
|
||||
}
|
||||
|
@ -7,6 +7,14 @@
|
||||
#include <WebServer.h>
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
OTA_AUTH_ERROR,
|
||||
OTA_BEGIN_ERROR,
|
||||
OTA_CONNECT_ERROR,
|
||||
OTA_RECEIVE_ERROR,
|
||||
OTA_END_ERROR
|
||||
} ota_error_t;
|
||||
|
||||
class WebOTA {
|
||||
public:
|
||||
unsigned int port;
|
||||
@ -30,7 +38,6 @@ class WebOTA {
|
||||
void set_custom_html(char const * const html);
|
||||
|
||||
typedef std::function<void(void)> THandlerFunction;
|
||||
typedef std::function<void(void)> THandlerFunction_Error;
|
||||
typedef std::function<void(ota_error_t)> THandlerFunction_Error;
|
||||
typedef std::function<void(unsigned int, unsigned int)> THandlerFunction_Progress;
|
||||
|
||||
|
Reference in New Issue
Block a user