diff --git a/firmware/application/apps/ui_debug.cpp b/firmware/application/apps/ui_debug.cpp index a1856e25..e9018c1c 100644 --- a/firmware/application/apps/ui_debug.cpp +++ b/firmware/application/apps/ui_debug.cpp @@ -31,6 +31,7 @@ #include "ui_sd_card_debug.hpp" #include "portapack.hpp" +#include "portapack_persistent_memory.hpp" using namespace portapack; #include "irq_controls.hpp" @@ -345,8 +346,11 @@ DebugPeripheralsMenuView::DebugPeripheralsMenuView(NavigationView& nav) { /* DebugMenuView *********************************************************/ DebugMenuView::DebugMenuView(NavigationView& nav) { + if( portapack::persistent_memory::show_gui_return_icon() ) + { + add_items( { { "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } } } ); + } add_items({ - //{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } }, { "Memory", ui::Color::dark_cyan(), &bitmap_icon_memory, [&nav](){ nav.push(); } }, //{ "Radio State", ui::Color::white(), nullptr, [&nav](){ nav.push(); } }, { "SD Card", ui::Color::dark_cyan(), &bitmap_icon_sdcard, [&nav](){ nav.push(); } }, diff --git a/firmware/application/apps/ui_keyfob.hpp b/firmware/application/apps/ui_keyfob.hpp index 0c723340..18685ded 100644 --- a/firmware/application/apps/ui_keyfob.hpp +++ b/firmware/application/apps/ui_keyfob.hpp @@ -36,7 +36,7 @@ public: void focus() override; - std::string title() const override { return "Key fob TX (beta)"; }; + std::string title() const override { return "Key fob TX"; }; private: NavigationView& nav_; diff --git a/firmware/application/apps/ui_settings.cpp b/firmware/application/apps/ui_settings.cpp index bb1792b5..b5e033b3 100644 --- a/firmware/application/apps/ui_settings.cpp +++ b/firmware/application/apps/ui_settings.cpp @@ -234,6 +234,7 @@ SetUIView::SetUIView(NavigationView& nav) { &checkbox_showsplash, &checkbox_showclock, &options_clockformat, + &checkbox_guireturnflag, &button_save, &button_cancel }); @@ -242,6 +243,7 @@ SetUIView::SetUIView(NavigationView& nav) { checkbox_speaker.set_value(persistent_memory::config_speaker()); checkbox_showsplash.set_value(persistent_memory::config_splash()); checkbox_showclock.set_value(!persistent_memory::hide_clock()); + checkbox_guireturnflag.set_value(persistent_memory::show_gui_return_icon()); uint32_t backlight_timer = persistent_memory::config_backlight_timer(); if (backlight_timer) { @@ -278,6 +280,7 @@ SetUIView::SetUIView(NavigationView& nav) { persistent_memory::set_config_splash(checkbox_showsplash.value()); persistent_memory::set_clock_hidden(!checkbox_showclock.value()); + persistent_memory::set_gui_return_icon(checkbox_guireturnflag.value()); persistent_memory::set_disable_touchscreen(checkbox_disable_touchscreen.value()); nav.pop(); }; @@ -372,6 +375,10 @@ void SetQRCodeView::focus() { // Settings main menu // --------------------------------------------------------- SettingsMenuView::SettingsMenuView(NavigationView& nav) { + if( portapack::persistent_memory::show_gui_return_icon() ) + { + add_items( { { "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } } } ); + } add_items({ { "Audio", ui::Color::dark_cyan(), &bitmap_icon_speaker, [&nav](){ nav.push(); } }, { "Radio", ui::Color::dark_cyan(), &bitmap_icon_options_radio, [&nav](){ nav.push(); } }, diff --git a/firmware/application/apps/ui_settings.hpp b/firmware/application/apps/ui_settings.hpp index 562cf636..d1f3cb63 100644 --- a/firmware/application/apps/ui_settings.hpp +++ b/firmware/application/apps/ui_settings.hpp @@ -271,6 +271,12 @@ private: { "time and date", 1 } } }; + + Checkbox checkbox_guireturnflag { + { 3 * 8, 14 * 16 }, + 25, + "add return icon in GUI" + }; Button button_save { { 2 * 8, 16 * 16, 12 * 8, 32 }, diff --git a/firmware/application/portapack.cpp b/firmware/application/portapack.cpp index 0157cd4f..5d51f175 100644 --- a/firmware/application/portapack.cpp +++ b/firmware/application/portapack.cpp @@ -403,6 +403,7 @@ bool init() { // if( !hackrf::cpld::load_sram() ) { // chSysHalt(); // } + chThdSleepMilliseconds(100); configure_pins_portapack(); @@ -412,6 +413,8 @@ bool init() { i2c0.stop(); + chThdSleepMilliseconds(10); + set_clock_config(clock_config_irc); cgu::pll1::disable(); @@ -452,9 +455,11 @@ bool init() { cgu::pll1::direct(); i2c0.start(i2c_config_fast_clock); + chThdSleepMilliseconds(10); touch::adc::init(); controls_init(); + chThdSleepMilliseconds(10); clock_manager.set_reference_ppb(persistent_memory::correction_ppb()); clock_manager.enable_first_if_clock(); @@ -465,10 +470,10 @@ bool init() { sdcStart(&SDCD1, nullptr); sd_card::poll_inserted(); - chThdSleepMilliseconds(1); + chThdSleepMilliseconds(10); if( !portapack::cpld::update_if_necessary(portapack_cpld_config()) ) { - chThdSleepMilliseconds(1); + chThdSleepMilliseconds(10); // If using a "2021/12 QFP100", press and hold the left button while booting. Should only need to do once. if (load_config() != 3){ shutdown_base(); @@ -480,11 +485,13 @@ bool init() { chSysHalt(); } - chThdSleepMilliseconds(1); // This delay seems to solve white noise audio issues + chThdSleepMilliseconds(10); // This delay seems to solve white noise audio issues LPC_CREG->DMAMUX = portapack::gpdma_mux; gpdma::controller.enable(); + chThdSleepMilliseconds(10); + audio::init(portapack_audio_codec()); diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 601112c1..9d310a62 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -464,8 +464,11 @@ void NavigationView::focus() { /* ReceiversMenuView *****************************************************/ ReceiversMenuView::ReceiversMenuView(NavigationView& nav) { - add_items({ - //{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } }, + if( portapack::persistent_memory::show_gui_return_icon() ) + { + add_items( { { "..", ui::Color::light_grey(),&bitmap_icon_previous , [&nav](){ nav.pop(); } } } ); + } + add_items( { { "ADS-B", ui::Color::green(), &bitmap_icon_adsb, [&nav](){ nav.push(); }, }, //{ "ACARS", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push(); }, }, { "AIS Boats", ui::Color::green(), &bitmap_icon_ais, [&nav](){ nav.push(); } }, @@ -485,16 +488,19 @@ ReceiversMenuView::ReceiversMenuView(NavigationView& nav) { { "LoRa", ui::Color::dark_grey(), &bitmap_icon_lora, [&nav](){ nav.push(); } }, { "SSTV", ui::Color::dark_grey(), &bitmap_icon_sstv, [&nav](){ nav.push(); } }, { "TETRA", ui::Color::dark_grey(), &bitmap_icon_tetra, [&nav](){ nav.push(); } },*/ - }); - - //set_highlighted(4); // Default selection is "Audio" + } ); + + //set_highlighted(0); // Default selection is "Audio" } /* TransmittersMenuView **************************************************/ TransmittersMenuView::TransmittersMenuView(NavigationView& nav) { - add_items({ - //{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } }, + if( portapack::persistent_memory::show_gui_return_icon() ) + { + add_items( { { "..", ui::Color::light_grey(),&bitmap_icon_previous , [&nav](){ nav.pop(); } } } ); + } + add_items({ { "ADS-B [S]", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push(); } }, { "APRS", ui::Color::green(), &bitmap_icon_aprs, [&nav](){ nav.push(); } }, { "BHT Xy/EP", ui::Color::green(), &bitmap_icon_bht, [&nav](){ nav.push(); } }, @@ -519,9 +525,12 @@ TransmittersMenuView::TransmittersMenuView(NavigationView& nav) { /* UtilitiesMenuView *****************************************************/ UtilitiesMenuView::UtilitiesMenuView(NavigationView& nav) { + if( portapack::persistent_memory::show_gui_return_icon() ) + { + add_items( { { "..", ui::Color::light_grey(),&bitmap_icon_previous , [&nav](){ nav.pop(); } } } ); + } add_items({ //{ "Test app", ui::Color::dark_grey(), nullptr, [&nav](){ nav.push(); } }, - //{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } }, { "Freq. manager", ui::Color::green(), &bitmap_icon_freqman, [&nav](){ nav.push(); } }, { "File manager", ui::Color::yellow(), &bitmap_icon_dir, [&nav](){ nav.push(); } }, //{ "Notepad", ui::Color::dark_grey(), &bitmap_icon_notepad, [&nav](){ nav.push(); } }, diff --git a/firmware/common/portapack_persistent_memory.cpp b/firmware/common/portapack_persistent_memory.cpp index c7bd2bf9..35e2ad71 100644 --- a/firmware/common/portapack_persistent_memory.cpp +++ b/firmware/common/portapack_persistent_memory.cpp @@ -204,6 +204,12 @@ void set_serial_format(const serial_format_t new_value) { // bits 0-2 store the backlight timer // bits 4-19 (16 bits) store the clkout frequency // bits 21-31 store the different single bit configs depicted below +// bit 20 store the display state of the gui return icon, hidden (0) or shown (1) + +bool show_gui_return_icon(){ // add return icon in touchscreen menue +return data->ui_config & (1 << 20); +} + bool load_app_settings() { // load (last saved) app settings on startup of app return data->ui_config & (1 << 21); } @@ -256,6 +262,10 @@ uint32_t config_backlight_timer() { return timer_seconds[data->ui_config & 7]; //first three bits, 8 possible values } +void set_gui_return_icon(bool v) { + data->ui_config = (data->ui_config & ~(1 << 20)) | (v << 20); +} + void set_load_app_settings(bool v) { data->ui_config = (data->ui_config & ~(1 << 21)) | (v << 21); } @@ -271,7 +281,7 @@ void set_show_bigger_qr_code(bool v) { void set_disable_touchscreen(bool v) { data->ui_config = (data->ui_config & ~(1 << 24)) | (v << 24); } - + void set_clock_hidden(bool v) { data->ui_config = (data->ui_config & ~(1 << 25)) | (v << 25); } diff --git a/firmware/common/portapack_persistent_memory.hpp b/firmware/common/portapack_persistent_memory.hpp index 174fdbfe..03d5cc91 100644 --- a/firmware/common/portapack_persistent_memory.hpp +++ b/firmware/common/portapack_persistent_memory.hpp @@ -78,6 +78,7 @@ uint8_t config_cpld(); void set_config_cpld(uint8_t i); bool config_splash(); +bool show_gui_return_icon(); bool load_app_settings(); bool save_app_settings(); bool show_bigger_qr_code(); @@ -88,10 +89,11 @@ bool config_speaker(); uint32_t config_backlight_timer(); bool disable_touchscreen(); -void set_config_splash(bool v); +void set_gui_return_icon(bool v); void set_load_app_settings(bool v); void set_save_app_settings(bool v); void set_show_bigger_qr_code(bool v); +void set_config_splash(bool v); void set_clock_hidden(bool v); void set_clock_with_date(bool v); void set_config_login(bool v);