From 771b7cf38fd913ad3a18b54f679b5e9c715d3f1b Mon Sep 17 00:00:00 2001 From: ogatatsu Date: Sat, 3 Oct 2020 23:17:49 +0900 Subject: [PATCH] fixed a bug that saved cccd data to a different offset after the second time. --- libraries/Bluefruit52Lib/src/utility/bonding.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/Bluefruit52Lib/src/utility/bonding.cpp b/libraries/Bluefruit52Lib/src/utility/bonding.cpp index c4bf8c22..5bef0bec 100644 --- a/libraries/Bluefruit52Lib/src/utility/bonding.cpp +++ b/libraries/Bluefruit52Lib/src/utility/bonding.cpp @@ -238,6 +238,11 @@ static void bond_save_cccd_dfr (uint8_t role, uint16_t conn_hdl, ble_gap_addr_t do_write = false; BOND_LOG("CCCD matches file %s contents, no need to write", filename); } + else + { + // restore the position to the state before reading old_data for writing + file.seek(file.size() - (len + 1)); + } } if (do_write)