From: jacob.eva Date: Fri, 12 Jul 2024 12:30:32 +0000 (+0100) Subject: Fix Bluetooth functionality on NRF52 X-Git-Url: https://git.tnoah.ca/?a=commitdiff_plain;h=8b705b2f4e40994ccc483ab786c898b3a31cf30d;p=lora-radio.git Fix Bluetooth functionality on NRF52 --- diff --git a/Bluetooth.h b/Bluetooth.h index d1d339a..fb0abe4 100644 --- a/Bluetooth.h +++ b/Bluetooth.h @@ -281,6 +281,11 @@ bool bt_passkey_callback(uint16_t conn_handle, uint8_t const passkey[6], bool ma return false; } +void bt_connect_callback(uint16_t conn_handle) { + bt_state = BT_STATE_CONNECTED; + cable_state = CABLE_STATE_DISCONNECTED; +} + void bt_disconnect_callback(uint16_t conn_handle, uint8_t reason) { bt_state = BT_STATE_ON; } @@ -302,6 +307,7 @@ bool bt_setup_hw() { Bluefruit.setTxPower(8); // Check bluefruit.h for supported values Bluefruit.Security.setIOCaps(true, true, false); Bluefruit.Security.setPairPasskeyCallback(bt_passkey_callback); + Bluefruit.Periph.setConnectCallback(bt_connect_callback); Bluefruit.Periph.setDisconnectCallback(bt_disconnect_callback); Bluefruit.Security.setPairCompleteCallback(bt_pairing_complete); const ble_gap_addr_t gap_addr = Bluefruit.getAddr();