From d6b83fcf4a1a3039c06e0b1d1a1f7e2af2351efb Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 15 Aug 2023 13:53:30 +1000 Subject: Flesh out basic bluetooth support No ui yet, and performance isn't great. It kinda works though!! --- src/system_fsm/booting.cpp | 7 ++++++- src/system_fsm/include/system_fsm.hpp | 2 ++ src/system_fsm/system_fsm.cpp | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/system_fsm') diff --git a/src/system_fsm/booting.cpp b/src/system_fsm/booting.cpp index 3d6c6a46..7bd5f890 100644 --- a/src/system_fsm/booting.cpp +++ b/src/system_fsm/booting.cpp @@ -6,6 +6,7 @@ #include "assert.h" #include "audio_fsm.hpp" +#include "bluetooth.hpp" #include "core/lv_obj.h" #include "display_init.hpp" #include "esp_err.h" @@ -60,12 +61,15 @@ auto Booting::entry() -> void { return; } + ESP_LOGI(kTag, "starting bluetooth"); + sBluetooth.reset(new drivers::Bluetooth()); + // At this point we've done all of the essential boot tasks. Start remaining // state machines and inform them that the system is ready. ESP_LOGI(kTag, "starting audio"); if (!audio::AudioState::Init(sGpios.get(), sDatabase, sTagParser, - sTrackQueue.get())) { + sBluetooth.get(), sTrackQueue.get())) { events::System().Dispatch(FatalError{}); events::Ui().Dispatch(FatalError{}); return; @@ -80,6 +84,7 @@ auto Booting::exit() -> void { // TODO(jacqueline): Gate this on something. Debug flag? Flashing mode? sAppConsole = new console::AppConsole(); sAppConsole->sTrackQueue = sTrackQueue.get(); + sAppConsole->sBluetooth = sBluetooth.get(); sAppConsole->Launch(); } diff --git a/src/system_fsm/include/system_fsm.hpp b/src/system_fsm/include/system_fsm.hpp index d30a712c..3d513666 100644 --- a/src/system_fsm/include/system_fsm.hpp +++ b/src/system_fsm/include/system_fsm.hpp @@ -10,6 +10,7 @@ #include "app_console.hpp" #include "battery.hpp" +#include "bluetooth.hpp" #include "database.hpp" #include "display.hpp" #include "gpios.hpp" @@ -62,6 +63,7 @@ class SystemState : public tinyfsm::Fsm { static std::shared_ptr sBattery; static std::shared_ptr sStorage; static std::shared_ptr sDisplay; + static std::shared_ptr sBluetooth; static std::shared_ptr sDatabase; static std::shared_ptr sTagParser; diff --git a/src/system_fsm/system_fsm.cpp b/src/system_fsm/system_fsm.cpp index 527a8770..96e806f4 100644 --- a/src/system_fsm/system_fsm.cpp +++ b/src/system_fsm/system_fsm.cpp @@ -24,6 +24,7 @@ std::shared_ptr SystemState::sRelativeTouch; std::shared_ptr SystemState::sBattery; std::shared_ptr SystemState::sStorage; std::shared_ptr SystemState::sDisplay; +std::shared_ptr SystemState::sBluetooth; std::shared_ptr SystemState::sDatabase; std::shared_ptr SystemState::sTagParser; -- cgit v1.2.3