mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 18:24:13 +01:00
Fix panic abort when BLEClient reconnects (#3594)
This commit is contained in:
parent
522646c64d
commit
a12c6b5f35
1 changed files with 6 additions and 1 deletions
|
@ -100,7 +100,12 @@ void ESP32BLETracker::loop() {
|
||||||
found = true;
|
found = true;
|
||||||
if (client->state() == ClientState::DISCOVERED) {
|
if (client->state() == ClientState::DISCOVERED) {
|
||||||
esp_ble_gap_stop_scanning();
|
esp_ble_gap_stop_scanning();
|
||||||
if (xSemaphoreTake(this->scan_end_lock_, 10L / portTICK_PERIOD_MS)) {
|
#ifdef USE_ARDUINO
|
||||||
|
constexpr TickType_t block_time = 10L / portTICK_PERIOD_MS;
|
||||||
|
#else
|
||||||
|
constexpr TickType_t block_time = 0L; // PR #3594
|
||||||
|
#endif
|
||||||
|
if (xSemaphoreTake(this->scan_end_lock_, block_time)) {
|
||||||
xSemaphoreGive(this->scan_end_lock_);
|
xSemaphoreGive(this->scan_end_lock_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue