fix #277 conn led doesnt stop when scanner is time out
This commit is contained in:
1 parent
be18b1809a
commit
264893df7e
2 files changed
+5
-12
No files matched your search
@@ -138,8 +138,8 @@ bool BLEScanner::stop(void)
|
||||
{
|
||||
VERIFY_STATUS( sd_ble_gap_scan_stop(), false );
|
||||
|
||||
Bluefruit._stopConnLed(); // stop blinking
|
||||
_runnning = false;
|
||||
Bluefruit._stopConnLed(); // stop blinking
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -406,6 +406,7 @@ void BLEScanner::_eventHandler(ble_evt_t* evt)
|
||||
if (evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_SCAN)
|
||||
{
|
||||
_runnning = false;
|
||||
Bluefruit._stopConnLed();
|
||||
if (_stop_cb) ada_callback(NULL, 0, _stop_cb);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -826,16 +826,7 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
LOG_LV2("GAP", "Disconnect Reason 0x%02X", evt->evt.gap_evt.params.disconnected.reason);
|
||||
|
||||
// Turn off Conn LED If not connected at all
|
||||
bool still_connected = false;
|
||||
for (uint8_t i=0; i<BLE_MAX_CONNECTION; i++)
|
||||
{
|
||||
if ( _connection[i] && _connection[i]->connected() )
|
||||
{
|
||||
still_connected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !still_connected ) _setConnLed(false);
|
||||
if ( !this->connected() ) _setConnLed(false);
|
||||
|
||||
// Invoke disconnect callback
|
||||
if ( conn->getRole() == BLE_GAP_ROLE_PERIPH )
|
||||
@@ -848,7 +839,6 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
|
||||
delete _connection[conn_hdl];
|
||||
_connection[conn_hdl] = NULL;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -994,6 +984,8 @@ void AdafruitBluefruit::_startConnLed(void)
|
||||
void AdafruitBluefruit::_stopConnLed(void)
|
||||
{
|
||||
xTimerStop(_led_blink_th, 0);
|
||||
|
||||
_setConnLed( this->connected() );
|
||||
}
|
||||
|
||||
void AdafruitBluefruit::_setConnLed (bool on_off)
|
||||
|
||||
Reference in new issue
Block a user