Implement OTA abort handling in cmdhw.c

Added logic to restore fast link and log OTA abort action on firmware update failure.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
This commit is contained in:
Niel Nielsen authored and GitHub committed 2026-09-03 10:59:52 +02:00
1 parent 339f528bba
commit cac9e2d4cc
1 file changed
+6
+6
View File
@@ -2401,6 +2401,12 @@ static int CmdBWMUpgrade(const char *Cmd) {
free(fw);
if (res != PM3_SUCCESS) {
// Restore the fast link + logs that the OTA lowered at BEGIN.
PacketResponseNG resp;
uint8_t ab[1] = { BWM_OTA_ACTION_ABORT };
clearCommandBuffer();
SendCommandNG(CMD_PM5_BWM_ESP_OTA, ab, sizeof(ab));
(void)WaitForResponseTimeout(CMD_PM5_BWM_ESP_OTA, &resp, 8000);
PrintAndLogEx(FAILED, "BWM firmware update failed after %d attempts", max_attempts);
return res;
}