mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 18:18:43 +00:00
[esp32_ble_client] Improve log message when connect blocked by DISCONNECTING
Separate the DISCONNECTING state into its own log message that mentions waiting for CLOSE_EVT, making it easier to diagnose stuck connections vs normal in-progress connections. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
1dba01e05b
commit
60944a6d8b
@@ -103,10 +103,14 @@ bool BLEClientBase::parse_device(const espbt::ESPBTDevice &device) {
|
||||
void BLEClientBase::connect() {
|
||||
// Prevent duplicate connection attempts or connecting while still disconnecting
|
||||
if (this->state() == espbt::ClientState::CONNECTING || this->state() == espbt::ClientState::CONNECTED ||
|
||||
this->state() == espbt::ClientState::ESTABLISHED || this->state() == espbt::ClientState::DISCONNECTING) {
|
||||
this->state() == espbt::ClientState::ESTABLISHED) {
|
||||
ESP_LOGW(TAG, "[%d] [%s] Connection already in progress, state=%s", this->connection_index_, this->address_str_,
|
||||
espbt::client_state_to_string(this->state()));
|
||||
return;
|
||||
} else if (this->state() == espbt::ClientState::DISCONNECTING) {
|
||||
ESP_LOGW(TAG, "[%d] [%s] Cannot connect, still waiting for CLOSE_EVT to complete disconnect",
|
||||
this->connection_index_, this->address_str_);
|
||||
return;
|
||||
}
|
||||
ESP_LOGI(TAG, "[%d] [%s] 0x%02x Connecting", this->connection_index_, this->address_str_, this->remote_addr_type_);
|
||||
this->paired_ = false;
|
||||
|
||||
Reference in New Issue
Block a user