From c370eb4a888658cf674935ec9080e650c872c6df Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 30 Aug 2020 12:21:05 -0700 Subject: [PATCH] allow restarting failed upgrades (fixes an android autobug report) --- src/esp32/BluetoothSoftwareUpdate.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/esp32/BluetoothSoftwareUpdate.cpp b/src/esp32/BluetoothSoftwareUpdate.cpp index ea1a50ef4..9bc7445a8 100644 --- a/src/esp32/BluetoothSoftwareUpdate.cpp +++ b/src/esp32/BluetoothSoftwareUpdate.cpp @@ -31,6 +31,8 @@ int update_size_callback(uint16_t conn_handle, uint16_t attr_handle, struct ble_ if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR && updateExpectedSize != 0) { updateActualSize = 0; crc.reset(); + if (Update.isRunning()) + Update.abort(); bool canBegin = Update.begin(updateExpectedSize); DEBUG_MSG("Setting update size %u, result %d\n", updateExpectedSize, canBegin); if (!canBegin) {