From 8b1170e2248690a6dcafda4d4abeef669920ca34 Mon Sep 17 00:00:00 2001 From: Luo Xu Date: Mon, 9 Feb 2026 17:43:22 +0800 Subject: [PATCH] feat(ble_mesh): ignored the previous server status to avoid drop target by mistake (cherry picked from commit bc2d56b72a1d9a4c5d75739b167e5ea40db3844c) Co-authored-by: luoxu --- components/bt/esp_ble_mesh/v1.1/dfu/dfu_cli.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/bt/esp_ble_mesh/v1.1/dfu/dfu_cli.c b/components/bt/esp_ble_mesh/v1.1/dfu/dfu_cli.c index 78c7219f04c..b4d1b90c9d6 100644 --- a/components/bt/esp_ble_mesh/v1.1/dfu/dfu_cli.c +++ b/components/bt/esp_ble_mesh/v1.1/dfu/dfu_cli.c @@ -1060,6 +1060,17 @@ static int handle_status(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx if (phase != BLE_MESH_DFU_PHASE_APPLYING && (target->effect == BLE_MESH_DFU_EFFECT_UNPROV || phase != BLE_MESH_DFU_PHASE_IDLE)) { + /** + * If user quickly enter the APPLY state from REFRESH, + * protocol may receive the last round of REFRESH info + * packets from the network. Therefore, in order to avoid + * misjudgment, the previous round of data packets are + * ignored here. + */ + if (phase == BLE_MESH_DFU_PHASE_VERIFY_OK) { + BT_DBG("MaybeReceivedOutdatedMsg"); + return 0; + } BT_WARN("Target 0x%04x in phase %u after apply", target->blob.addr, phase); target_failed(cli, target, BLE_MESH_DFU_ERR_WRONG_PHASE);