Skip to content

Commit 862cd25

Browse files
fixup! Improving ESP32 ota to be inline with new IoTCloud implementation
1 parent d153911 commit 862cd25

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/Arduino_ESP32_OTA.h

+17-1
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,22 @@ class Arduino_ESP32_OTA
9797
// call progressDownload, until it returns OtaDownloadCompleted
9898
// returns the value in content-length http header
9999
int startDownload(const char * ota_url);
100-
OTADownloadState progressDownload();
100+
101+
// This function is used to make the download progress.
102+
// it returns 0, if the download is in progress
103+
// it returns 1, if the download is completed
104+
// it returns <0 if an error occurred, following Error enum values
105+
int progressDownload();
106+
107+
// this function is used to get the progress of the download
108+
// it returns a positive value when the download is progressing correctly
109+
// it returns a negative value on error following Error enum values
101110
int downloadProgress();
102111

112+
// this function is used to get the size of the download
113+
// 0 if no download is in progress
114+
size_t downloadSize();
115+
103116
virtual void write_byte_to_flash(uint8_t data);
104117
Arduino_ESP32_OTA::Error verify();
105118
Arduino_ESP32_OTA::Error update();
@@ -123,6 +136,9 @@ class Arduino_ESP32_OTA
123136
uint32_t downloadedSize;
124137
uint32_t writtenBytes;
125138

139+
// If an error occurred during download it is reported in this field
140+
Error error;
141+
126142
// LZSS decoder
127143
LZSSDecoder decoder;
128144

0 commit comments

Comments
 (0)