Skip to content

Commit 15d0cb1

Browse files
Nimble ota(Request the sector again if crc mismtach)
1 parent cec2b3b commit 15d0cb1

File tree

1 file changed

+7
-2
lines changed
  • components/bluetooth/ble_profiles/esp/ble_ota/src

1 file changed

+7
-2
lines changed

components/bluetooth/ble_profiles/esp/ble_ota/src/nimble_ota.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,15 @@ esp_ble_ota_write_chr(struct os_mbuf *om)
248248

249249
cmd_ack[0] = om->om_data[0];
250250
cmd_ack[1] = om->om_data[1];
251-
if (match)
251+
if (match){
252252
cmd_ack[2] = 0x00; // success
253-
else
253+
}else
254+
{
254255
cmd_ack[2] = 0x01; // crc error
256+
// Request the sector again
257+
cmd_ack[4] = cur_sector & 0xff;
258+
cmd_ack[5] = (cur_sector & 0xff00) >> 8;
259+
}
255260
cmd_ack[3] = 0x00;
256261
crc16 = crc16_ccitt(cmd_ack, 18);
257262
cmd_ack[18] = crc16 & 0xff;

0 commit comments

Comments
 (0)