hw bwm upgrade: print the upload progress in place
The upload used its own printf "\rProgress: [n%]" line, without the client prefix, spinner or emoji. Print it with PrintAndLogEx(INPLACE), in the same format as the spiffs upload, and drop the unused helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f5e3af6472
commit
645f04f545
1 file changed
+5
-11
+5
-11
@@ -451,16 +451,6 @@ static int CmdBwmSetCap(const char *Cmd) {
|
||||
}
|
||||
|
||||
|
||||
static void progressbar(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
|
||||
// (DEV.md 8.4): a dropped chunk can't be re-sent, so any failure here means the
|
||||
// caller must restart the whole thing.
|
||||
@@ -516,7 +506,11 @@ static int bwm_ota_once(const uint8_t *fw, size_t fwlen, uint32_t write_delay_ms
|
||||
return PM3_EFAILED;
|
||||
}
|
||||
sent += n;
|
||||
progressbar(sent, fwlen, STYLE_MIXED);
|
||||
PrintAndLogEx(INPLACE, "Sent " _YELLOW_("%zu") " / " _YELLOW_("%zu") " bytes (" _YELLOW_("%u") "%%)"
|
||||
, sent
|
||||
, fwlen
|
||||
, (uint32_t)((sent * 100) / fwlen)
|
||||
);
|
||||
|
||||
// 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
|
||||
|
||||
Reference in new issue
Block a user