summaryrefslogtreecommitdiff
path: root/src/tangara/input/device_factory.cpp
diff options
context:
space:
mode:
authorTab_theFox <tab_thefox@noreply.codeberg.org>2025-03-23 17:45:19 +0100
committerTab_theFox <tab_thefox@noreply.codeberg.org>2025-04-22 22:23:47 +0200
commitdc5676229d19f317b97df6a3d3582bbb02df33df (patch)
tree2036ecb5b6fdefaabc6beb9ac7cab21dcadcad56 /src/tangara/input/device_factory.cpp
parent79c9f0b6ccfec97f23563010f134d842c4240582 (diff)
downloadtangara-fw-dc5676229d19f317b97df6a3d3582bbb02df33df.tar.gz
add single touch shourtcuts for touch wheel
This allows you to use the touch wheel for quick playback control: - bottom quadrant for play/pause - left and right quadrant for track skip back / forward - top quadrant to seek back 25 seconds (handy when listening to a podcast)
Diffstat (limited to 'src/tangara/input/device_factory.cpp')
-rw-r--r--src/tangara/input/device_factory.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/tangara/input/device_factory.cpp b/src/tangara/input/device_factory.cpp
index ff597556..9ae69e47 100644
--- a/src/tangara/input/device_factory.cpp
+++ b/src/tangara/input/device_factory.cpp
@@ -25,7 +25,11 @@ DeviceFactory::DeviceFactory(
: services_(services) {
if (services->touchwheel()) {
wheel_ =
- std::make_shared<TouchWheel>(services->nvs(), **services->touchwheel());
+ std::make_shared<TouchWheel>(services->nvs(), **services->touchwheel(), services->track_queue());
+ auto wheel_mode = services_->nvs().WheelInput();
+ if (wheel_mode == drivers::NvsStorage::WheelInputModes::kWheelWithButtons) {
+ wheel_->activate_buttons(true);
+ }
}
reset_ = std::make_shared<HardReset>(services_->gpios());
}
@@ -73,6 +77,17 @@ auto DeviceFactory::createInputs()
}
break;
case drivers::NvsStorage::WheelInputModes::kRotatingWheel:
+ if (wheel_) {
+ wheel_->activate_buttons(false);
+ ret.push_back(wheel_);
+ }
+ break;
+ case drivers::NvsStorage::WheelInputModes::kWheelWithButtons:
+ if (wheel_) {
+ wheel_->activate_buttons(true);
+ ret.push_back(wheel_);
+ }
+ break;
default: // Don't break input over a bad enum value.
if (wheel_) {
ret.push_back(wheel_);