File tree Expand file tree Collapse file tree 2 files changed +5
-12
lines changed
libraries/Bluefruit52Lib/src Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -138,8 +138,8 @@ bool BLEScanner::stop(void)
138138{
139139 VERIFY_STATUS ( sd_ble_gap_scan_stop (), false );
140140
141- Bluefruit._stopConnLed (); // stop blinking
142141 _runnning = false ;
142+ Bluefruit._stopConnLed (); // stop blinking
143143
144144 return true ;
145145}
@@ -406,6 +406,7 @@ void BLEScanner::_eventHandler(ble_evt_t* evt)
406406 if (evt->evt .gap_evt .params .timeout .src == BLE_GAP_TIMEOUT_SRC_SCAN)
407407 {
408408 _runnning = false ;
409+ Bluefruit._stopConnLed ();
409410 if (_stop_cb) ada_callback (NULL , 0 , _stop_cb);
410411 }
411412 break ;
Original file line number Diff line number Diff line change @@ -826,16 +826,7 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
826826 LOG_LV2 (" GAP" , " Disconnect Reason 0x%02X" , evt->evt .gap_evt .params .disconnected .reason );
827827
828828 // Turn off Conn LED If not connected at all
829- bool still_connected = false ;
830- for (uint8_t i=0 ; i<BLE_MAX_CONNECTION; i++)
831- {
832- if ( _connection[i] && _connection[i]->connected () )
833- {
834- still_connected = true ;
835- break ;
836- }
837- }
838- if ( !still_connected ) _setConnLed (false );
829+ if ( !this ->connected () ) _setConnLed (false );
839830
840831 // Invoke disconnect callback
841832 if ( conn->getRole () == BLE_GAP_ROLE_PERIPH )
@@ -848,7 +839,6 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
848839
849840 delete _connection[conn_hdl];
850841 _connection[conn_hdl] = NULL ;
851-
852842 }
853843 break ;
854844
@@ -994,6 +984,8 @@ void AdafruitBluefruit::_startConnLed(void)
994984void AdafruitBluefruit::_stopConnLed (void )
995985{
996986 xTimerStop (_led_blink_th, 0 );
987+
988+ _setConnLed ( this ->connected () );
997989}
998990
999991void AdafruitBluefruit::_setConnLed (bool on_off)
You can’t perform that action at this time.
0 commit comments