This commit is contained in:
hathach committed 2020-03-17 23:42:26 +07:00
1 parent 44a98b6e9a
commit a5fea5644b
1 file changed
+5 -7
+5 -7
View File
@@ -126,6 +126,7 @@ void BLEPeriph::setDisconnectCallback( ble_disconnect_callback_t fp )
void BLEPeriph::_eventHandler(ble_evt_t* evt)
{
uint16_t const conn_hdl = evt->evt.common_evt.conn_handle;
BLEConnection* conn = Bluefruit.Connection(conn_hdl);
switch ( evt->header.evt_id )
{
@@ -133,14 +134,11 @@ void BLEPeriph::_eventHandler(ble_evt_t* evt)
{
ble_gap_evt_connected_t* para = &evt->evt.gap_evt.params.connected;
if (para->role == BLE_GAP_ROLE_PERIPH)
// Connection interval set by Central is out of preferred range
// Try to negotiate with Central using our preferred values
if ( !is_within(_ppcp.min_conn_interval, para->conn_params.min_conn_interval, _ppcp.max_conn_interval) )
{
// Connection interval set by Central is out of preferred range
// Try to negotiate with Central using our preferred values
if ( !is_within(_ppcp.min_conn_interval, para->conn_params.min_conn_interval, _ppcp.max_conn_interval) )
{
VERIFY_STATUS( sd_ble_gap_conn_param_update(conn_hdl, &_ppcp), );
}
VERIFY_STATUS( sd_ble_gap_conn_param_update(conn_hdl, &_ppcp), );
}
}
break;