aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ble/DfuService.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/ble/DfuService.cpp')
-rw-r--r--src/components/ble/DfuService.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/components/ble/DfuService.cpp b/src/components/ble/DfuService.cpp
index 1f06b69e..2427513d 100644
--- a/src/components/ble/DfuService.cpp
+++ b/src/components/ble/DfuService.cpp
@@ -124,9 +124,11 @@ int DfuService::WritePacketHandler(uint16_t connectionHandle, os_mbuf* om) {
bootloaderSize,
applicationSize);
- // wait until SystemTask has finished waking up all devices
- while (systemTask.IsSleeping()) {
- vTaskDelay(50); // 50ms
+ // Wait until SystemTask has disabled sleeping
+ // This isn't quite correct, as we don't actually know
+ // if BleFirmwareUpdateStarted has been received yet
+ while (!systemTask.IsSleepDisabled()) {
+ vTaskDelay(pdMS_TO_TICKS(5));
}
dfuImage.Erase();
@@ -357,6 +359,8 @@ void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t exp
this->totalSize = totalSize;
this->expectedCrc = expectedCrc;
this->ready = true;
+ totalWriteIndex = 0;
+ bufferWriteIndex = 0;
}
void DfuService::DfuImage::Append(uint8_t* data, size_t size) {