diff options
| author | ailurux <ailuruxx@gmail.com> | 2024-05-29 08:14:07 +1000 |
|---|---|---|
| committer | ailurux <ailuruxx@gmail.com> | 2024-05-29 08:14:07 +1000 |
| commit | 9d67ddcf6e22ed3ea9d7da2dfcb368f87d3411f7 (patch) | |
| tree | ea99cb7aa6a78c2d07042ecb1eb11858755d2b6d /src | |
| parent | c846146c2fbd7237acd2581442f563818bf12252 (diff) | |
| download | tangara-fw-9d67ddcf6e22ed3ea9d7da2dfcb368f87d3411f7.tar.gz | |
Fix issue where failing to connect bt device initially won't retry
Diffstat (limited to 'src')
| -rw-r--r-- | src/drivers/bluetooth.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/drivers/bluetooth.cpp b/src/drivers/bluetooth.cpp index f812eb4a..13d6747e 100644 --- a/src/drivers/bluetooth.cpp +++ b/src/drivers/bluetooth.cpp @@ -408,7 +408,10 @@ auto BluetoothState::connect(const MacAndName& dev) -> bool { dev.mac[0], dev.mac[1], dev.mac[2], dev.mac[3], dev.mac[4], dev.mac[5]); if (esp_a2d_source_connect(sConnectingDevice_->mac.data()) != ESP_OK) { - return false; + ESP_LOGI(kTag, "Connecting failed..."); + if (sConnectAttemptsRemaining_>1) { + ESP_LOGI(kTag, "Will retry."); + } } transit<Connecting>(); @@ -537,7 +540,7 @@ static void timeoutCallback(TimerHandle_t) { } void Connecting::entry() { - sTimeoutTimer = xTimerCreate("bt_timeout", pdMS_TO_TICKS(15000), false, NULL, + sTimeoutTimer = xTimerCreate("bt_timeout", pdMS_TO_TICKS(15000), false, NULL, timeoutCallback); xTimerStart(sTimeoutTimer, portMAX_DELAY); @@ -565,7 +568,7 @@ void Connecting::react(const events::ConnectTimedOut& ev) { void Connecting::react(const events::Disable& ev) { // TODO: disconnect gracefully - transit<Disabled>(); + transit<Disabled>(); } void Connecting::react(const events::PreferredDeviceChanged& ev) { |
