1 parent
2052dfedd9
commit
1bcae500fb
1 file changed
+11
-1
+11
-1
@@ -2294,6 +2294,16 @@ static int CmdPM5QCTest(const char *Cmd) {
|
|||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printprogress(long sent, long total, int style) {
|
||||||
|
int percent = (int)((double)sent / total * 100);
|
||||||
|
|
||||||
|
// Use \r at the start to move the cursor back to the beginning of the line
|
||||||
|
printf("\rProgress: [%d%%]", percent);
|
||||||
|
|
||||||
|
// Force stdout to print immediately without waiting for a newline
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
// One full OTA attempt: BEGIN -> WRITE... -> END. The BWM OTA has no resume
|
// One full OTA attempt: BEGIN -> WRITE... -> END. The BWM OTA has no resume
|
||||||
// (DEV.md 8.4): a dropped chunk can't be re-sent, so any failure here means the
|
// (DEV.md 8.4): a dropped chunk can't be re-sent, so any failure here means the
|
||||||
// caller must restart the whole thing.
|
// caller must restart the whole thing.
|
||||||
@@ -2338,7 +2348,7 @@ static int bwm_ota_once(const uint8_t *fw, size_t fwlen, uint32_t write_delay_ms
|
|||||||
return PM3_EFAILED;
|
return PM3_EFAILED;
|
||||||
}
|
}
|
||||||
sent += n;
|
sent += n;
|
||||||
print_progress(sent, fwlen, STYLE_MIXED);
|
printprogress(sent, fwlen, STYLE_MIXED);
|
||||||
|
|
||||||
// Pace the stream. The client->AT32 hop (USB/BLE) is far faster than the
|
// Pace the stream. The client->AT32 hop (USB/BLE) is far faster than the
|
||||||
// AT32->ESP UART, so back-to-back writes can outrun the UART and drop a
|
// AT32->ESP UART, so back-to-back writes can outrun the UART and drop a
|
||||||
|
|||||||
Reference in new issue
Block a user