Skip to content

Commit f9eb82b

Browse files
committed
fix: add ota downloaded state
1 parent 69de6a2 commit f9eb82b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/BytebeamOTA.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void BytebeamUpdateProgress(int cur, int total) {
1717
static int loopVar = 0;
1818
static int percentOffset = 10;
1919
static int progressPercent = 0;
20-
char* progressStatus = "Downloading";
20+
static char* progressStatus = "Downloading";
2121

2222
BytebeamLogger::Warn(__FILE__, __func__, "CALLBACK: HTTP update process at %d of %d bytes", cur, total);
2323
progressPercent = (((float)cur / (float)total) * 100.00);
@@ -26,7 +26,12 @@ void BytebeamUpdateProgress(int cur, int total) {
2626
BytebeamLogger::Debug(__FILE__, __func__, "progressPercent : %d", progressPercent);
2727
BytebeamLogger::Debug(__FILE__, __func__, "tempOtaActionId : %s", tempOtaActionId);
2828

29-
// publish the OTA progress
29+
// If we are done, change the status to downloaded
30+
if(progressPercent == 100) {
31+
progressStatus = "Downloaded";
32+
}
33+
34+
// publish the OTA progress status
3035
if(!Bytebeam.publishActionProgress(tempOtaActionId, progressPercent, progressStatus)) {
3136
BytebeamLogger::Error(__FILE__, __func__, "Failed to publish OTA progress status.");
3237
}

0 commit comments

Comments
 (0)