From ecff2c128e0dd49a43d6ef7560c2827585e3533c Mon Sep 17 00:00:00 2001 From: Totoo Date: Fri, 20 Sep 2024 15:41:44 +0200 Subject: [PATCH] SSTV TX to ext (#2254) * SSTV TX to ext --- firmware/application/CMakeLists.txt | 2 +- firmware/application/external/external.cmake | 6 +- firmware/application/external/external.ld | 8 ++ firmware/application/external/sstvtx/main.cpp | 82 +++++++++++++++++++ .../{apps => external/sstvtx}/ui_sstvtx.cpp | 7 +- .../{apps => external/sstvtx}/ui_sstvtx.hpp | 4 +- firmware/application/ui_navigation.cpp | 4 +- firmware/baseband/CMakeLists.txt | 12 +-- 8 files changed, 110 insertions(+), 15 deletions(-) create mode 100644 firmware/application/external/sstvtx/main.cpp rename firmware/application/{apps => external/sstvtx}/ui_sstvtx.cpp (97%) rename firmware/application/{apps => external/sstvtx}/ui_sstvtx.hpp (97%) diff --git a/firmware/application/CMakeLists.txt b/firmware/application/CMakeLists.txt index 691da5829..01a3f4033 100644 --- a/firmware/application/CMakeLists.txt +++ b/firmware/application/CMakeLists.txt @@ -326,7 +326,7 @@ set(CPPSRC # apps/ui_spectrum_painter_text.cpp # apps/ui_spectrum_painter.cpp apps/ui_ss_viewer.cpp - apps/ui_sstvtx.cpp + # apps/ui_sstvtx.cpp #moved to ext apps/ui_standalone_view.cpp apps/ui_subghzd.cpp # apps/ui_test.cpp diff --git a/firmware/application/external/external.cmake b/firmware/application/external/external.cmake index 43791dca8..8bc794ec6 100644 --- a/firmware/application/external/external.cmake +++ b/firmware/application/external/external.cmake @@ -89,10 +89,13 @@ set(EXTCPPSRC external/adsbtx/main.cpp external/adsbtx/ui_adsb_tx.cpp - #morse_tx external/morse_tx/main.cpp external/morse_tx/ui_morse.cpp + + #sstvtx + external/sstvtx/main.cpp + external/sstvtx/ui_sstvtx.cpp ) set(EXTAPPLIST @@ -118,4 +121,5 @@ set(EXTAPPLIST protoview adsbtx morse_tx + sstvtx ) diff --git a/firmware/application/external/external.ld b/firmware/application/external/external.ld index 7c574eb10..932c76a65 100644 --- a/firmware/application/external/external.ld +++ b/firmware/application/external/external.ld @@ -45,6 +45,7 @@ MEMORY ram_external_app_protoview(rwx) : org = 0xADC40000, len = 32k ram_external_app_adsbtx(rwx) : org = 0xADC50000, len = 32k ram_external_app_morse_tx(rwx) : org = 0xADC60000, len = 32k + ram_external_app_sstvtx(rwx) : org = 0xADC70000, len = 32k } SECTIONS @@ -183,5 +184,12 @@ SECTIONS *(*ui*external_app*morse_tx*); } > ram_external_app_morse_tx + .external_app_sstvtx : ALIGN(4) SUBALIGN(4) + { + KEEP(*(.external_app.app_sstvtx.application_information)); + *(*ui*external_app*sstvtx*); + } > ram_external_app_sstvtx + + } diff --git a/firmware/application/external/sstvtx/main.cpp b/firmware/application/external/sstvtx/main.cpp new file mode 100644 index 000000000..6a842ffcd --- /dev/null +++ b/firmware/application/external/sstvtx/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_sstvtx.hpp" +#include "ui_navigation.hpp" +#include "external_app.hpp" + +namespace ui::external_app::sstvtx { +void initialize_app(ui::NavigationView& nav) { + nav.push(); +} +} // namespace ui::external_app::sstvtx + +extern "C" { + +__attribute__((section(".external_app.app_sstvtx.application_information"), used)) application_information_t _application_information_sstvtx = { + /*.memory_location = */ (uint8_t*)0x00000000, + /*.externalAppEntry = */ ui::external_app::sstvtx::initialize_app, + /*.header_version = */ CURRENT_HEADER_VERSION, + /*.app_version = */ VERSION_MD5, + + /*.app_name = */ "SSTV", + /*.bitmap_data = */ { + 0x00, + 0x00, + 0x00, + 0x00, + 0xFE, + 0x7F, + 0x03, + 0xC0, + 0x53, + 0xD5, + 0xAB, + 0xCA, + 0x53, + 0xD5, + 0xAB, + 0xCA, + 0x53, + 0xD5, + 0xAB, + 0xCA, + 0x53, + 0xD5, + 0x03, + 0xC0, + 0xFF, + 0xFF, + 0xFB, + 0xD7, + 0xFE, + 0x7F, + 0x00, + 0x00, + }, + /*.icon_color = */ ui::Color::green().v, + /*.menu_location = */ app_location_t::TX, + + /*.m4_app_tag = portapack::spi_flash::image_tag_sstvtx */ {'P', 'S', 'T', 'X'}, + /*.m4_app_offset = */ 0x00000000, // will be filled at compile time +}; +} diff --git a/firmware/application/apps/ui_sstvtx.cpp b/firmware/application/external/sstvtx/ui_sstvtx.cpp similarity index 97% rename from firmware/application/apps/ui_sstvtx.cpp rename to firmware/application/external/sstvtx/ui_sstvtx.cpp index d6e8ca084..20d6e50ee 100644 --- a/firmware/application/apps/ui_sstvtx.cpp +++ b/firmware/application/external/sstvtx/ui_sstvtx.cpp @@ -31,7 +31,7 @@ using namespace portapack; -namespace ui { +namespace ui::external_app::sstvtx { void SSTVTXView::focus() { if (file_error) @@ -232,7 +232,8 @@ SSTVTXView::SSTVTXView( // Maybe this could be merged with proc_tones ? Pretty much the same except lots // of different tones (256+) - baseband::run_image(portapack::spi_flash::image_tag_sstv_tx); + // baseband::run_image(portapack::spi_flash::image_tag_sstv_tx); + baseband::run_prepared_image(portapack::memory::map::m4_code.base()); add_children({&labels, &options_bitmaps, @@ -283,4 +284,4 @@ SSTVTXView::SSTVTXView( }; } -} /* namespace ui */ +} // namespace ui::external_app::sstvtx diff --git a/firmware/application/apps/ui_sstvtx.hpp b/firmware/application/external/sstvtx/ui_sstvtx.hpp similarity index 97% rename from firmware/application/apps/ui_sstvtx.hpp rename to firmware/application/external/sstvtx/ui_sstvtx.hpp index 72f9734fb..f28c49617 100644 --- a/firmware/application/apps/ui_sstvtx.hpp +++ b/firmware/application/external/sstvtx/ui_sstvtx.hpp @@ -38,7 +38,7 @@ using namespace sstv; -namespace ui { +namespace ui::external_app::sstvtx { class SSTVTXView : public View { public: @@ -110,6 +110,6 @@ class SSTVTXView : public View { }}; }; -} /* namespace ui */ +} /* namespace ui::external_app::sstvtx */ #endif /*__UI_SSTVTX_H__*/ diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index b7f99cefc..2a56de17b 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -74,7 +74,7 @@ #include "ui_sonde.hpp" // #include "ui_spectrum_painter.hpp" //moved to ext app #include "ui_ss_viewer.hpp" -#include "ui_sstvtx.hpp" +// #include "ui_sstvtx.hpp" //moved to ext // #include "ui_test.hpp" #include "ui_text_editor.hpp" #include "ui_tone_search.hpp" @@ -191,7 +191,7 @@ const NavigationView::AppList NavigationView::appList = { {"pocsagtx", "POCSAG TX", TX, ui::Color::green(), &bitmap_icon_pocsag, new ViewFactory()}, {"rdstx", "RDS", TX, ui::Color::green(), &bitmap_icon_rds, new ViewFactory()}, {"soundbrd", "Soundbrd", TX, ui::Color::green(), &bitmap_icon_soundboard, new ViewFactory()}, - {"sstvtx", "SSTV", TX, ui::Color::green(), &bitmap_icon_sstv, new ViewFactory()}, + //{"sstvtx", "SSTV", TX, ui::Color::green(), &bitmap_icon_sstv, new ViewFactory()}, //moved to ext {"touchtune", "TouchTune", TX, ui::Color::green(), &bitmap_icon_touchtunes, new ViewFactory()}, /* UTILITIES *************************************************************/ {"antennalength", "Antenna Length", UTILITIES, Color::green(), &bitmap_icon_tools_antenna, new ViewFactory()}, diff --git a/firmware/baseband/CMakeLists.txt b/firmware/baseband/CMakeLists.txt index 6f6adca63..990dc8fa6 100644 --- a/firmware/baseband/CMakeLists.txt +++ b/firmware/baseband/CMakeLists.txt @@ -480,12 +480,6 @@ set(MODE_CPPSRC DeclareTargets(PSIG siggen) -### SSTV TX - -set(MODE_CPPSRC - proc_sstvtx.cpp -) -DeclareTargets(PSTX sstvtx) ### Tones @@ -650,6 +644,12 @@ set(MODE_CPPSRC DeclareTargets(PPVW protoview) +### SSTV TX + +set(MODE_CPPSRC + proc_sstvtx.cpp +) +DeclareTargets(PSTX sstvtx) ### TPMS