From 71b46730394979ea528d152dbe884cc35c368759 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 17 Jan 2024 11:48:40 +1100 Subject: all screens basically working, but bluetooth is rough --- src/system_fsm/CMakeLists.txt | 6 ++++-- src/system_fsm/booting.cpp | 4 +--- src/system_fsm/include/system_events.hpp | 5 ++++- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src/system_fsm') diff --git a/src/system_fsm/CMakeLists.txt b/src/system_fsm/CMakeLists.txt index 8535a0e7..e98d4653 100644 --- a/src/system_fsm/CMakeLists.txt +++ b/src/system_fsm/CMakeLists.txt @@ -3,7 +3,9 @@ # SPDX-License-Identifier: GPL-3.0-only idf_component_register( - SRCS "system_fsm.cpp" "running.cpp" "booting.cpp" "idle.cpp" "service_locator.cpp" + SRCS "system_fsm.cpp" "running.cpp" "booting.cpp" "idle.cpp" + "service_locator.cpp" INCLUDE_DIRS "include" - REQUIRES "tinyfsm" "drivers" "database" "ui" "result" "events" "audio" "app_console" "battery" "locale") + REQUIRES "tinyfsm" "drivers" "database" "ui" "result" "events" "audio" + "app_console" "battery" "locale") target_compile_options(${COMPONENT_LIB} PRIVATE ${EXTRA_WARNINGS}) diff --git a/src/system_fsm/booting.cpp b/src/system_fsm/booting.cpp index 7bc92a17..898eb6aa 100644 --- a/src/system_fsm/booting.cpp +++ b/src/system_fsm/booting.cpp @@ -46,9 +46,7 @@ namespace states { [[maybe_unused]] static const char kTag[] = "BOOT"; static auto bt_event_cb(drivers::bluetooth::Event ev) -> void { - if (ev == drivers::bluetooth::Event::kKnownDevicesChanged) { - events::Ui().Dispatch(BluetoothDevicesChanged{}); - } + events::Ui().Dispatch(BluetoothEvent{.event = ev}); } static const TickType_t kInterruptCheckPeriod = pdMS_TO_TICKS(100); diff --git a/src/system_fsm/include/system_events.hpp b/src/system_fsm/include/system_events.hpp index 4ead9f2f..54e0aa9c 100644 --- a/src/system_fsm/include/system_events.hpp +++ b/src/system_fsm/include/system_events.hpp @@ -9,6 +9,7 @@ #include #include "battery.hpp" +#include "bluetooth_types.hpp" #include "database.hpp" #include "haptics.hpp" #include "service_locator.hpp" @@ -54,7 +55,9 @@ struct BatteryStateChanged : tinyfsm::Event { battery::Battery::BatteryState new_state; }; -struct BluetoothDevicesChanged : tinyfsm::Event {}; +struct BluetoothEvent : tinyfsm::Event { + drivers::bluetooth::Event event; +}; struct HapticTrigger : tinyfsm::Event { drivers::Haptics::Effect effect; -- cgit v1.2.3