mirror of
https://github.com/esphome/esphome.git
synced 2026-08-22 22:26:21 +00:00
Settle cached connections to medium parameters on link-up
This commit is contained in:
@@ -524,6 +524,14 @@ void RP2GattClient::handle_event_(const RP2GattEvent &event) {
|
||||
this->state_ = EngineState::READY;
|
||||
// Scanning resumes and runs alongside the established connection.
|
||||
this->release_scan_inhibit_();
|
||||
if (this->connection_type_ == ble_device_base::ConnectionType::V3_WITH_CACHE) {
|
||||
// Cached connections never run discovery, so nothing consumes the
|
||||
// FAST interval; settle to MEDIUM now (esp32 parity). Sustained
|
||||
// FAST intervals starve WiFi on the shared CYW43 radio.
|
||||
BluetoothLock lock;
|
||||
gap_update_connection_parameters(this->con_handle_, MEDIUM_MIN_CONN_INTERVAL, MEDIUM_MAX_CONN_INTERVAL, 0,
|
||||
MEDIUM_CONN_TIMEOUT);
|
||||
}
|
||||
this->listener_->on_connection_state(true, this->mtu_, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -95,8 +95,9 @@ class RP2GattClient final : public Component, public Parented<rp2040_ble::RP2040
|
||||
int pair();
|
||||
int update_connection_params(uint16_t min_interval, uint16_t max_interval, uint16_t latency, uint16_t timeout);
|
||||
ble_device_base::GattServiceTable get_service_table();
|
||||
// No connection-type branching on this backend.
|
||||
void set_connection_type(ble_device_base::ConnectionType ct) {}
|
||||
// Cached connections settle straight to MEDIUM parameters on link-up
|
||||
// (esp32 parity); FAST is reserved for connect and discovery.
|
||||
void set_connection_type(ble_device_base::ConnectionType ct) { this->connection_type_ = ct; }
|
||||
void release_services();
|
||||
|
||||
protected:
|
||||
@@ -199,6 +200,7 @@ class RP2GattClient final : public Component, public Parented<rp2040_ble::RP2040
|
||||
uint8_t notify_subscription_count_{0};
|
||||
uint8_t engine_index_{0}; // position in instances[]; tags log lines per slot
|
||||
bd_addr_t peer_addr_{}; // MSB-first, as gap_connect expects
|
||||
ble_device_base::ConnectionType connection_type_{ble_device_base::ConnectionType::V3_WITHOUT_CACHE};
|
||||
EngineState state_{EngineState::IDLE};
|
||||
DiscoveryPhase discovery_phase_{DiscoveryPhase::NONE};
|
||||
OpType op_type_{OpType::NONE};
|
||||
|
||||
Reference in New Issue
Block a user