summaryrefslogtreecommitdiff
path: root/src/tangara/system_fsm
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-05-29 14:45:49 +1000
committerjacqueline <me@jacqueline.id.au>2024-05-29 14:45:49 +1000
commit2ff8eac022f397bb1aed28aca376fbe422fc8b3c (patch)
treeae80d0d89a212b1badf1d971fc67e701a9e4e962 /src/tangara/system_fsm
parentef812a53e5a84665e74be8c46cb983edaa712b3f (diff)
downloadtangara-fw-2ff8eac022f397bb1aed28aca376fbe422fc8b3c.tar.gz
Start on TTS support by logging the data that will become TTS lines
Includes some misc cleanup of haptic double-triggering (or non-triggering), since those cases all end up being TTS event double-reporting, which to me crosses the threshold from "annoying" to "usability issue"
Diffstat (limited to 'src/tangara/system_fsm')
-rw-r--r--src/tangara/system_fsm/booting.cpp2
-rw-r--r--src/tangara/system_fsm/service_locator.hpp13
2 files changed, 13 insertions, 2 deletions
diff --git a/src/tangara/system_fsm/booting.cpp b/src/tangara/system_fsm/booting.cpp
index 22a0fcac..feba0dc0 100644
--- a/src/tangara/system_fsm/booting.cpp
+++ b/src/tangara/system_fsm/booting.cpp
@@ -38,6 +38,7 @@
#include "system_fsm/service_locator.hpp"
#include "system_fsm/system_events.hpp"
#include "tasks.hpp"
+#include "tts/provider.hpp"
#include "ui/ui_fsm.hpp"
namespace system_fsm {
@@ -99,6 +100,7 @@ auto Booting::entry() -> void {
std::make_unique<audio::TrackQueue>(sServices->bg_worker()));
sServices->tag_parser(std::make_unique<database::TagParserImpl>());
sServices->collator(locale::CreateCollator());
+ sServices->tts(std::make_unique<tts::Provider>());
ESP_LOGI(kTag, "init bluetooth");
sServices->bluetooth(std::make_unique<drivers::Bluetooth>(
diff --git a/src/tangara/system_fsm/service_locator.hpp b/src/tangara/system_fsm/service_locator.hpp
index 5b2205eb..3d136f3a 100644
--- a/src/tangara/system_fsm/service_locator.hpp
+++ b/src/tangara/system_fsm/service_locator.hpp
@@ -10,17 +10,18 @@
#include "audio/track_queue.hpp"
#include "battery/battery.hpp"
-#include "drivers/bluetooth.hpp"
#include "collation.hpp"
#include "database/database.hpp"
#include "database/tag_parser.hpp"
+#include "drivers/bluetooth.hpp"
#include "drivers/gpios.hpp"
#include "drivers/haptics.hpp"
#include "drivers/nvs.hpp"
#include "drivers/samd.hpp"
#include "drivers/storage.hpp"
-#include "tasks.hpp"
#include "drivers/touchwheel.hpp"
+#include "tasks.hpp"
+#include "tts/provider.hpp"
namespace system_fsm {
@@ -69,6 +70,13 @@ class ServiceLocator {
auto battery(std::unique_ptr<battery::Battery> i) { battery_ = std::move(i); }
+ auto tts() -> tts::Provider& {
+ assert(tts_ != nullptr);
+ return *tts_;
+ }
+
+ auto tts(std::unique_ptr<tts::Provider> i) { tts_ = std::move(i); }
+
auto touchwheel() -> std::optional<drivers::TouchWheel*> {
if (!touchwheel_) {
return {};
@@ -140,6 +148,7 @@ class ServiceLocator {
std::unique_ptr<audio::TrackQueue> queue_;
std::unique_ptr<battery::Battery> battery_;
+ std::unique_ptr<tts::Provider> tts_;
std::shared_ptr<database::Database> database_;
std::unique_ptr<database::ITagParser> tag_parser_;