From 8acbcd7b8106bab30d51452044644d43fab08bd7 Mon Sep 17 00:00:00 2001 From: ReFil <31960031+ReFil@users.noreply.github.com> Date: Wed, 15 Nov 2023 10:00:08 +0000 Subject: [PATCH] fix(ble): Fix race condition causing lockup --- app/src/split/bluetooth/central.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/split/bluetooth/central.c b/app/src/split/bluetooth/central.c index b2c19a5ee1d..a8689aff232 100644 --- a/app/src/split/bluetooth/central.c +++ b/app/src/split/bluetooth/central.c @@ -722,6 +722,11 @@ void split_central_split_led_callback(struct k_work *work) { continue; } + if (!peripherals[0].update_led_handle) { + LOG_ERR("handle not discovered"); + continue; + } + int err = bt_gatt_write_without_response(peripherals[0].conn, peripherals[0].update_led_handle, &payload, sizeof(struct zmk_split_update_led_data), true); @@ -783,6 +788,11 @@ void split_central_split_bl_callback(struct k_work *work) { continue; } + if (!peripherals[0].update_bl_handle) { + LOG_ERR("handle not discovered"); + continue; + } + int err = bt_gatt_write_without_response(peripherals[0].conn, peripherals[0].update_bl_handle, &payload, sizeof(struct zmk_split_update_bl_data), true);