From 5b272af5454a274524b47d91f2387e7bb0b9a0c0 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 1 Dec 2023 20:00:43 +1100 Subject: [PATCH 1/2] Link to crowd supply --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 241bfd97..176567ca 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Tangara -Tangara is an open-hardware portable music player. It runs on an ESP32, fits in -your pocket, and has a battery that lasts all day. +Tangara is a portable music player. It outputs high-quality sound through a 3.5-mm headphone jack, lasts a full day on a charge, and includes a processor that’s powerful enough to support any audio format you can throw at it. It’s also 100% open hardware running open-source software, which makes it easy to customize, repair, and upgrade. Tangara plays what you want to hear, however you want to hear it. + +We're currently trying to scrape together a crowdfunding campaign! Please check us out on [Crowd Supply](https://www.crowdsupply.com/cool-tech-zone/tangara)! ## Source Repositories From 852ce7b91790bc48aa7340527bd5f5ce53147492 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 6 Dec 2023 10:50:37 +1100 Subject: [PATCH 2/2] Add a back button gesture in clickwheel mode --- src/lua/include/lua_thread.hpp | 1 + src/ui/encoder_input.cpp | 20 ++++++++++++++++++++ src/ui/include/ui_fsm.hpp | 1 + src/ui/ui_fsm.cpp | 6 +++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/lua/include/lua_thread.hpp b/src/lua/include/lua_thread.hpp index 4c5198aa..b10fdadf 100644 --- a/src/lua/include/lua_thread.hpp +++ b/src/lua/include/lua_thread.hpp @@ -30,6 +30,7 @@ class LuaThread { auto RunScript(const std::string& path) -> bool; auto bridge() -> Bridge& { return *bridge_; } + auto state() -> lua_State* { return state_; } private: LuaThread(std::unique_ptr&, std::unique_ptr&, lua_State*); diff --git a/src/ui/encoder_input.cpp b/src/ui/encoder_input.cpp index b27c2862..39aacc0c 100644 --- a/src/ui/encoder_input.cpp +++ b/src/ui/encoder_input.cpp @@ -264,6 +264,26 @@ auto EncoderInput::Read(lv_indev_data_t* data) -> void { break; } + // Only trigger the directional long-press gestures if they trigger at the + // same time as a trigger on the overall touchwheel. This means the + // gestures only trigger if it's your only interaction with the wheel this + // press; scrolling and then resting on a direction should not trigger + // them. + trigger = TriggerKey(Keys::kTouchWheel, KeyStyle::kLongPress, now_ms); + if (trigger == Trigger::kLongPress) { + trigger = + TriggerKey(Keys::kDirectionalLeft, KeyStyle::kLongPress, now_ms); + switch (trigger) { + case Trigger::kNone: + break; + case Trigger::kClick: + break; + case Trigger::kLongPress: + events::Ui().Dispatch(internal::BackPressed{}); + break; + } + } + break; } } diff --git a/src/ui/include/ui_fsm.hpp b/src/ui/include/ui_fsm.hpp index a8291a46..671cbf84 100644 --- a/src/ui/include/ui_fsm.hpp +++ b/src/ui/include/ui_fsm.hpp @@ -130,6 +130,7 @@ class Lua : public UiState { void react(const audio::PlaybackStarted&) override; void react(const audio::PlaybackUpdate&) override; void react(const audio::PlaybackFinished&) override; + void react(const internal::BackPressed&) override; using UiState::react; diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp index 539cbc9b..48eca3ff 100644 --- a/src/ui/ui_fsm.cpp +++ b/src/ui/ui_fsm.cpp @@ -245,7 +245,7 @@ auto Lua::PushLuaScreen(lua_State* s) -> int { return 0; } -auto Lua::PopLuaScreen(lua_State* s) -> int { +auto Lua::PopLuaScreen(lua_State *s) -> int { PopScreen(); luavgl_set_root(s, sCurrentScreen->content()); lv_group_set_default(sCurrentScreen->group()); @@ -301,6 +301,10 @@ void Lua::react(const audio::PlaybackFinished&) { playback_playing_->Update(false); } +void Lua::react(const internal::BackPressed& ev) { + PopLuaScreen(sLua->state()); +} + void Browse::entry() {} void Browse::react(const internal::ShowSettingsPage& ev) {