diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 3a4ea93a7..89a6881cb 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -89,6 +89,7 @@ SystemStatusView::SystemStatusView() { &sd_card_status_view, }); + button_back.id = -1; // Special ID used by FocusManager title.set_style(&style_systemstatus); if (!portapack::persistent_memory::ui_config_textentry()) diff --git a/firmware/baseband/stream_output.cpp b/firmware/baseband/stream_output.cpp index b4ea06ec7..7d81e6078 100644 --- a/firmware/baseband/stream_output.cpp +++ b/firmware/baseband/stream_output.cpp @@ -49,8 +49,6 @@ size_t StreamOutput::read(void* const data, const size_t length) { // We need a full buffer... if( !fifo_buffers_full.out(active_buffer) ) { // ...but none are available. Samples were dropped. - //active_buffer = nullptr; // Testing ! Jumpstart - creg::m4txevent::assert(); break; } } diff --git a/firmware/baseband/stream_output.hpp b/firmware/baseband/stream_output.hpp index 4b468f2d2..c4bea9720 100644 --- a/firmware/baseband/stream_output.hpp +++ b/firmware/baseband/stream_output.hpp @@ -48,12 +48,12 @@ private: FIFO fifo_buffers_empty; FIFO fifo_buffers_full; - std::array buffers; - std::array buffers_empty; - std::array buffers_full; + std::array buffers { }; + std::array buffers_empty { }; + std::array buffers_full { }; StreamBuffer* active_buffer { nullptr }; ReplayConfig* const config { nullptr }; - std::unique_ptr data; + std::unique_ptr data { }; }; #endif/*__STREAM_OUTPUT_H__*/ diff --git a/firmware/common/ui_focus.cpp b/firmware/common/ui_focus.cpp index 48d30b02d..70e291ed9 100644 --- a/firmware/common/ui_focus.cpp +++ b/firmware/common/ui_focus.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. + * Copyright (C) 2016 Furrtek * * This file is part of PortaPack. * @@ -162,6 +163,13 @@ void FocusManager::update( return { nullptr, 0 }; }; + + const auto find_back_fn = [](ui::Widget* const w) -> test_result_t { + if( w->focusable() && (w->id == -1) ) + return { w, 0 }; + else + return { nullptr, 0 }; + }; test_collection_t collection; widget_collect_visible(top_widget, test_fn, collection); @@ -175,6 +183,14 @@ void FocusManager::update( //focus->blur(); const auto new_focus = (*nearest).first; set_focus_widget(new_focus); + } else { + if ((focus_widget()->id >= 0) && (event == KeyEvent::Left)) { + // Stuck left, move to back button + collection.clear(); + widget_collect_visible(top_widget, find_back_fn, collection); + if (!collection.empty()) + set_focus_widget(collection[0].first); + } } } } diff --git a/firmware/common/ui_widget.hpp b/firmware/common/ui_widget.hpp index fffc525e5..1ff58c275 100644 --- a/firmware/common/ui_widget.hpp +++ b/firmware/common/ui_widget.hpp @@ -108,7 +108,7 @@ public: void set_style(const Style* new_style); const Style& style() const; - uint16_t id = 0; + int16_t id = 0; // State management methods. void set_dirty(); diff --git a/firmware/portapack-h1-havoc.bin b/firmware/portapack-h1-havoc.bin index 03dfc17c6..8288b4af7 100644 Binary files a/firmware/portapack-h1-havoc.bin and b/firmware/portapack-h1-havoc.bin differ