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:
@@ -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) {
|
||||||
|
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user