From 48495ddafe2ed59611c9491470f192b790e6146d Mon Sep 17 00:00:00 2001 From: ailurux Date: Fri, 7 Feb 2025 02:44:24 +0000 Subject: Add centre button haptic feedback on touch, and setting to disable/lessen haptics (#246) This adds a way for feedback devices to respond to events from outside of LVGL's event system, being passed from input device to feedback device through a vector. This was done so that touch events and long-press triggers can now give feedback through haptics. This PR also adds haptic modes, saved in nvs similarly to input and locked input modes, to disable or change the haptic effect behaviour based on which mode is selected. Finally, this also fixes a bug in which some click events would not trigger haptics, at the expense of re-introducing the (undesired?) behaviour of clicking a button that transitions to a new screen causing a double click. Relevant issues this should close: #195, #233, and (partially?) #120 Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/246 Co-authored-by: ailurux Co-committed-by: ailurux --- src/drivers/include/drivers/nvs.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/drivers/include') diff --git a/src/drivers/include/drivers/nvs.hpp b/src/drivers/include/drivers/nvs.hpp index 18bc5de6..e3a105f8 100644 --- a/src/drivers/include/drivers/nvs.hpp +++ b/src/drivers/include/drivers/nvs.hpp @@ -110,6 +110,15 @@ class NvsStorage { auto OutputMode() -> Output; auto OutputMode(Output) -> void; + enum class HapticsModes : uint8_t { + kDisabled = 0, + kMinimal = 1, + kStrong = 2, + }; + auto HapticsMode() -> HapticsModes; + auto HapticsMode(HapticsModes) -> void; + static auto intToHapticsMode(int raw) -> HapticsModes; + auto ScreenBrightness() -> uint_fast8_t; auto ScreenBrightness(uint_fast8_t) -> void; @@ -177,6 +186,7 @@ class NvsStorage { Setting input_mode_; Setting locked_input_mode_; Setting output_mode_; + Setting haptics_mode_; Setting theme_; -- cgit v1.2.3