File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,15 +48,25 @@ CONFIG_BT_SMP_SC_PAIR_ONLY=n
4848CONFIG_BT_NUS_CLIENT=y
4949CONFIG_BT_SCAN=y
5050CONFIG_BT_SCAN_FILTER_ENABLE=y
51- CONFIG_BT_SCAN_UUID_CNT=2
51+ CONFIG_BT_SCAN_UUID_CNT=1
5252CONFIG_BT_PRIVACY=y
53- CONFIG_BT_SCAN_ADDRESS_CNT=1
53+ CONFIG_BT_SCAN_ADDRESS_CNT=8
5454CONFIG_BT_GATT_DM=y
5555CONFIG_BT_HOGP=y
56- CONFIG_HEAP_MEM_POOL_SIZE=2048
56+
57+ # BLE connection and pairing limits
58+ CONFIG_BT_MAX_CONN=8
59+ CONFIG_BT_MAX_PAIRED=32
60+ CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
61+ CONFIG_BT_GATT_DM_MAX_ATTRS=100
62+ CONFIG_BT_L2CAP_TX_BUF_COUNT=5
63+ CONFIG_BT_HOGP_REPORTS_MAX=32
64+ CONFIG_BT_DEVICE_NAME="MouthPad^USB"
65+
66+ CONFIG_HEAP_MEM_POOL_SIZE=16384
5767
5868CONFIG_MAIN_STACK_SIZE=2048
59- CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
69+ CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=16384
6070
6171# Enable bonding
6272CONFIG_BT_SETTINGS=y
Original file line number Diff line number Diff line change @@ -348,12 +348,25 @@ int ble_central_start_scan(void)
348348
349349 bt_scan_filter_remove_all ();
350350
351- /* Scan without UUID filters - we'll check for both services in the callback */
352- /* This allows us to detect devices that have both NUS and HID services */
351+ /* Add UUID filter for HID service (like working sample) */
352+ err = bt_scan_filter_add (BT_SCAN_FILTER_TYPE_UUID , BT_UUID_HIDS );
353+ if (err ) {
354+ LOG_ERR ("Cannot add HID UUID scan filter (err %d)" , err );
355+ return err ;
356+ }
353357
354358 bt_foreach_bond (BT_ID_DEFAULT , try_add_address_filter , & filter_mode );
355359
356- err = bt_scan_filter_enable (filter_mode , false);
360+ /* Always enable UUID filter, optionally add address filters */
361+ uint8_t enable_filters = BT_SCAN_UUID_FILTER ;
362+ if (filter_mode != 0 ) {
363+ enable_filters |= filter_mode ;
364+ LOG_INF ("Enabling HID UUID filter + address filters for bonded devices" );
365+ } else {
366+ LOG_INF ("Enabling HID UUID filter (no bonded devices)" );
367+ }
368+
369+ err = bt_scan_filter_enable (enable_filters , false);
357370 if (err ) {
358371 LOG_ERR ("Filters cannot be turned on (err %d)" , err );
359372 return err ;
You can’t perform that action at this time.
0 commit comments