From 7d6dbcfa3f34ac9affd2f28c514512a047822006 Mon Sep 17 00:00:00 2001 From: BeardyWalrus Date: Tue, 29 Sep 2020 19:51:39 -0400 Subject: [PATCH] Update BluetoothUtil.cpp fix for #357 use presence of ssd1306 display to set display functionality for bluetooth security. --- src/nimble/BluetoothUtil.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/nimble/BluetoothUtil.cpp b/src/nimble/BluetoothUtil.cpp index f294802c..6f4f92cb 100644 --- a/src/nimble/BluetoothUtil.cpp +++ b/src/nimble/BluetoothUtil.cpp @@ -472,7 +472,14 @@ void reinitBluetooth() ble_hs_cfg.gatts_register_cb = gatt_svr_register_cb; ble_hs_cfg.store_status_cb = ble_store_util_status_rr; - ble_hs_cfg.sm_io_cap = BLE_SM_IO_CAP_DISP_ONLY; + if (ssd1306_found == true) { + DEBUG_MSG("Screen Found! : using display for passcode\n"); + ble_hs_cfg.sm_io_cap = BLE_SM_IO_CAP_DISP_ONLY; + } + else { + DEBUG_MSG("No Screen Found! : disabling passcode for pairing\n"); + ble_hs_cfg.sm_io_cap = BLE_SM_IO_CAP_NO_IO; + } ble_hs_cfg.sm_bonding = 1; ble_hs_cfg.sm_mitm = 1; ble_hs_cfg.sm_sc = 1;