Added a ui_config flag to manage gui return icon status

This commit is contained in:
GullCode 2022-05-03 14:23:58 +02:00
parent dccc68a4e0
commit c75c4685cd
6 changed files with 51 additions and 14 deletions

View File

@ -31,6 +31,7 @@
#include "ui_sd_card_debug.hpp" #include "ui_sd_card_debug.hpp"
#include "portapack.hpp" #include "portapack.hpp"
#include "portapack_persistent_memory.hpp"
using namespace portapack; using namespace portapack;
#include "irq_controls.hpp" #include "irq_controls.hpp"
@ -345,8 +346,11 @@ DebugPeripheralsMenuView::DebugPeripheralsMenuView(NavigationView& nav) {
/* DebugMenuView *********************************************************/ /* DebugMenuView *********************************************************/
DebugMenuView::DebugMenuView(NavigationView& nav) { 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({ add_items({
//{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } },
{ "Memory", ui::Color::dark_cyan(), &bitmap_icon_memory, [&nav](){ nav.push<DebugMemoryView>(); } }, { "Memory", ui::Color::dark_cyan(), &bitmap_icon_memory, [&nav](){ nav.push<DebugMemoryView>(); } },
//{ "Radio State", ui::Color::white(), nullptr, [&nav](){ nav.push<NotImplementedView>(); } }, //{ "Radio State", ui::Color::white(), nullptr, [&nav](){ nav.push<NotImplementedView>(); } },
{ "SD Card", ui::Color::dark_cyan(), &bitmap_icon_sdcard, [&nav](){ nav.push<SDCardDebugView>(); } }, { "SD Card", ui::Color::dark_cyan(), &bitmap_icon_sdcard, [&nav](){ nav.push<SDCardDebugView>(); } },

View File

@ -234,6 +234,7 @@ SetUIView::SetUIView(NavigationView& nav) {
&checkbox_showsplash, &checkbox_showsplash,
&checkbox_showclock, &checkbox_showclock,
&options_clockformat, &options_clockformat,
&checkbox_guireturnflag,
&button_save, &button_save,
&button_cancel &button_cancel
}); });
@ -242,6 +243,7 @@ SetUIView::SetUIView(NavigationView& nav) {
checkbox_speaker.set_value(persistent_memory::config_speaker()); checkbox_speaker.set_value(persistent_memory::config_speaker());
checkbox_showsplash.set_value(persistent_memory::config_splash()); checkbox_showsplash.set_value(persistent_memory::config_splash());
checkbox_showclock.set_value(!persistent_memory::hide_clock()); 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(); uint32_t backlight_timer = persistent_memory::config_backlight_timer();
if (backlight_timer) { if (backlight_timer) {
@ -284,6 +286,7 @@ SetUIView::SetUIView(NavigationView& nav) {
persistent_memory::set_config_splash(checkbox_showsplash.value()); persistent_memory::set_config_splash(checkbox_showsplash.value());
persistent_memory::set_clock_hidden(!checkbox_showclock.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()); persistent_memory::set_disable_touchscreen(checkbox_disable_touchscreen.value());
nav.pop(); nav.pop();
}; };
@ -345,6 +348,10 @@ void SetQRCodeView::focus() {
} }
SettingsMenuView::SettingsMenuView(NavigationView& nav) { 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({ add_items({
{ "Audio", ui::Color::dark_cyan(), &bitmap_icon_speaker, [&nav](){ nav.push<SetAudioView>(); } }, { "Audio", ui::Color::dark_cyan(), &bitmap_icon_speaker, [&nav](){ nav.push<SetAudioView>(); } },
{ "Radio", ui::Color::dark_cyan(), &bitmap_icon_options_radio, [&nav](){ nav.push<SetRadioView>(); } }, { "Radio", ui::Color::dark_cyan(), &bitmap_icon_options_radio, [&nav](){ nav.push<SetRadioView>(); } },

View File

@ -271,6 +271,12 @@ private:
{ "time and date", 1 } { "time and date", 1 }
} }
}; };
Checkbox checkbox_guireturnflag {
{ 3 * 8, 14 * 16 },
25,
"add return icon in menus"
};
Button button_save { Button button_save {
{ 2 * 8, 16 * 16, 12 * 8, 32 }, { 2 * 8, 16 * 16, 12 * 8, 32 },

View File

@ -464,8 +464,11 @@ void NavigationView::focus() {
/* ReceiversMenuView *****************************************************/ /* ReceiversMenuView *****************************************************/
ReceiversMenuView::ReceiversMenuView(NavigationView& nav) { ReceiversMenuView::ReceiversMenuView(NavigationView& nav) {
add_items({ if( portapack::persistent_memory::show_gui_return_icon() )
//{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } }, {
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<ADSBRxView>(); }, }, { "ADS-B", ui::Color::green(), &bitmap_icon_adsb, [&nav](){ nav.push<ADSBRxView>(); }, },
//{ "ACARS", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push<ACARSAppView>(); }, }, //{ "ACARS", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push<ACARSAppView>(); }, },
{ "AIS Boats", ui::Color::green(), &bitmap_icon_ais, [&nav](){ nav.push<AISAppView>(); } }, { "AIS Boats", ui::Color::green(), &bitmap_icon_ais, [&nav](){ nav.push<AISAppView>(); } },
@ -485,16 +488,19 @@ ReceiversMenuView::ReceiversMenuView(NavigationView& nav) {
{ "LoRa", ui::Color::dark_grey(), &bitmap_icon_lora, [&nav](){ nav.push<NotImplementedView>(); } }, { "LoRa", ui::Color::dark_grey(), &bitmap_icon_lora, [&nav](){ nav.push<NotImplementedView>(); } },
{ "SSTV", ui::Color::dark_grey(), &bitmap_icon_sstv, [&nav](){ nav.push<NotImplementedView>(); } }, { "SSTV", ui::Color::dark_grey(), &bitmap_icon_sstv, [&nav](){ nav.push<NotImplementedView>(); } },
{ "TETRA", ui::Color::dark_grey(), &bitmap_icon_tetra, [&nav](){ nav.push<NotImplementedView>(); } },*/ { "TETRA", ui::Color::dark_grey(), &bitmap_icon_tetra, [&nav](){ nav.push<NotImplementedView>(); } },*/
}); } );
//set_highlighted(4); // Default selection is "Audio" //set_highlighted(0); // Default selection is "Audio"
} }
/* TransmittersMenuView **************************************************/ /* TransmittersMenuView **************************************************/
TransmittersMenuView::TransmittersMenuView(NavigationView& nav) { TransmittersMenuView::TransmittersMenuView(NavigationView& nav) {
add_items({ if( portapack::persistent_memory::show_gui_return_icon() )
//{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } }, {
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<ADSBTxView>(); } }, { "ADS-B [S]", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push<ADSBTxView>(); } },
{ "APRS", ui::Color::green(), &bitmap_icon_aprs, [&nav](){ nav.push<APRSTXView>(); } }, { "APRS", ui::Color::green(), &bitmap_icon_aprs, [&nav](){ nav.push<APRSTXView>(); } },
{ "BHT Xy/EP", ui::Color::green(), &bitmap_icon_bht, [&nav](){ nav.push<BHTView>(); } }, { "BHT Xy/EP", ui::Color::green(), &bitmap_icon_bht, [&nav](){ nav.push<BHTView>(); } },
@ -519,9 +525,12 @@ TransmittersMenuView::TransmittersMenuView(NavigationView& nav) {
/* UtilitiesMenuView *****************************************************/ /* UtilitiesMenuView *****************************************************/
UtilitiesMenuView::UtilitiesMenuView(NavigationView& nav) { 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({ add_items({
//{ "Test app", ui::Color::dark_grey(), nullptr, [&nav](){ nav.push<TestView>(); } }, //{ "Test app", ui::Color::dark_grey(), nullptr, [&nav](){ nav.push<TestView>(); } },
//{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } },
{ "Freq. manager", ui::Color::green(), &bitmap_icon_freqman, [&nav](){ nav.push<FrequencyManagerView>(); } }, { "Freq. manager", ui::Color::green(), &bitmap_icon_freqman, [&nav](){ nav.push<FrequencyManagerView>(); } },
{ "File manager", ui::Color::yellow(), &bitmap_icon_dir, [&nav](){ nav.push<FileManagerView>(); } }, { "File manager", ui::Color::yellow(), &bitmap_icon_dir, [&nav](){ nav.push<FileManagerView>(); } },
//{ "Notepad", ui::Color::dark_grey(), &bitmap_icon_notepad, [&nav](){ nav.push<NotImplementedView>(); } }, //{ "Notepad", ui::Color::dark_grey(), &bitmap_icon_notepad, [&nav](){ nav.push<NotImplementedView>(); } },

View File

@ -230,14 +230,19 @@ void set_playdead_sequence(const uint32_t new_value) {
// bits 31, 30,29,28,27, 26, 25, 24 stores the different single bit configs depicted below // bits 31, 30,29,28,27, 26, 25, 24 stores the different single bit configs depicted below
// bits on position 4 to 19 (16 bits) store the clkout frequency // bits on position 4 to 19 (16 bits) store the clkout frequency
bool disable_touchscreen() { // Option to disable touch screen
return data->ui_config & (1 << 24); bool show_gui_return_icon(){ // add return icon in touchscreen menue
return data->ui_config & (1 << 22);
} }
bool show_bigger_qr_code() { // show bigger QR code bool show_bigger_qr_code() { // show bigger QR code
return data->ui_config & (1 << 23); return data->ui_config & (1 << 23);
} }
bool disable_touchscreen() { // Option to disable touch screen
return data->ui_config & (1 << 24);
}
bool hide_clock() { // clock hidden from main menu bool hide_clock() { // clock hidden from main menu
return data->ui_config & (1 << 25); return data->ui_config & (1 << 25);
} }
@ -274,14 +279,18 @@ uint32_t config_backlight_timer() {
return timer_seconds[data->ui_config & 7]; //first three bits, 8 possible values return timer_seconds[data->ui_config & 7]; //first three bits, 8 possible values
} }
void set_disable_touchscreen(bool v) { void set_gui_return_icon(bool v) {
data->ui_config = (data->ui_config & ~(1 << 24)) | (v << 24); data->ui_config = (data->ui_config & ~(1 << 22)) | (v << 22);
} }
void set_show_bigger_qr_code(bool v) { void set_show_bigger_qr_code(bool v) {
data->ui_config = (data->ui_config & ~(1 << 23)) | (v << 23); data->ui_config = (data->ui_config & ~(1 << 23)) | (v << 23);
} }
void set_disable_touchscreen(bool v) {
data->ui_config = (data->ui_config & ~(1 << 24)) | (v << 24);
}
void set_clock_hidden(bool v) { void set_clock_hidden(bool v) {
data->ui_config = (data->ui_config & ~(1 << 25)) | (v << 25); data->ui_config = (data->ui_config & ~(1 << 25)) | (v << 25);
} }

View File

@ -78,6 +78,7 @@ uint8_t config_cpld();
void set_config_cpld(uint8_t i); void set_config_cpld(uint8_t i);
bool config_splash(); bool config_splash();
bool show_gui_return_icon();
bool show_bigger_qr_code(); bool show_bigger_qr_code();
bool hide_clock(); bool hide_clock();
bool clock_with_date(); bool clock_with_date();
@ -86,8 +87,9 @@ bool config_speaker();
uint32_t config_backlight_timer(); uint32_t config_backlight_timer();
bool disable_touchscreen(); bool disable_touchscreen();
void set_config_splash(bool v); void set_gui_return_icon(bool v);
void set_show_bigger_qr_code(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_hidden(bool v);
void set_clock_with_date(bool v); void set_clock_with_date(bool v);
void set_config_login(bool v); void set_config_login(bool v);