From 65afd080510f9c71e81e42aa381b28203e7c2fbb Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Sat, 23 Dec 2023 02:07:04 -0500 Subject: [PATCH] Always run disconnect inactive profiles after switching --- app/src/ble.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/src/ble.c b/app/src/ble.c index 9d9ff637..1e2ed6b2 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -273,15 +273,13 @@ int zmk_ble_prof_select(uint8_t index) { return 0; } -#if IS_ENABLED(CONFIG_ZMK_BLE_FAST_SWITCHING) active_profile = index; -#else - bool was_active_profile_open = zmk_ble_active_profile_is_open(); - active_profile = index; - if (was_active_profile_open) { - // We may have connected to multiple hosts while the active profile was open. - zmk_ble_disconnect_inactive_profiles(); - } + +#if !IS_ENABLED(CONFIG_ZMK_BLE_FAST_SWITCHING) + // If the previous profile wasn't paired, then we may be connected to + // multiple hosts during the open advertisement. And if it was, we still + // want to disconnect the previous profile. + zmk_ble_disconnect_inactive_profiles(); #endif ble_save_profile();