1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 15:18:16 +00:00

Debug disconnecting before connected

This commit is contained in:
J. Nick Koston 2025-02-21 18:33:26 -06:00
parent 1f04f4632c
commit 370112013c
No known key found for this signature in database

View File

@ -201,8 +201,9 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
break; break;
} }
if (this->state == espbt::ClientState::DISCONNECTING) { if (this->state == espbt::ClientState::DISCONNECTING) {
// Disconnect we requested before after connecting started, // Disconnect was requested before after connecting started,
// but before the connection was established. // but before the connection was established. Now that we have
// this->conn_id_ set, we can disconnect it.
this->_unconditional_disconnect(); this->_unconditional_disconnect();
this->conn_id_ = UNSET_CONN_ID; this->conn_id_ = UNSET_CONN_ID;
break; break;
@ -227,8 +228,9 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
return false; return false;
this->log_event_("ESP_GATTC_CONNECT_EVT"); this->log_event_("ESP_GATTC_CONNECT_EVT");
if (this->state == espbt::ClientState::DISCONNECTING) { if (this->state == espbt::ClientState::DISCONNECTING) {
// Disconnect we requested before after connecting started, // Disconnect was requested before after connecting started,
// but before the connection was established. // but before the connection was established. Now that we have
// this->conn_id_ set, we can disconnect it.
this->_unconditional_disconnect(); this->_unconditional_disconnect();
this->conn_id_ = UNSET_CONN_ID; this->conn_id_ = UNSET_CONN_ID;
} }