From dd3346d381d0db6e179a1127a746deb9b096d5bc Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 28 Mar 2024 12:51:24 +1100 Subject: HACK: auto-accept CFM pairing, and increase the connection timeout This gets Tangara connecting to most non-trivial devices, including car headunits and my laptop. We can add a real UI / better timeout handling for this later (likely via a new BluetoothState?) --- src/drivers/bluetooth.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/bluetooth.cpp b/src/drivers/bluetooth.cpp index 84c81de0..d15ffd7f 100644 --- a/src/drivers/bluetooth.cpp +++ b/src/drivers/bluetooth.cpp @@ -515,7 +515,7 @@ static void timeoutCallback(TimerHandle_t) { } void Connecting::entry() { - sTimeoutTimer = xTimerCreate("bt_timeout", pdMS_TO_TICKS(5000), false, NULL, + sTimeoutTimer = xTimerCreate("bt_timeout", pdMS_TO_TICKS(15000), false, NULL, timeoutCallback); xTimerStart(sTimeoutTimer, portMAX_DELAY); @@ -568,8 +568,9 @@ void Connecting::react(const events::internal::Gap& ev) { transit(); break; case ESP_BT_GAP_CFM_REQ_EVT: - ESP_LOGW(kTag, "user needs to do cfm. idk man."); - transit(); + // FIXME: Expose a UI for this instead of auto-accepting. + ESP_LOGW(kTag, "CFM request, PIN is: %lu", ev.param->cfm_req.num_val); + esp_bt_gap_ssp_confirm_reply(ev.param->cfm_req.bda, true); break; case ESP_BT_GAP_KEY_NOTIF_EVT: ESP_LOGW(kTag, "the device is telling us a password??"); -- cgit v1.2.3 From 239e6d89507a24c849385f4bfa93ac4ad58e5de5 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 28 Mar 2024 13:30:24 +1100 Subject: bump esp-idf to 5.2.1 --- src/drivers/include/haptics.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/drivers') diff --git a/src/drivers/include/haptics.hpp b/src/drivers/include/haptics.hpp index dfafa2eb..6cfcbb0d 100644 --- a/src/drivers/include/haptics.hpp +++ b/src/drivers/include/haptics.hpp @@ -6,10 +6,11 @@ #pragma once -#include +#include #include #include #include +#include namespace drivers { -- cgit v1.2.3