diff --git a/firmware/application/CMakeLists.txt b/firmware/application/CMakeLists.txt index 4d2a827f..fed05813 100644 --- a/firmware/application/CMakeLists.txt +++ b/firmware/application/CMakeLists.txt @@ -265,7 +265,7 @@ set(CPPSRC apps/ble_tx_app.cpp apps/capture_app.cpp apps/ert_app.cpp - apps/gps_sim_app.cpp + # apps/gps_sim_app.cpp # apps/lge_app.cpp apps/pocsag_app.cpp # apps/replay_app.cpp @@ -311,9 +311,9 @@ set(CPPSRC apps/ui_settings.cpp apps/ui_siggen.cpp apps/ui_sonde.cpp - apps/ui_spectrum_painter_image.cpp - apps/ui_spectrum_painter_text.cpp - apps/ui_spectrum_painter.cpp + # apps/ui_spectrum_painter_image.cpp + # apps/ui_spectrum_painter_text.cpp + # apps/ui_spectrum_painter.cpp apps/ui_ss_viewer.cpp apps/ui_sstvtx.cpp apps/ui_subghzd.cpp diff --git a/firmware/application/external/external.cmake b/firmware/application/external/external.cmake index b2c39770..703b2e2d 100644 --- a/firmware/application/external/external.cmake +++ b/firmware/application/external/external.cmake @@ -44,6 +44,16 @@ set(EXTCPPSRC #lcr external/jammer/main.cpp external/jammer/ui_jammer.cpp + + #gpssim + external/gpssim/main.cpp + external/gpssim/gps_sim_app.cpp + + #spainter + external/spainter/main.cpp + external/spainter/ui_spectrum_painter.cpp + external/spainter/ui_spectrum_painter_text.cpp + external/spainter/ui_spectrum_painter_image.cpp ) set(EXTAPPLIST @@ -58,4 +68,6 @@ set(EXTAPPLIST lge lcr jammer + gpssim + spainter ) diff --git a/firmware/application/external/external.ld b/firmware/application/external/external.ld index 27727f7e..2befdd93 100644 --- a/firmware/application/external/external.ld +++ b/firmware/application/external/external.ld @@ -28,6 +28,8 @@ MEMORY ram_external_app_lge(rwx) : org = 0xEEF10000, len = 32k ram_external_app_lcr(rwx) : org = 0xEEF20000, len = 32k ram_external_app_jammer(rwx) : org = 0xEEF30000, len = 32k + ram_external_app_gpssim(rwx) : org = 0xEEF40000, len = 32k + ram_external_app_spainter(rwx) : org = 0xEEF50000, len = 32k } SECTIONS @@ -88,18 +90,30 @@ SECTIONS } > ram_external_app_lge - .external_app_lcr : ALIGN(4) SUBALIGN(4) + .external_app_lcr : ALIGN(4) SUBALIGN(4) { KEEP(*(.external_app.app_lcr.application_information)); *(*ui*external_app*lcr*); } > ram_external_app_lcr - .external_app_jammer : ALIGN(4) SUBALIGN(4) + .external_app_jammer : ALIGN(4) SUBALIGN(4) { KEEP(*(.external_app.app_jammer.application_information)); *(*ui*external_app*jammer*); } > ram_external_app_jammer + .external_app_gpssim : ALIGN(4) SUBALIGN(4) + { + KEEP(*(.external_app.app_gpssim.application_information)); + *(*ui*external_app*gpssim*); + } > ram_external_app_gpssim + + + .external_app_spainter : ALIGN(4) SUBALIGN(4) + { + KEEP(*(.external_app.app_spainter.application_information)); + *(*ui*external_app*spainter*); + } > ram_external_app_spainter } diff --git a/firmware/application/apps/gps_sim_app.cpp b/firmware/application/external/gpssim/gps_sim_app.cpp similarity index 96% rename from firmware/application/apps/gps_sim_app.cpp rename to firmware/application/external/gpssim/gps_sim_app.cpp index 27b9a236..ff5e73f2 100644 --- a/firmware/application/apps/gps_sim_app.cpp +++ b/firmware/application/external/gpssim/gps_sim_app.cpp @@ -36,7 +36,7 @@ using namespace portapack; namespace fs = std::filesystem; -namespace ui { +namespace ui::external_app::gpssim { void GpsSimAppView::set_ready() { ready_signal = true; @@ -161,7 +161,8 @@ void GpsSimAppView::handle_replay_thread_done(const uint32_t return_code) { GpsSimAppView::GpsSimAppView( NavigationView& nav) : nav_(nav) { - baseband::run_image(portapack::spi_flash::image_tag_gps); + // baseband::run_image(portapack::spi_flash::image_tag_gps); + baseband::run_prepared_image(portapack::memory::map::m4_code.base()); add_children({ &button_open, @@ -211,4 +212,4 @@ void GpsSimAppView::set_parent_rect(const Rect new_parent_rect) { waterfall.set_parent_rect(waterfall_rect); } -} /* namespace ui */ +} /* namespace ui::external_app::gpssim */ diff --git a/firmware/application/apps/gps_sim_app.hpp b/firmware/application/external/gpssim/gps_sim_app.hpp similarity index 96% rename from firmware/application/apps/gps_sim_app.hpp rename to firmware/application/external/gpssim/gps_sim_app.hpp index 7d48d5eb..5efb3493 100644 --- a/firmware/application/apps/gps_sim_app.hpp +++ b/firmware/application/external/gpssim/gps_sim_app.hpp @@ -25,6 +25,7 @@ #define __GPS_SIM_APP_HPP__ #include "app_settings.hpp" +#include "ui_language.hpp" #include "radio_state.hpp" #include "ui_widget.hpp" #include "ui_navigation.hpp" @@ -37,7 +38,7 @@ #include #include -namespace ui { +namespace ui::external_app::gpssim { class GpsSimAppView : public View { public: @@ -108,7 +109,7 @@ class GpsSimAppView : public View { Checkbox check_loop{ {21 * 8, 2 * 16}, 4, - "Loop", + LanguageHelper::currentMessages[LANG_LOOP], true}; ImageButton button_play{ {28 * 8, 2 * 16, 2 * 8, 1 * 16}, @@ -142,6 +143,6 @@ class GpsSimAppView : public View { }}; }; -} /* namespace ui */ +} /* namespace ui::external_app::gpssim */ #endif /*__GPS_SIM_APP_HPP__*/ diff --git a/firmware/application/external/gpssim/main.cpp b/firmware/application/external/gpssim/main.cpp new file mode 100644 index 00000000..ebcfdd07 --- /dev/null +++ b/firmware/application/external/gpssim/main.cpp @@ -0,0 +1,82 @@ +/* + * 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 "gps_sim_app.hpp" +#include "ui_navigation.hpp" +#include "external_app.hpp" + +namespace ui::external_app::gpssim { +void initialize_app(ui::NavigationView& nav) { + nav.push(); +} +} // namespace ui::external_app::gpssim + +extern "C" { + +__attribute__((section(".external_app.app_gpssim.application_information"), used)) application_information_t _application_information_gpssim = { + /*.memory_location = */ (uint8_t*)0x00000000, + /*.externalAppEntry = */ ui::external_app::gpssim::initialize_app, + /*.header_version = */ CURRENT_HEADER_VERSION, + /*.app_version = */ VERSION_MD5, + + /*.app_name = */ "GPSSim", + /*.bitmap_data = */ { + 0xC0, + 0x07, + 0xE0, + 0x0F, + 0x70, + 0x1F, + 0x78, + 0x3E, + 0x78, + 0x3C, + 0x78, + 0x38, + 0x78, + 0x30, + 0x78, + 0x38, + 0x78, + 0x3C, + 0x70, + 0x1E, + 0x70, + 0x1F, + 0xE0, + 0x0F, + 0xC0, + 0x07, + 0x80, + 0x03, + 0x20, + 0x09, + 0x50, + 0x14, + }, + /*.icon_color = */ ui::Color::green().v, + /*.menu_location = */ app_location_t::TX, + + /*.m4_app_tag = portapack::spi_flash::image_tag_gpssim */ {'P', 'G', 'P', 'S'}, + /*.m4_app_offset = */ 0x00000000, // will be filled at compile time +}; +} diff --git a/firmware/application/external/spainter/main.cpp b/firmware/application/external/spainter/main.cpp new file mode 100644 index 00000000..e9678fdd --- /dev/null +++ b/firmware/application/external/spainter/main.cpp @@ -0,0 +1,82 @@ +/* + * 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_spectrum_painter.hpp" +#include "ui_navigation.hpp" +#include "external_app.hpp" + +namespace ui::external_app::spainter { +void initialize_app(ui::NavigationView& nav) { + nav.push(); +} +} // namespace ui::external_app::spainter + +extern "C" { + +__attribute__((section(".external_app.app_spainter.application_information"), used)) application_information_t _application_information_spainter = { + /*.memory_location = */ (uint8_t*)0x00000000, + /*.externalAppEntry = */ ui::external_app::spainter::initialize_app, + /*.header_version = */ CURRENT_HEADER_VERSION, + /*.app_version = */ VERSION_MD5, + + /*.app_name = */ "S.Painter", + /*.bitmap_data = */ { + 0xFE, + 0x3F, + 0xFF, + 0x3F, + 0xFF, + 0xFF, + 0xFF, + 0xBF, + 0xFE, + 0xBF, + 0x00, + 0x80, + 0x80, + 0xFF, + 0x80, + 0x00, + 0x80, + 0x00, + 0xC0, + 0x01, + 0xC0, + 0x01, + 0xC0, + 0x01, + 0xC0, + 0x01, + 0xC0, + 0x01, + 0xC0, + 0x01, + 0xC0, + 0x01, + }, + /*.icon_color = */ ui::Color::orange().v, + /*.menu_location = */ app_location_t::TX, + + /*.m4_app_tag = portapack::spi_flash::image_tag_spainter */ {'P', 'S', 'P', 'T'}, + /*.m4_app_offset = */ 0x00000000, // will be filled at compile time +}; +} diff --git a/firmware/application/apps/ui_spectrum_painter.cpp b/firmware/application/external/spainter/ui_spectrum_painter.cpp similarity index 96% rename from firmware/application/apps/ui_spectrum_painter.cpp rename to firmware/application/external/spainter/ui_spectrum_painter.cpp index 324232c0..8b680b5f 100644 --- a/firmware/application/apps/ui_spectrum_painter.cpp +++ b/firmware/application/external/spainter/ui_spectrum_painter.cpp @@ -31,12 +31,13 @@ using namespace portapack; -namespace ui { +namespace ui::external_app::spainter { SpectrumPainterView::SpectrumPainterView( NavigationView& nav) : nav_(nav) { - baseband::run_image(spi_flash::image_tag_spectrum_painter); + // baseband::run_image(spi_flash::image_tag_spectrum_painter); + baseband::run_prepared_image(portapack::memory::map::m4_code.base()); add_children({ &labels, @@ -198,4 +199,4 @@ void SpectrumPainterView::paint(Painter& painter) { } } -} // namespace ui +} // namespace ui::external_app::spainter diff --git a/firmware/application/apps/ui_spectrum_painter.hpp b/firmware/application/external/spainter/ui_spectrum_painter.hpp similarity index 96% rename from firmware/application/apps/ui_spectrum_painter.hpp rename to firmware/application/external/spainter/ui_spectrum_painter.hpp index 6edd92ee..40f3939c 100644 --- a/firmware/application/apps/ui_spectrum_painter.hpp +++ b/firmware/application/external/spainter/ui_spectrum_painter.hpp @@ -22,6 +22,7 @@ #pragma once #include "ui.hpp" +#include "ui_language.hpp" #include "ui_widget.hpp" #include "ui_navigation.hpp" @@ -37,7 +38,7 @@ #include "ui_spectrum_painter_image.hpp" #include "ui_spectrum_painter_text.hpp" -namespace ui { +namespace ui::external_app::spainter { class SpectrumPainterView : public View { public: @@ -115,7 +116,7 @@ class SpectrumPainterView : public View { Checkbox check_loop{ {21 * 8, footer_location + 1 * 16}, 4, - "Loop", + LanguageHelper::currentMessages[LANG_LOOP], true}; ImageButton button_play{ @@ -163,4 +164,4 @@ class SpectrumPainterView : public View { }}; }; -} // namespace ui +} // namespace ui::external_app::spainter diff --git a/firmware/application/apps/ui_spectrum_painter_image.cpp b/firmware/application/external/spainter/ui_spectrum_painter_image.cpp similarity index 98% rename from firmware/application/apps/ui_spectrum_painter_image.cpp rename to firmware/application/external/spainter/ui_spectrum_painter_image.cpp index 4a788443..5f26ec86 100644 --- a/firmware/application/apps/ui_spectrum_painter_image.cpp +++ b/firmware/application/external/spainter/ui_spectrum_painter_image.cpp @@ -29,7 +29,7 @@ #include "file.hpp" #include "portapack_persistent_memory.hpp" -namespace ui { +namespace ui::external_app::spainter { SpectrumInputImageView::SpectrumInputImageView(NavigationView& nav) { hidden(true); @@ -254,4 +254,4 @@ void SpectrumInputImageView::paint(Painter& painter) { } } -} // namespace ui +} // namespace ui::external_app::spainter diff --git a/firmware/application/apps/ui_spectrum_painter_image.hpp b/firmware/application/external/spainter/ui_spectrum_painter_image.hpp similarity index 95% rename from firmware/application/apps/ui_spectrum_painter_image.hpp rename to firmware/application/external/spainter/ui_spectrum_painter_image.hpp index 42778efa..d4ae6cd9 100644 --- a/firmware/application/apps/ui_spectrum_painter_image.hpp +++ b/firmware/application/external/spainter/ui_spectrum_painter_image.hpp @@ -32,7 +32,7 @@ #include "portapack.hpp" #include "message.hpp" -namespace ui { +namespace ui::external_app::spainter { class SpectrumInputImageView : public View { public: @@ -63,4 +63,4 @@ class SpectrumInputImageView : public View { bool drawBMP_scaled(const ui::Rect r, const std::string file); }; -} // namespace ui +} // namespace ui::external_app::spainter diff --git a/firmware/application/apps/ui_spectrum_painter_text.cpp b/firmware/application/external/spainter/ui_spectrum_painter_text.cpp similarity index 97% rename from firmware/application/apps/ui_spectrum_painter_text.cpp rename to firmware/application/external/spainter/ui_spectrum_painter_text.cpp index 114d7289..8d271097 100644 --- a/firmware/application/apps/ui_spectrum_painter_text.cpp +++ b/firmware/application/external/spainter/ui_spectrum_painter_text.cpp @@ -30,7 +30,7 @@ #include "file.hpp" #include "portapack_persistent_memory.hpp" -namespace ui { +namespace ui::external_app::spainter { SpectrumInputTextView::SpectrumInputTextView(NavigationView& nav) { hidden(true); @@ -105,4 +105,4 @@ std::vector SpectrumInputTextView::get_line(uint16_t y) { return data; } -} // namespace ui +} // namespace ui::external_app::spainter diff --git a/firmware/application/apps/ui_spectrum_painter_text.hpp b/firmware/application/external/spainter/ui_spectrum_painter_text.hpp similarity index 96% rename from firmware/application/apps/ui_spectrum_painter_text.hpp rename to firmware/application/external/spainter/ui_spectrum_painter_text.hpp index d7086a16..5a3859ce 100644 --- a/firmware/application/apps/ui_spectrum_painter_text.hpp +++ b/firmware/application/external/spainter/ui_spectrum_painter_text.hpp @@ -32,7 +32,7 @@ #include "portapack.hpp" #include "message.hpp" -namespace ui { +namespace ui::external_app::spainter { class SpectrumInputTextView : public View { public: @@ -109,4 +109,4 @@ class SpectrumInputTextView : public View { "Set message"}; }; -} // namespace ui +} // namespace ui::external_app::spainter diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index ef1ee11e..99be1b34 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -70,7 +70,7 @@ #include "ui_settings.hpp" #include "ui_siggen.hpp" #include "ui_sonde.hpp" -#include "ui_spectrum_painter.hpp" +// #include "ui_spectrum_painter.hpp" //moved to ext app #include "ui_ss_viewer.hpp" #include "ui_sstvtx.hpp" #include "ui_styles.hpp" @@ -93,7 +93,7 @@ #include "ble_tx_app.hpp" #include "capture_app.hpp" #include "ert_app.hpp" -#include "gps_sim_app.hpp" +// #include "gps_sim_app.hpp" //moved to ext // #include "lge_app.hpp" //moved to ext #include "pocsag_app.hpp" #include "replay_app.hpp" @@ -607,7 +607,7 @@ TransmittersMenuView::TransmittersMenuView(NavigationView& nav) { {"BHT Xy/EP", ui::Color::green(), &bitmap_icon_bht, [&nav]() { nav.push(); }}, {"BLE Tx", ui::Color::green(), &bitmap_icon_btle, [&nav]() { nav.push(); }}, // {"BurgerPgr", ui::Color::yellow(), &bitmap_icon_burger, [&nav]() { nav.push(); }}, //moved to ext - {"GPS Sim", ui::Color::green(), &bitmap_icon_gps_sim, [&nav]() { nav.push(); }}, + //{"GPS Sim", ui::Color::green(), &bitmap_icon_gps_sim, [&nav]() { nav.push(); }}, //moved to ext //{"Jammer", ui::Color::green(), &bitmap_icon_jammer, [&nav]() { nav.push(); }}, //moved to ext // { "Key fob", ui::Color::orange(), &bitmap_icon_keyfob, [&nav](){ nav.push(); }}, // {"LGE", ui::Color::yellow(), &bitmap_icon_lge, [&nav]() { nav.push(); }}, //moved to ext @@ -617,7 +617,7 @@ TransmittersMenuView::TransmittersMenuView(NavigationView& nav) { {"POCSAG TX", ui::Color::green(), &bitmap_icon_pocsag, [&nav]() { nav.push(); }}, {"RDS", ui::Color::green(), &bitmap_icon_rds, [&nav]() { nav.push(); }}, {"Soundbrd", ui::Color::green(), &bitmap_icon_soundboard, [&nav]() { nav.push(); }}, - {"S.Painter", ui::Color::orange(), &bitmap_icon_paint, [&nav]() { nav.push(); }}, + //{"S.Painter", ui::Color::orange(), &bitmap_icon_paint, [&nav]() { nav.push(); }}, {"SSTV", ui::Color::green(), &bitmap_icon_sstv, [&nav]() { nav.push(); }}, // {"TEDI/LCR", ui::Color::yellow(), &bitmap_icon_lcr, [&nav]() { nav.push(); }}, //moved to ext {"TouchTune", ui::Color::green(), &bitmap_icon_touchtunes, [&nav]() { nav.push(); }}, diff --git a/firmware/baseband/CMakeLists.txt b/firmware/baseband/CMakeLists.txt index 65051262..8357c6cb 100644 --- a/firmware/baseband/CMakeLists.txt +++ b/firmware/baseband/CMakeLists.txt @@ -476,13 +476,6 @@ set(MODE_CPPSRC ) DeclareTargets(PREP replay) -### GPS Simulator - -set(MODE_CPPSRC - proc_gps_sim.cpp -) -DeclareTargets(PGPS gps_sim) - ### Signal generator set(MODE_CPPSRC @@ -490,12 +483,6 @@ set(MODE_CPPSRC ) DeclareTargets(PSIG siggen) -### Spectrum painter - -set(MODE_CPPSRC - proc_spectrum_painter.cpp -) -DeclareTargets(PSPT spectrum_painter) ### SSTV TX @@ -637,6 +624,20 @@ set(MODE_CPPSRC ) DeclareTargets(PAMT am_tv) +### GPS Simulator + +set(MODE_CPPSRC + proc_gps_sim.cpp +) +DeclareTargets(PGPS gps_sim) + +### Spectrum painter + +set(MODE_CPPSRC + proc_spectrum_painter.cpp +) +DeclareTargets(PSPT spectrum_painter) + ### Test set(MODE_CPPSRC diff --git a/firmware/common/ui_language.cpp b/firmware/common/ui_language.cpp index c3199010..0d625e64 100644 --- a/firmware/common/ui_language.cpp +++ b/firmware/common/ui_language.cpp @@ -1,6 +1,6 @@ #include "ui_language.hpp" -const char* LanguageHelper::englishMessages[] = {"OK", "Cancel", "Error", "Modem setup", "Debug", "Log", "Done", "Start", "Stop", "Scan", "Clear", "Ready", "Data:"}; +const char* LanguageHelper::englishMessages[] = {"OK", "Cancel", "Error", "Modem setup", "Debug", "Log", "Done", "Start", "Stop", "Scan", "Clear", "Ready", "Data:", "Loop"}; const char** LanguageHelper::currentMessages = englishMessages; diff --git a/firmware/common/ui_language.hpp b/firmware/common/ui_language.hpp index cec801cf..caa03950 100644 --- a/firmware/common/ui_language.hpp +++ b/firmware/common/ui_language.hpp @@ -18,7 +18,8 @@ enum LangConsts { LANG_SCAN, LANG_CLEAR, LANG_READY, - LANG_DATADP + LANG_DATADP, + LANG_LOOP }; class LanguageHelper {