summaryrefslogtreecommitdiff
path: root/src/tangara/input/device_factory.cpp
diff options
context:
space:
mode:
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_);