summaryrefslogtreecommitdiff
path: root/src/ui/ui_fsm.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-10-03 15:00:28 +1100
committerjacqueline <me@jacqueline.id.au>2023-10-03 15:00:28 +1100
commitc851b789faf71d0ef2092ae7d8cd3190c13d85c9 (patch)
tree32a3ca469063dcf4a25e6d6767de50f5d8c535e8 /src/ui/ui_fsm.cpp
parent09f129662e41108fd86255c02623a38e07cbbb27 (diff)
downloadtangara-fw-c851b789faf71d0ef2092ae7d8cd3190c13d85c9.tar.gz
Write up the new input modes to NVS and settings
Diffstat (limited to 'src/ui/ui_fsm.cpp')
-rw-r--r--src/ui/ui_fsm.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp
index bc976eab..03e20882 100644
--- a/src/ui/ui_fsm.cpp
+++ b/src/ui/ui_fsm.cpp
@@ -114,6 +114,13 @@ void UiState::react(const audio::QueueUpdate&) {
sPlaybackModel.upcoming_tracks.set(queue.GetUpcoming(10));
}
+void UiState::react(const internal::ControlSchemeChanged&) {
+ if (!sInput) {
+ return;
+ }
+ sInput->mode(sServices->nvs().PrimaryInput());
+}
+
namespace states {
void Splash::exit() {
@@ -138,6 +145,7 @@ void Splash::react(const system_fsm::BootComplete& ev) {
auto touchwheel = sServices->touchwheel();
if (touchwheel) {
sInput = std::make_shared<EncoderInput>(sServices->gpios(), **touchwheel);
+ sInput->mode(sServices->nvs().PrimaryInput());
sTask->input(sInput);
} else {
ESP_LOGE(kTag, "no input devices initialised!");
@@ -252,7 +260,7 @@ void Browse::react(const internal::ShowSettingsPage& ev) {
new screens::Appearance(sTopBarModel, sServices->nvs(), *sDisplay));
break;
case internal::ShowSettingsPage::Page::kInput:
- screen.reset(new screens::InputMethod(sTopBarModel));
+ screen.reset(new screens::InputMethod(sTopBarModel, sServices->nvs()));
break;
case internal::ShowSettingsPage::Page::kStorage:
screen.reset(new screens::Storage(sTopBarModel));