1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-14 17:22:20 +01:00

Merge branch 'loop_done' into integration

This commit is contained in:
J. Nick Koston
2025-06-15 01:34:12 -05:00
2 changed files with 10 additions and 7 deletions

View File

@@ -23,12 +23,6 @@ void BLEClientBase::setup() {
} }
void BLEClientBase::loop() { void BLEClientBase::loop() {
// If address is 0, this connection is not in use
if (this->address_ == 0) {
this->disable_loop();
return;
}
if (!esp32_ble::global_ble->is_active()) { if (!esp32_ble::global_ble->is_active()) {
this->set_state(espbt::ClientState::INIT); this->set_state(espbt::ClientState::INIT);
return; return;
@@ -41,6 +35,13 @@ void BLEClientBase::loop() {
} }
this->set_state(espbt::ClientState::IDLE); this->set_state(espbt::ClientState::IDLE);
} }
// If address is 0, this connection is not in use
if (this->address_ == 0) {
this->disable_loop();
return;
}
// READY_TO_CONNECT means we have discovered the device // READY_TO_CONNECT means we have discovered the device
// and the scanner has been stopped by the tracker. // and the scanner has been stopped by the tracker.
if (this->state_ == espbt::ClientState::READY_TO_CONNECT) { if (this->state_ == espbt::ClientState::READY_TO_CONNECT) {

View File

@@ -62,7 +62,9 @@ class BLEClientBase : public espbt::ESPBTClient, public Component {
(uint8_t) (this->address_ >> 32) & 0xff, (uint8_t) (this->address_ >> 24) & 0xff, (uint8_t) (this->address_ >> 32) & 0xff, (uint8_t) (this->address_ >> 24) & 0xff,
(uint8_t) (this->address_ >> 16) & 0xff, (uint8_t) (this->address_ >> 8) & 0xff, (uint8_t) (this->address_ >> 16) & 0xff, (uint8_t) (this->address_ >> 8) & 0xff,
(uint8_t) (this->address_ >> 0) & 0xff); (uint8_t) (this->address_ >> 0) & 0xff);
// Re-enable loop() when a new address is assigned }
// Re-enable loop() when a non-zero address is assigned
if (address != 0) {
this->enable_loop(); this->enable_loop();
} }
} }