From c9ce88a457c9ed7124709a667d202a666f72bffa Mon Sep 17 00:00:00 2001 From: ailurux Date: Wed, 19 Mar 2025 04:25:20 +0000 Subject: ailurux/button-media-controls (#264) Splits the control scheme into separate schemes for the side buttons and touchwheel, allowing them to be configured independently of each other. At least one input must be used for navigation, and there are guards to prevent locking oneself out of any input. If the input scheme is invalid, a pop up will show alerting the user. Different behaviours can be bound to the side buttons for when the device is locked or unlocked. This PR also adds a mode for these buttons that controls media playback (prev/next on up/down, pressing both buttons toggles play/pause). There are some changes to the way inputs handle locking. Rather than the input devices tracking the current locked mode, different input devices are created on lock depending on the mode that is configured. Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/264 Co-authored-by: ailurux Co-committed-by: ailurux --- src/drivers/include/drivers/nvs.hpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/drivers/include') diff --git a/src/drivers/include/drivers/nvs.hpp b/src/drivers/include/drivers/nvs.hpp index 7ef1fbf7..b490ac3d 100644 --- a/src/drivers/include/drivers/nvs.hpp +++ b/src/drivers/include/drivers/nvs.hpp @@ -143,23 +143,27 @@ class NvsStorage { auto AmpLeftBias() -> int_fast8_t; auto AmpLeftBias(int_fast8_t) -> void; - enum class InputModes : uint8_t { - kButtonsOnly = 0, - kButtonsWithWheel = 1, - kDirectionalWheel = 2, - kRotatingWheel = 3, + enum class WheelInputModes : uint8_t { + kDisabled = 0, + kDirectionalWheel = 1, + kRotatingWheel = 2, }; - auto PrimaryInput() -> InputModes; - auto PrimaryInput(InputModes) -> void; + auto WheelInput() -> WheelInputModes; + auto WheelInput(WheelInputModes) -> void; - enum class LockedInputModes : uint8_t { + enum class ButtonInputModes : uint8_t { kDisabled = 0, kVolumeOnly = 1, + kMediaControls = 2, + kNavigation = 3, }; - auto LockedInput() -> LockedInputModes; - auto LockedInput(LockedInputModes) -> void; + auto ButtonInput() -> ButtonInputModes; + auto ButtonInput(ButtonInputModes) -> void; + + auto LockedInput() -> ButtonInputModes; + auto LockedInput(ButtonInputModes) -> void; auto QueueRepeatMode() -> uint8_t; auto QueueRepeatMode(uint8_t) -> void; @@ -191,7 +195,8 @@ class NvsStorage { Setting amp_max_vol_; Setting amp_cur_vol_; Setting amp_left_bias_; - Setting input_mode_; + Setting wheel_input_mode_; + Setting button_input_mode_; Setting locked_input_mode_; Setting output_mode_; Setting haptics_mode_; -- cgit v1.2.3