diff --git a/firmware/application/CMakeLists.txt b/firmware/application/CMakeLists.txt index 92e5c21ee..d53e7c796 100644 --- a/firmware/application/CMakeLists.txt +++ b/firmware/application/CMakeLists.txt @@ -293,7 +293,6 @@ set(CPPSRC apps/ui_flash_utility.cpp apps/ui_freqman.cpp apps/ui_iq_trim.cpp - apps/ui_level.cpp apps/ui_looking_glass_app.cpp apps/ui_mictx.cpp apps/ui_modemsetup.cpp @@ -302,7 +301,6 @@ set(CPPSRC apps/ui_rds.cpp apps/ui_recon_settings.cpp apps/ui_recon.cpp -# apps/ui_scanner.cpp apps/ui_sd_over_usb.cpp apps/ui_search.cpp apps/ui_settings.cpp diff --git a/firmware/application/apps/ui_recon.cpp b/firmware/application/apps/ui_recon.cpp index 88320d63d..e158abc49 100644 --- a/firmware/application/apps/ui_recon.cpp +++ b/firmware/application/apps/ui_recon.cpp @@ -517,11 +517,7 @@ ReconView::ReconView(NavigationView& nav) }; set_loop_config(continuous); - rssi.set_focusable(true); rssi.set_peak(true, 500); - rssi.on_select = [this](RSSI&) { - nav_.replace(); - }; // TODO: *BUG* Both transmitter_model and receiver_model share the same pmem setting for target_frequency. button_mic_app.on_select = [this](Button&) { diff --git a/firmware/application/apps/ui_recon.hpp b/firmware/application/apps/ui_recon.hpp index fa310770f..a127801c8 100644 --- a/firmware/application/apps/ui_recon.hpp +++ b/firmware/application/apps/ui_recon.hpp @@ -31,7 +31,6 @@ #include "analog_audio_app.hpp" #include "audio.hpp" #include "ui_mictx.hpp" -#include "ui_level.hpp" #include "ui_looking_glass_app.hpp" #include "portapack_persistent_memory.hpp" #include "baseband_api.hpp" diff --git a/firmware/application/external/external.cmake b/firmware/application/external/external.cmake index cb919f43d..f944d85c2 100644 --- a/firmware/application/external/external.cmake +++ b/firmware/application/external/external.cmake @@ -192,14 +192,17 @@ set(EXTCPPSRC external/doom/main.cpp external/doom/ui_doom.cpp - #scanner - external/scanner/main.cpp - external/scanner/ui_scanner.cpp - #debug_pmem external/debug_pmem/main.cpp external/debug_pmem/ui_debug_pmem.cpp + #scanner + external/scanner/main.cpp + external/scanner/ui_scanner.cpp + + #level + external/level/main.cpp + external/level/ui_level.cpp ) set(EXTAPPLIST @@ -249,6 +252,7 @@ set(EXTAPPLIST stopwatch breakout doom - debug_pmem + debug_pmem scanner + level ) diff --git a/firmware/application/external/external.ld b/firmware/application/external/external.ld index 7c4152613..5b83ae36a 100644 --- a/firmware/application/external/external.ld +++ b/firmware/application/external/external.ld @@ -71,6 +71,7 @@ MEMORY ram_external_app_doom (rwx) : org = 0xADDE0000, len = 32k ram_external_app_debug_pmem (rwx) : org = 0xADDF0000, len = 32k ram_external_app_scanner (rwx) : org = 0xADE00000, len = 32k + ram_external_app_level (rwx) : org = 0xADE10000, len = 32k } SECTIONS @@ -362,4 +363,9 @@ SECTIONS *(*ui*external_app*scanner*); } > ram_external_app_scanner + .external_app_level : ALIGN(4) SUBALIGN(4) + { + KEEP(*(.external_app.app_level.application_information)); + *(*ui*external_app*level*); + } > ram_external_app_level } diff --git a/firmware/application/external/level/main.cpp b/firmware/application/external/level/main.cpp new file mode 100644 index 000000000..4f75911d5 --- /dev/null +++ b/firmware/application/external/level/main.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2023 Bernd Herzog + * + * This file is part of PortaPack. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#include "ui.hpp" +#include "ui_level.hpp" +#include "ui_navigation.hpp" +#include "external_app.hpp" + +namespace ui::external_app::level { +void initialize_app(ui::NavigationView& nav) { + nav.push(); +} +} // namespace ui::external_app::level + +extern "C" { + +__attribute__((section(".external_app.app_level.application_information"), used)) application_information_t _application_information_level = { + /*.memory_location = */ (uint8_t*)0x00000000, + /*.externalAppEntry = */ ui::external_app::level::initialize_app, + /*.header_version = */ CURRENT_HEADER_VERSION, + /*.app_version = */ VERSION_MD5, + + /*.app_name = */ "Level", + /*.bitmap_data = */ + { + 0x00, + 0x00, + 0x00, + 0x00, + 0x04, + 0x20, + 0x12, + 0x48, + 0x8A, + 0x51, + 0xCA, + 0x53, + 0xCA, + 0x53, + 0x8A, + 0x51, + 0x12, + 0x48, + 0x84, + 0x21, + 0xC0, + 0x03, + 0x40, + 0x02, + 0x60, + 0x06, + 0x20, + 0x04, + 0x30, + 0x0C, + 0xF0, + 0x0F}, + /*.icon_color = */ ui::Color::green().v, + /*.menu_location = */ app_location_t::RX, + /*.desired_menu_position = */ -1, + + // this has to be the biggest baseband used by the app. Level is using AM,WFM,NFM,AMFM,SPEC and NFM is the biggest + /*.m4_app_tag = portapack::spi_flash::image_tag_nfm */ {'P', 'N', 'F', 'M'}, + /*.m4_app_offset = */ 0x00000000, // will be filled at compile time +}; +} diff --git a/firmware/application/apps/ui_level.cpp b/firmware/application/external/level/ui_level.cpp similarity index 99% rename from firmware/application/apps/ui_level.cpp rename to firmware/application/external/level/ui_level.cpp index 303fbeb42..375811e35 100644 --- a/firmware/application/apps/ui_level.cpp +++ b/firmware/application/external/level/ui_level.cpp @@ -33,7 +33,7 @@ using namespace portapack; using namespace tonekey; using portapack::memory::map::backup_ram; -namespace ui { +namespace ui::external_app::level { // Function to map the value from one range to another int32_t LevelView::map(int32_t value, int32_t fromLow, int32_t fromHigh, int32_t toLow, int32_t toHigh) { @@ -338,4 +338,4 @@ void LevelView::on_freqchg(int64_t freq) { button_frequency.set_text("<" + to_string_short_freq(freq) + " MHz>"); } -} /* namespace ui */ +} // namespace ui::external_app::level diff --git a/firmware/application/apps/ui_level.hpp b/firmware/application/external/level/ui_level.hpp similarity index 98% rename from firmware/application/apps/ui_level.hpp rename to firmware/application/external/level/ui_level.hpp index b2d03b3ef..d6ef23719 100644 --- a/firmware/application/apps/ui_level.hpp +++ b/firmware/application/external/level/ui_level.hpp @@ -39,7 +39,7 @@ #include "ui_receiver.hpp" #include "ui_spectrum.hpp" -namespace ui { +namespace ui::external_app::level { class LevelView : public View { public: @@ -211,6 +211,6 @@ class LevelView : public View { }}; }; -} /* namespace ui */ +} // namespace ui::external_app::level #endif diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 61c0b1b7b..270a09210 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -42,7 +42,6 @@ #include "ui_font_fixed_8x16.hpp" #include "ui_freqman.hpp" #include "ui_iq_trim.hpp" -#include "ui_level.hpp" #include "ui_looking_glass_app.hpp" #include "ui_mictx.hpp" @@ -131,22 +130,13 @@ const NavigationView::AppList NavigationView::appList = { {"ais", "AIS Boats", RX, Color::green(), &bitmap_icon_ais, new ViewFactory()}, {"aprsrx", "APRS", RX, Color::green(), &bitmap_icon_aprs, new ViewFactory()}, {"audio", "Audio", RX, Color::green(), &bitmap_icon_speaker, new ViewFactory()}, - //{"blecomm", "BLE Comm", RX, ui::Color::orange(), &bitmap_icon_btle, new ViewFactory()}, {"blerx", "BLE Rx", RX, Color::green(), &bitmap_icon_btle, new ViewFactory()}, {"ert", "ERT Meter", RX, Color::green(), &bitmap_icon_ert, new ViewFactory()}, - {"level", "Level", RX, Color::green(), &bitmap_icon_options_radio, new ViewFactory()}, {"pocsag", "POCSAG", RX, Color::green(), &bitmap_icon_pocsag, new ViewFactory()}, {"radiosonde", "Radiosnde", RX, Color::green(), &bitmap_icon_sonde, new ViewFactory()}, - // {"scanner", "Scanner", RX, Color::green(), &bitmap_icon_scanner, new ViewFactory()}, {"search", "Search", RX, Color::yellow(), &bitmap_icon_search, new ViewFactory()}, {"subghzd", "SubGhzD", RX, Color::yellow(), &bitmap_icon_remote, new ViewFactory()}, {"weather", "Weather", RX, Color::green(), &bitmap_icon_thermometer, new ViewFactory()}, - //{"fskrx", "FSK RX", RX, Color::yellow(), &bitmap_icon_remote, new ViewFactory()}, //for JT - //{"dmr", "DMR", RX, Color::dark_grey(), &bitmap_icon_dmr, new ViewFactory()}, - //{"sigfox", "SIGFOX", RX, Color::dark_grey(), &bitmap_icon_fox, new ViewFactory()}, - //{"lora", "LoRa", RX, Color::dark_grey(), &bitmap_icon_lora, new ViewFactory()}, - //{"sstv", "SSTV", RX, Color::dark_grey(), &bitmap_icon_sstv, new ViewFactory()}, - //{"tetra", "TETRA", RX, Color::dark_grey(), &bitmap_icon_tetra, new ViewFactory()}, /* TX ********************************************************************/ {"aprstx", "APRS TX", TX, ui::Color::green(), &bitmap_icon_aprs, new ViewFactory()}, {"bht", "BHT Xy/EP", TX, ui::Color::green(), &bitmap_icon_bht, new ViewFactory()},