From 15d0cb1f32194914dd8d1a473e1bb3b19ea56da1 Mon Sep 17 00:00:00 2001 From: StrugglingBunny Date: Fri, 27 Dec 2024 18:08:03 +0800 Subject: [PATCH] Nimble ota(Request the sector again if crc mismtach) --- .../bluetooth/ble_profiles/esp/ble_ota/src/nimble_ota.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/bluetooth/ble_profiles/esp/ble_ota/src/nimble_ota.c b/components/bluetooth/ble_profiles/esp/ble_ota/src/nimble_ota.c index ce4b39865..e4b482234 100644 --- a/components/bluetooth/ble_profiles/esp/ble_ota/src/nimble_ota.c +++ b/components/bluetooth/ble_profiles/esp/ble_ota/src/nimble_ota.c @@ -248,10 +248,15 @@ esp_ble_ota_write_chr(struct os_mbuf *om) cmd_ack[0] = om->om_data[0]; cmd_ack[1] = om->om_data[1]; - if (match) + if (match){ cmd_ack[2] = 0x00; // success - else + }else + { cmd_ack[2] = 0x01; // crc error + // Request the sector again + cmd_ack[4] = cur_sector & 0xff; + cmd_ack[5] = (cur_sector & 0xff00) >> 8; + } cmd_ack[3] = 0x00; crc16 = crc16_ccitt(cmd_ack, 18); cmd_ack[18] = crc16 & 0xff;