mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-13 17:05:37 -04:00
Auto layout of top status icons (#1178)
* WIP - updated pmem * WIP status tray auto layout * Add settings page for icons * Add ui_config2 to pmem dump --------- Co-authored-by: kallanreed <kallanreed@noreply.github.com>
This commit is contained in:
parent
6b0f90c321
commit
e08273b8b8
9 changed files with 632 additions and 360 deletions
|
@ -98,9 +98,51 @@
|
|||
|
||||
using portapack::receiver_model;
|
||||
using portapack::transmitter_model;
|
||||
namespace pmem = portapack::persistent_memory;
|
||||
|
||||
namespace ui {
|
||||
|
||||
/* StatusTray ************************************************************/
|
||||
|
||||
StatusTray::StatusTray(Point pos)
|
||||
: View{{pos, {0, height}}},
|
||||
pos_(pos) {
|
||||
set_focusable(false);
|
||||
}
|
||||
|
||||
void StatusTray::add(Widget* child) {
|
||||
width_ += child->parent_rect().width();
|
||||
add_child(child);
|
||||
}
|
||||
|
||||
void StatusTray::update_layout() {
|
||||
// Widen the tray's parent rect.
|
||||
auto rect = parent_rect();
|
||||
set_parent_rect({{rect.left() - width_, rect.top()}, {rect.right() + width_, height}});
|
||||
|
||||
// Update the children.
|
||||
auto x = 0;
|
||||
for (auto child : children()) {
|
||||
auto size = child->parent_rect().size();
|
||||
child->set_parent_rect({{x, 0}, size});
|
||||
x += size.width();
|
||||
}
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void StatusTray::clear() {
|
||||
// More efficient than 'remove_children'.
|
||||
for (auto child : children())
|
||||
child->set_parent(nullptr);
|
||||
children_.clear();
|
||||
width_ = 0;
|
||||
set_parent_rect({pos_, {width_, height}});
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void StatusTray::paint(Painter&) {
|
||||
}
|
||||
|
||||
/* SystemStatusView ******************************************************/
|
||||
|
||||
SystemStatusView::SystemStatusView(
|
||||
|
@ -111,48 +153,19 @@ SystemStatusView::SystemStatusView(
|
|||
&button_back,
|
||||
&title,
|
||||
&button_title,
|
||||
&button_converter,
|
||||
&button_speaker,
|
||||
&button_stealth,
|
||||
//&button_textentry,
|
||||
&button_camera,
|
||||
&button_sleep,
|
||||
&button_bias_tee,
|
||||
&button_clock_status,
|
||||
&sd_card_status_view,
|
||||
&status_icons,
|
||||
});
|
||||
|
||||
if (portapack::persistent_memory::should_use_sdcard_for_pmem()) {
|
||||
portapack::persistent_memory::load_persistent_settings_from_file();
|
||||
}
|
||||
|
||||
if (portapack::persistent_memory::config_hide_converter()) {
|
||||
button_converter.hidden(true);
|
||||
} else {
|
||||
button_converter.hidden(false);
|
||||
if (portapack::persistent_memory::config_converter()) {
|
||||
button_converter.set_foreground(Color::red());
|
||||
} else {
|
||||
button_converter.set_foreground(Color::light_grey());
|
||||
}
|
||||
if (pmem::should_use_sdcard_for_pmem()) {
|
||||
pmem::load_persistent_settings_from_file();
|
||||
}
|
||||
|
||||
button_back.id = -1; // Special ID used by FocusManager
|
||||
title.set_style(&Styles::bg_dark_grey);
|
||||
|
||||
if (portapack::persistent_memory::stealth_mode())
|
||||
button_stealth.set_foreground(ui::Color::green());
|
||||
|
||||
/*if (!portapack::persistent_memory::ui_config_textentry())
|
||||
button_textentry.set_bitmap(&bitmap_icon_keyboard);
|
||||
else
|
||||
button_textentry.set_bitmap(&bitmap_icon_unistroke);*/
|
||||
|
||||
refresh();
|
||||
|
||||
button_back.on_select = [this](ImageButton&) {
|
||||
if (portapack::persistent_memory::should_use_sdcard_for_pmem()) {
|
||||
portapack::persistent_memory::save_persistent_settings_to_file();
|
||||
if (pmem::should_use_sdcard_for_pmem()) {
|
||||
pmem::save_persistent_settings_to_file();
|
||||
}
|
||||
if (this->on_back)
|
||||
this->on_back();
|
||||
|
@ -178,10 +191,6 @@ SystemStatusView::SystemStatusView(
|
|||
this->on_bias_tee();
|
||||
};
|
||||
|
||||
/*button_textentry.on_select = [this](ImageButton&) {
|
||||
this->on_textentry();
|
||||
};*/
|
||||
|
||||
button_camera.on_select = [this](ImageButton&) {
|
||||
this->on_camera();
|
||||
};
|
||||
|
@ -196,26 +205,26 @@ SystemStatusView::SystemStatusView(
|
|||
};
|
||||
|
||||
audio::output::update_audio_mute();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void SystemStatusView::refresh() {
|
||||
if (portapack::persistent_memory::config_hide_converter()) {
|
||||
button_converter.hidden(true);
|
||||
} else {
|
||||
if (portapack::persistent_memory::config_updown_converter()) {
|
||||
button_converter.set_bitmap(&bitmap_icon_downconvert);
|
||||
} else {
|
||||
button_converter.set_bitmap(&bitmap_icon_upconvert);
|
||||
}
|
||||
button_converter.hidden(false);
|
||||
if (portapack::persistent_memory::config_converter()) {
|
||||
button_converter.set_foreground(Color::red());
|
||||
} else {
|
||||
button_converter.set_foreground(Color::light_grey());
|
||||
}
|
||||
}
|
||||
// NB: Order of insertion is the display order Left->Right.
|
||||
// TODO: Might be better to support hide and only add once.
|
||||
status_icons.clear();
|
||||
if (!pmem::ui_hide_camera()) status_icons.add(&button_camera);
|
||||
if (!pmem::ui_hide_sleep()) status_icons.add(&button_sleep);
|
||||
if (!pmem::ui_hide_stealth()) status_icons.add(&button_stealth);
|
||||
if (!pmem::ui_hide_converter()) status_icons.add(&button_converter);
|
||||
if (!pmem::ui_hide_bias_tee()) status_icons.add(&button_bias_tee);
|
||||
if (!pmem::ui_hide_clock()) status_icons.add(&button_clock_status);
|
||||
if (!pmem::ui_hide_speaker()) status_icons.add(&button_speaker);
|
||||
if (!pmem::ui_hide_sd_card()) status_icons.add(&sd_card_status_view);
|
||||
status_icons.update_layout();
|
||||
|
||||
if (portapack::persistent_memory::config_audio_mute()) {
|
||||
// Update icon display (try to keep all in on place).
|
||||
// Speaker
|
||||
if (pmem::config_audio_mute()) {
|
||||
button_speaker.set_foreground(Color::light_grey());
|
||||
button_speaker.set_bitmap(&bitmap_icon_speaker_mute);
|
||||
} else {
|
||||
|
@ -223,25 +232,29 @@ void SystemStatusView::refresh() {
|
|||
button_speaker.set_bitmap(&bitmap_icon_speaker);
|
||||
}
|
||||
|
||||
// Clock status
|
||||
bool external_clk = portapack::clock_manager.get_reference().source == ClockManager::ReferenceSource::External;
|
||||
button_clock_status.set_bitmap(external_clk ? &bitmap_icon_clk_ext : &bitmap_icon_clk_int);
|
||||
button_clock_status.set_foreground(
|
||||
pmem::clkout_enabled() ? Color::green() : Color::light_grey());
|
||||
|
||||
// Antenna DC Bias
|
||||
if (portapack::get_antenna_bias()) {
|
||||
button_bias_tee.set_bitmap(&bitmap_icon_biast_on);
|
||||
button_bias_tee.set_foreground(ui::Color::yellow());
|
||||
button_bias_tee.set_foreground(Color::yellow());
|
||||
} else {
|
||||
button_bias_tee.set_bitmap(&bitmap_icon_biast_off);
|
||||
button_bias_tee.set_foreground(ui::Color::light_grey());
|
||||
button_bias_tee.set_foreground(Color::light_grey());
|
||||
}
|
||||
|
||||
if (portapack::clock_manager.get_reference().source == ClockManager::ReferenceSource::External) {
|
||||
button_clock_status.set_bitmap(&bitmap_icon_clk_ext);
|
||||
} else {
|
||||
button_clock_status.set_bitmap(&bitmap_icon_clk_int);
|
||||
}
|
||||
// Converter
|
||||
button_converter.set_bitmap(
|
||||
pmem::config_updown_converter() ? &bitmap_icon_downconvert : &bitmap_icon_upconvert);
|
||||
button_converter.set_foreground(pmem::config_converter() ? Color::red() : Color::light_grey());
|
||||
|
||||
if (portapack::persistent_memory::clkout_enabled()) {
|
||||
button_clock_status.set_foreground(ui::Color::green());
|
||||
} else {
|
||||
button_clock_status.set_foreground(ui::Color::light_grey());
|
||||
}
|
||||
// Stealth
|
||||
button_stealth.set_foreground(
|
||||
pmem::stealth_mode() ? Color::green() : Color::light_grey());
|
||||
|
||||
set_dirty();
|
||||
}
|
||||
|
@ -271,44 +284,40 @@ void SystemStatusView::set_title(const std::string new_value) {
|
|||
}
|
||||
|
||||
void SystemStatusView::on_converter() {
|
||||
if (!portapack::persistent_memory::config_converter()) {
|
||||
portapack::persistent_memory::set_config_converter(true);
|
||||
button_converter.set_foreground(Color::red());
|
||||
} else {
|
||||
portapack::persistent_memory::set_config_converter(false);
|
||||
button_converter.set_foreground(Color::light_grey());
|
||||
}
|
||||
pmem::set_config_converter(!pmem::config_converter());
|
||||
|
||||
// Poke to update tuning
|
||||
// NOTE: Code assumes here that a TX app isn't active, since RX & TX have diff tuning offsets
|
||||
// (and there's only one tuner in the radio so can't update tuner for both).
|
||||
// TODO: Maybe expose the 'enabled_' flag on models.
|
||||
receiver_model.set_target_frequency(receiver_model.target_frequency());
|
||||
refresh();
|
||||
}
|
||||
|
||||
void SystemStatusView::on_speaker() {
|
||||
portapack::persistent_memory::set_config_audio_mute(!portapack::persistent_memory::config_audio_mute());
|
||||
pmem::set_config_audio_mute(!pmem::config_audio_mute());
|
||||
audio::output::update_audio_mute();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void SystemStatusView::on_stealth() {
|
||||
bool mode = not portapack::persistent_memory::stealth_mode();
|
||||
|
||||
portapack::persistent_memory::set_stealth_mode(mode);
|
||||
|
||||
button_stealth.set_foreground(mode ? Color::green() : Color::light_grey());
|
||||
pmem::set_stealth_mode(!pmem::stealth_mode());
|
||||
refresh();
|
||||
}
|
||||
|
||||
void SystemStatusView::on_bias_tee() {
|
||||
if (!portapack::get_antenna_bias()) {
|
||||
nav_.display_modal("Bias voltage", "Enable DC voltage on\nantenna connector?", YESNO, [this](bool v) {
|
||||
if (v) {
|
||||
portapack::set_antenna_bias(true);
|
||||
receiver_model.set_antenna_bias();
|
||||
transmitter_model.set_antenna_bias();
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
nav_.display_modal("Bias voltage",
|
||||
"Enable DC voltage on\nantenna connector?",
|
||||
YESNO,
|
||||
[this](bool v) {
|
||||
if (v) {
|
||||
portapack::set_antenna_bias(true);
|
||||
receiver_model.set_antenna_bias();
|
||||
transmitter_model.set_antenna_bias();
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
portapack::set_antenna_bias(false);
|
||||
receiver_model.set_antenna_bias();
|
||||
|
@ -321,48 +330,28 @@ void SystemStatusView::on_bias_tee() {
|
|||
}
|
||||
}
|
||||
|
||||
/*void SystemStatusView::on_textentry() {
|
||||
uint8_t cfg;
|
||||
|
||||
cfg = portapack::persistent_memory::ui_config_textentry();
|
||||
portapack::persistent_memory::set_config_textentry(cfg ^ 1);
|
||||
|
||||
if (!cfg)
|
||||
button_textentry.set_bitmap(&bitmap_icon_unistroke);
|
||||
else
|
||||
button_textentry.set_bitmap(&bitmap_icon_keyboard);
|
||||
}*/
|
||||
|
||||
void SystemStatusView::on_camera() {
|
||||
ensure_directory("SCREENSHOTS");
|
||||
auto path = next_filename_matching_pattern(u"SCREENSHOTS/SCR_????.PNG");
|
||||
|
||||
if (path.empty()) {
|
||||
if (path.empty())
|
||||
return;
|
||||
}
|
||||
|
||||
PNGWriter png;
|
||||
auto create_error = png.create(path);
|
||||
if (create_error.is_valid()) {
|
||||
auto error = png.create(path);
|
||||
if (error)
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 320; i++) {
|
||||
std::array<ColorRGB888, 240> row;
|
||||
portapack::display.read_pixels({0, i, 240, 1}, row);
|
||||
for (int i = 0; i < screen_height; i++) {
|
||||
std::array<ColorRGB888, screen_width> row;
|
||||
portapack::display.read_pixels({0, i, screen_width, 1}, row);
|
||||
png.write_scanline(row);
|
||||
}
|
||||
}
|
||||
|
||||
void SystemStatusView::on_clk() {
|
||||
bool v = portapack::persistent_memory::clkout_enabled();
|
||||
if (v) {
|
||||
v = false;
|
||||
} else {
|
||||
v = true;
|
||||
}
|
||||
portapack::clock_manager.enable_clock_output(v);
|
||||
portapack::persistent_memory::set_clkout_enabled(v);
|
||||
pmem::set_clkout_enabled(!pmem::clkout_enabled());
|
||||
portapack::clock_manager.enable_clock_output(pmem::clkout_enabled());
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
@ -390,17 +379,17 @@ InformationView::InformationView(
|
|||
|
||||
version.set_style(&style_infobar);
|
||||
|
||||
ltime.set_hide_clock(portapack::persistent_memory::hide_clock());
|
||||
ltime.set_hide_clock(pmem::hide_clock());
|
||||
ltime.set_style(&style_infobar);
|
||||
ltime.set_seconds_enabled(true);
|
||||
ltime.set_date_enabled(portapack::persistent_memory::clock_with_date());
|
||||
ltime.set_date_enabled(pmem::clock_with_date());
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void InformationView::refresh() {
|
||||
ltime.set_hide_clock(portapack::persistent_memory::hide_clock());
|
||||
ltime.set_hide_clock(pmem::hide_clock());
|
||||
ltime.set_seconds_enabled(true);
|
||||
ltime.set_date_enabled(portapack::persistent_memory::clock_with_date());
|
||||
ltime.set_date_enabled(pmem::clock_with_date());
|
||||
}
|
||||
|
||||
/* Navigation ************************************************************/
|
||||
|
@ -510,36 +499,36 @@ bool NavigationView::set_on_pop(std::function<void()> on_pop) {
|
|||
/* ReceiversMenuView *****************************************************/
|
||||
|
||||
ReceiversMenuView::ReceiversMenuView(NavigationView& nav) {
|
||||
if (portapack::persistent_memory::show_gui_return_icon()) {
|
||||
add_items({{"..", ui::Color::light_grey(), &bitmap_icon_previous, [&nav]() { nav.pop(); }}});
|
||||
if (pmem::show_gui_return_icon()) {
|
||||
add_items({{"..", Color::light_grey(), &bitmap_icon_previous, [&nav]() { nav.pop(); }}});
|
||||
}
|
||||
add_items({
|
||||
{
|
||||
"ADS-B",
|
||||
ui::Color::green(),
|
||||
Color::green(),
|
||||
&bitmap_icon_adsb,
|
||||
[&nav]() { nav.push<ADSBRxView>(); },
|
||||
},
|
||||
//{ "ACARS", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push<ACARSAppView>(); }, },
|
||||
{"AIS Boats", ui::Color::green(), &bitmap_icon_ais, [&nav]() { nav.push<AISAppView>(); }},
|
||||
{"AFSK", ui::Color::yellow(), &bitmap_icon_modem, [&nav]() { nav.push<AFSKRxView>(); }},
|
||||
{"BTLE", ui::Color::yellow(), &bitmap_icon_btle, [&nav]() { nav.push<BTLERxView>(); }},
|
||||
{"NRF", ui::Color::yellow(), &bitmap_icon_nrf, [&nav]() { nav.push<NRFRxView>(); }},
|
||||
{"Audio", ui::Color::green(), &bitmap_icon_speaker, [&nav]() { nav.push<AnalogAudioView>(); }},
|
||||
{"Analog TV", ui::Color::yellow(), &bitmap_icon_sstv, [&nav]() { nav.push<AnalogTvView>(); }},
|
||||
{"ERT Meter", ui::Color::green(), &bitmap_icon_ert, [&nav]() { nav.push<ERTAppView>(); }},
|
||||
{"POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav]() { nav.push<POCSAGAppView>(); }},
|
||||
{"Radiosnde", ui::Color::green(), &bitmap_icon_sonde, [&nav]() { nav.push<SondeView>(); }},
|
||||
{"TPMS Cars", ui::Color::green(), &bitmap_icon_tpms, [&nav]() { nav.push<TPMSAppView>(); }},
|
||||
{"Recon", ui::Color::green(), &bitmap_icon_scanner, [&nav]() { nav.push<ReconView>(); }},
|
||||
{"Level", ui::Color::green(), &bitmap_icon_options_radio, [&nav]() { nav.push<LevelView>(); }},
|
||||
{"APRS", ui::Color::green(), &bitmap_icon_aprs, [&nav]() { nav.push<APRSRXView>(); }}
|
||||
//{ "ACARS", Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push<ACARSAppView>(); }, },
|
||||
{"AIS Boats", Color::green(), &bitmap_icon_ais, [&nav]() { nav.push<AISAppView>(); }},
|
||||
{"AFSK", Color::yellow(), &bitmap_icon_modem, [&nav]() { nav.push<AFSKRxView>(); }},
|
||||
{"BTLE", Color::yellow(), &bitmap_icon_btle, [&nav]() { nav.push<BTLERxView>(); }},
|
||||
{"NRF", Color::yellow(), &bitmap_icon_nrf, [&nav]() { nav.push<NRFRxView>(); }},
|
||||
{"Audio", Color::green(), &bitmap_icon_speaker, [&nav]() { nav.push<AnalogAudioView>(); }},
|
||||
{"Analog TV", Color::yellow(), &bitmap_icon_sstv, [&nav]() { nav.push<AnalogTvView>(); }},
|
||||
{"ERT Meter", Color::green(), &bitmap_icon_ert, [&nav]() { nav.push<ERTAppView>(); }},
|
||||
{"POCSAG", Color::green(), &bitmap_icon_pocsag, [&nav]() { nav.push<POCSAGAppView>(); }},
|
||||
{"Radiosnde", Color::green(), &bitmap_icon_sonde, [&nav]() { nav.push<SondeView>(); }},
|
||||
{"TPMS Cars", Color::green(), &bitmap_icon_tpms, [&nav]() { nav.push<TPMSAppView>(); }},
|
||||
{"Recon", Color::green(), &bitmap_icon_scanner, [&nav]() { nav.push<ReconView>(); }},
|
||||
{"Level", Color::green(), &bitmap_icon_options_radio, [&nav]() { nav.push<LevelView>(); }},
|
||||
{"APRS", Color::green(), &bitmap_icon_aprs, [&nav]() { nav.push<APRSRXView>(); }}
|
||||
/*
|
||||
{ "DMR", ui::Color::dark_grey(), &bitmap_icon_dmr, [&nav](){ nav.push<NotImplementedView>(); } },
|
||||
{ "SIGFOX", ui::Color::dark_grey(), &bitmap_icon_fox, [&nav](){ nav.push<NotImplementedView>(); } }, // SIGFRXView
|
||||
{ "LoRa", ui::Color::dark_grey(), &bitmap_icon_lora, [&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>(); } },*/
|
||||
{ "DMR", Color::dark_grey(), &bitmap_icon_dmr, [&nav](){ nav.push<NotImplementedView>(); } },
|
||||
{ "SIGFOX", Color::dark_grey(), &bitmap_icon_fox, [&nav](){ nav.push<NotImplementedView>(); } }, // SIGFRXView
|
||||
{ "LoRa", Color::dark_grey(), &bitmap_icon_lora, [&nav](){ nav.push<NotImplementedView>(); } },
|
||||
{ "SSTV", Color::dark_grey(), &bitmap_icon_sstv, [&nav](){ nav.push<NotImplementedView>(); } },
|
||||
{ "TETRA", Color::dark_grey(), &bitmap_icon_tetra, [&nav](){ nav.push<NotImplementedView>(); } },*/
|
||||
});
|
||||
|
||||
// set_highlighted(0); // Default selection is "Audio"
|
||||
|
@ -548,8 +537,8 @@ ReceiversMenuView::ReceiversMenuView(NavigationView& nav) {
|
|||
/* TransmittersMenuView **************************************************/
|
||||
|
||||
TransmittersMenuView::TransmittersMenuView(NavigationView& nav) {
|
||||
if (portapack::persistent_memory::show_gui_return_icon()) {
|
||||
add_items({{"..", ui::Color::light_grey(), &bitmap_icon_previous, [&nav]() { nav.pop(); }}});
|
||||
if (pmem::show_gui_return_icon()) {
|
||||
add_items({{"..", Color::light_grey(), &bitmap_icon_previous, [&nav]() { nav.pop(); }}});
|
||||
}
|
||||
add_items({
|
||||
{"ADS-B [S]", ui::Color::yellow(), &bitmap_icon_adsb, [&nav]() { nav.push<ADSBTxView>(); }},
|
||||
|
@ -578,22 +567,22 @@ 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(); }}});
|
||||
if (pmem::show_gui_return_icon()) {
|
||||
add_items({{"..", Color::light_grey(), &bitmap_icon_previous, [&nav]() { nav.pop(); }}});
|
||||
}
|
||||
add_items({
|
||||
//{ "Test app", ui::Color::dark_grey(), nullptr, [&nav](){ nav.push<TestView>(); } },
|
||||
{"Freq. manager", ui::Color::green(), &bitmap_icon_freqman, [&nav]() { nav.push<FrequencyManagerView>(); }},
|
||||
{"File manager", ui::Color::yellow(), &bitmap_icon_dir, [&nav]() { nav.push<FileManagerView>(); }},
|
||||
{"Notepad", ui::Color::dark_cyan(), &bitmap_icon_notepad, [&nav]() { nav.push<TextEditorView>(); }},
|
||||
{"Signal gen", ui::Color::green(), &bitmap_icon_cwgen, [&nav]() { nav.push<SigGenView>(); }},
|
||||
//{ "Tone search", ui::Color::dark_grey(), nullptr, [&nav](){ nav.push<ToneSearchView>(); } },
|
||||
{"Wav viewer", ui::Color::yellow(), &bitmap_icon_soundboard, [&nav]() { nav.push<ViewWavView>(); }},
|
||||
{"Antenna length", ui::Color::green(), &bitmap_icon_tools_antenna, [&nav]() { nav.push<WhipCalcView>(); }},
|
||||
//{ "Test app", Color::dark_grey(), nullptr, [&nav](){ nav.push<TestView>(); } },
|
||||
{"Freq. manager", Color::green(), &bitmap_icon_freqman, [&nav]() { nav.push<FrequencyManagerView>(); }},
|
||||
{"File manager", Color::yellow(), &bitmap_icon_dir, [&nav]() { nav.push<FileManagerView>(); }},
|
||||
{"Notepad", Color::dark_cyan(), &bitmap_icon_notepad, [&nav]() { nav.push<TextEditorView>(); }},
|
||||
{"Signal gen", Color::green(), &bitmap_icon_cwgen, [&nav]() { nav.push<SigGenView>(); }},
|
||||
//{ "Tone search", Color::dark_grey(), nullptr, [&nav](){ nav.push<ToneSearchView>(); } },
|
||||
{"Wav viewer", Color::yellow(), &bitmap_icon_soundboard, [&nav]() { nav.push<ViewWavView>(); }},
|
||||
{"Antenna length", Color::green(), &bitmap_icon_tools_antenna, [&nav]() { nav.push<WhipCalcView>(); }},
|
||||
|
||||
{"Wipe SD card", ui::Color::red(), &bitmap_icon_tools_wipesd, [&nav]() { nav.push<WipeSDView>(); }},
|
||||
{"Flash Utility", ui::Color::red(), &bitmap_icon_temperature, [&nav]() { nav.push<FlashUtilityView>(); }},
|
||||
{"SD over USB", ui::Color::yellow(), &bitmap_icon_hackrf, [&nav]() { nav.push<SdOverUsbView>(); }},
|
||||
{"Wipe SD card", Color::red(), &bitmap_icon_tools_wipesd, [&nav]() { nav.push<WipeSDView>(); }},
|
||||
{"Flash Utility", Color::red(), &bitmap_icon_temperature, [&nav]() { nav.push<FlashUtilityView>(); }},
|
||||
{"SD over USB", Color::yellow(), &bitmap_icon_hackrf, [&nav]() { nav.push<SdOverUsbView>(); }},
|
||||
});
|
||||
set_max_rows(2); // allow wider buttons
|
||||
}
|
||||
|
@ -611,20 +600,20 @@ void SystemMenuView::hackrf_mode(NavigationView& nav) {
|
|||
|
||||
SystemMenuView::SystemMenuView(NavigationView& nav) {
|
||||
add_items({
|
||||
//{ "Play dead", ui::Color::red(), &bitmap_icon_playdead, [&nav](){ nav.push<PlayDeadView>(); } },
|
||||
{"Receive", ui::Color::cyan(), &bitmap_icon_receivers, [&nav]() { nav.push<ReceiversMenuView>(); }},
|
||||
{"Transmit", ui::Color::cyan(), &bitmap_icon_transmit, [&nav]() { nav.push<TransmittersMenuView>(); }},
|
||||
{"Capture", ui::Color::red(), &bitmap_icon_capture, [&nav]() { nav.push<CaptureAppView>(); }},
|
||||
{"Replay", ui::Color::green(), &bitmap_icon_replay, [&nav]() { nav.push<ReplayAppView>(); }},
|
||||
{"Search", ui::Color::yellow(), &bitmap_icon_search, [&nav]() { nav.push<SearchView>(); }},
|
||||
{"Scanner", ui::Color::yellow(), &bitmap_icon_scanner, [&nav]() { nav.push<ScannerView>(); }},
|
||||
{"Microphone", ui::Color::yellow(), &bitmap_icon_microphone, [&nav]() { nav.push<MicTXView>(); }},
|
||||
{"Looking Glass", ui::Color::yellow(), &bitmap_icon_looking, [&nav]() { nav.push<GlassView>(); }},
|
||||
{"Utilities", ui::Color::cyan(), &bitmap_icon_utilities, [&nav]() { nav.push<UtilitiesMenuView>(); }},
|
||||
{"Settings", ui::Color::cyan(), &bitmap_icon_setup, [&nav]() { nav.push<SettingsMenuView>(); }},
|
||||
{"Debug", ui::Color::light_grey(), &bitmap_icon_debug, [&nav]() { nav.push<DebugMenuView>(); }},
|
||||
{"HackRF", ui::Color::cyan(), &bitmap_icon_hackrf, [this, &nav]() { hackrf_mode(nav); }},
|
||||
//{ "About", ui::Color::cyan(), nullptr, [&nav](){ nav.push<AboutView>(); } }
|
||||
//{ "Play dead", Color::red(), &bitmap_icon_playdead, [&nav](){ nav.push<PlayDeadView>(); } },
|
||||
{"Receive", Color::cyan(), &bitmap_icon_receivers, [&nav]() { nav.push<ReceiversMenuView>(); }},
|
||||
{"Transmit", Color::cyan(), &bitmap_icon_transmit, [&nav]() { nav.push<TransmittersMenuView>(); }},
|
||||
{"Capture", Color::red(), &bitmap_icon_capture, [&nav]() { nav.push<CaptureAppView>(); }},
|
||||
{"Replay", Color::green(), &bitmap_icon_replay, [&nav]() { nav.push<ReplayAppView>(); }},
|
||||
{"Search", Color::yellow(), &bitmap_icon_search, [&nav]() { nav.push<SearchView>(); }},
|
||||
{"Scanner", Color::yellow(), &bitmap_icon_scanner, [&nav]() { nav.push<ScannerView>(); }},
|
||||
{"Microphone", Color::yellow(), &bitmap_icon_microphone, [&nav]() { nav.push<MicTXView>(); }},
|
||||
{"Looking Glass", Color::yellow(), &bitmap_icon_looking, [&nav]() { nav.push<GlassView>(); }},
|
||||
{"Utilities", Color::cyan(), &bitmap_icon_utilities, [&nav]() { nav.push<UtilitiesMenuView>(); }},
|
||||
{"Settings", Color::cyan(), &bitmap_icon_setup, [&nav]() { nav.push<SettingsMenuView>(); }},
|
||||
{"Debug", Color::light_grey(), &bitmap_icon_debug, [&nav]() { nav.push<DebugMenuView>(); }},
|
||||
{"HackRF", Color::cyan(), &bitmap_icon_hackrf, [this, &nav]() { hackrf_mode(nav); }},
|
||||
//{ "About", Color::cyan(), nullptr, [&nav](){ nav.push<AboutView>(); } }
|
||||
});
|
||||
set_max_rows(2); // allow wider buttons
|
||||
set_arrow_enabled(false);
|
||||
|
@ -638,10 +627,10 @@ SystemView::SystemView(
|
|||
const Rect parent_rect)
|
||||
: View{parent_rect},
|
||||
context_(context) {
|
||||
set_style(&ui::Styles::white);
|
||||
set_style(&Styles::white);
|
||||
|
||||
constexpr ui::Dim status_view_height = 16;
|
||||
constexpr ui::Dim info_view_height = 16;
|
||||
constexpr Dim status_view_height = 16;
|
||||
constexpr Dim info_view_height = 16;
|
||||
|
||||
add_child(&status_view);
|
||||
status_view.set_parent_rect({{0, 0},
|
||||
|
@ -652,7 +641,7 @@ SystemView::SystemView(
|
|||
|
||||
add_child(&navigation_view);
|
||||
navigation_view.set_parent_rect({{0, status_view_height},
|
||||
{parent_rect.width(), static_cast<ui::Dim>(parent_rect.height() - status_view_height)}});
|
||||
{parent_rect.width(), static_cast<Dim>(parent_rect.height() - status_view_height)}});
|
||||
|
||||
add_child(&info_view);
|
||||
info_view.set_parent_rect({{0, 19 * 16},
|
||||
|
@ -672,17 +661,17 @@ SystemView::SystemView(
|
|||
this->status_view.set_dirty();
|
||||
};
|
||||
|
||||
// portapack::persistent_memory::set_playdead_sequence(0x8D1);
|
||||
// pmem::set_playdead_sequence(0x8D1);
|
||||
|
||||
// Initial view
|
||||
/*if ((portapack::persistent_memory::playing_dead() == 0x5920C1DF) || // Enable code
|
||||
(portapack::persistent_memory::ui_config() & 16)) { // Login option
|
||||
/*if ((pmem::playing_dead() == 0x5920C1DF) || // Enable code
|
||||
(pmem::ui_config() & 16)) { // Login option
|
||||
navigation_view.push<PlayDeadView>();
|
||||
} else {*/
|
||||
|
||||
navigation_view.push<SystemMenuView>();
|
||||
|
||||
if (portapack::persistent_memory::config_splash()) {
|
||||
if (pmem::config_splash()) {
|
||||
navigation_view.push<BMPView>();
|
||||
}
|
||||
status_view.set_back_enabled(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue