Skip to content

Commit b974fbd

Browse files
Jason2866arendst
andauthored
Fix wdt OTA update
* Fix ESP32-Solo WDT on HTTP OTA update Co-authored-by: Theo Arends <11044339+arendst@users.noreply.github.com>
1 parent 4ada3f5 commit b974fbd

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

cores/esp32/Esp.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ extern "C" {
4242
#elif CONFIG_IDF_TARGET_ESP32C3
4343
#include "esp32c3/rom/spi_flash.h"
4444
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c3 is located at 0x0000
45-
#else
45+
#else
4646
#error Target CONFIG_IDF_TARGET is not supported
4747
#endif
4848
#else // ESP32 Before IDF 4.0
@@ -187,7 +187,7 @@ static uint32_t sketchSize(sketchSize_t response) {
187187
return data.image_len;
188188
}
189189
}
190-
190+
191191
uint32_t EspClass::getSketchSize () {
192192
return sketchSize(SKETCH_SIZE_TOTAL);
193193
}
@@ -226,6 +226,8 @@ String EspClass::getSketchMD5()
226226
md5.add(buf.get(), readBytes);
227227
lengthLeft -= readBytes;
228228
offset += readBytes;
229+
230+
delay(1); // Fix solo WDT
229231
}
230232
md5.calculate();
231233
result = md5.toString();
@@ -376,17 +378,17 @@ bool EspClass::flashRead(uint32_t offset, uint32_t *data, size_t size)
376378
return spi_flash_read(offset, (uint32_t*) data, size) == ESP_OK;
377379
}
378380

379-
bool EspClass::partitionEraseRange(const esp_partition_t *partition, uint32_t offset, size_t size)
381+
bool EspClass::partitionEraseRange(const esp_partition_t *partition, uint32_t offset, size_t size)
380382
{
381383
return esp_partition_erase_range(partition, offset, size) == ESP_OK;
382384
}
383385

384-
bool EspClass::partitionWrite(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size)
386+
bool EspClass::partitionWrite(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size)
385387
{
386388
return esp_partition_write(partition, offset, data, size) == ESP_OK;
387389
}
388390

389-
bool EspClass::partitionRead(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size)
391+
bool EspClass::partitionRead(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size)
390392
{
391393
return esp_partition_read(partition, offset, data, size) == ESP_OK;
392394
}

libraries/Update/src/Updater.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ size_t UpdateClass::writeStream(Stream &data) {
352352
bytesToRead = remaining();
353353
}
354354

355-
/*
355+
/*
356356
Init read&timeout counters and try to read, if read failed, increase counter,
357357
wait 100ms and try to read again. If counter > 300 (30 sec), give up/abort
358358
*/
@@ -377,6 +377,8 @@ size_t UpdateClass::writeStream(Stream &data) {
377377
if((_bufferLen == remaining() || _bufferLen == SPI_FLASH_SEC_SIZE) && !_writeBuffer())
378378
return written;
379379
written += toRead;
380+
381+
delay(1); // Fix solo WDT
380382
}
381383
return written;
382384
}

0 commit comments

Comments
 (0)