summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Howard <robin@rhoward.id.au>2023-11-07 15:46:46 +1100
committerRobin Howard <robin@rhoward.id.au>2023-11-07 16:31:55 +1100
commit7318f53fd8949d8625f498ccb2dd07e501e658b2 (patch)
treea3a601ee71f59801ff9f7aacf52d5243da2e05b6 /src
parent135185f12ba07dea8568b06c0a65a00a8af7deb7 (diff)
downloadtangara-fw-7318f53fd8949d8625f498ccb2dd07e501e658b2.tar.gz
haptics: buzz on boot, and when changing focus of items.
Diffstat (limited to 'src')
-rw-r--r--src/ui/lvgl_task.cpp10
-rw-r--r--src/ui/ui_fsm.cpp6
2 files changed, 16 insertions, 0 deletions
diff --git a/src/ui/lvgl_task.cpp b/src/ui/lvgl_task.cpp
index 2c4f01ca..817ed185 100644
--- a/src/ui/lvgl_task.cpp
+++ b/src/ui/lvgl_task.cpp
@@ -49,6 +49,8 @@ namespace ui {
[[maybe_unused]] static const char* kTag = "ui_task";
+static auto group_focus_cb(lv_group_t *group) -> void;
+
UiTask::UiTask() {}
UiTask::~UiTask() {
@@ -75,6 +77,7 @@ auto UiTask::Main() -> void {
if (input_ && current_screen_->group() != current_group) {
current_group = current_screen_->group();
lv_indev_set_group(input_->registration(), current_group);
+ lv_group_set_focus_cb(current_group, &group_focus_cb);
}
if (current_screen_) {
@@ -98,4 +101,11 @@ auto UiTask::Start() -> UiTask* {
return ret;
}
+static auto group_focus_cb(lv_group_t *group) -> void {
+ // TODO(robin): we probably want to vary this, configure this, etc
+ events::System().Dispatch(system_fsm::HapticTrigger{
+ .effect = drivers::Haptics::Effect::kMediumClick1_100Pct,
+ });
+}
+
} // namespace ui
diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp
index becb7af5..ee915779 100644
--- a/src/ui/ui_fsm.cpp
+++ b/src/ui/ui_fsm.cpp
@@ -12,6 +12,7 @@
#include "battery.hpp"
#include "core/lv_obj.h"
#include "database.hpp"
+#include "haptics.hpp"
#include "misc/lv_gc.h"
#include "audio_events.hpp"
@@ -135,6 +136,11 @@ void Splash::exit() {
sDisplay->SetDisplayOn(
sServices->gpios().Get(drivers::IGpios::Pin::kKeyLock));
}
+
+ // buzz a bit to tell the user we're done booting
+ events::System().Dispatch(system_fsm::HapticTrigger{
+ .effect = drivers::Haptics::Effect::kLongDoubleSharpTick1_100Pct,
+ });
}
void Splash::react(const system_fsm::BootComplete& ev) {