From 838a8de5d062f5228516979f29e84d03d3ed5341 Mon Sep 17 00:00:00 2001 From: Belousov Oleg Date: Mon, 27 Jul 2026 21:18:01 +0300 Subject: [PATCH] Move ADS-B receiver to external app --- firmware/application/CMakeLists.txt | 3 +- firmware/application/external/adsbrx/main.cpp | 57 +++++++++++++++++++ .../{apps => external/adsbrx}/ui_adsb_rx.cpp | 16 +++++- .../{apps => external/adsbrx}/ui_adsb_rx.hpp | 4 +- firmware/application/external/external.cmake | 6 +- firmware/application/external/external.ld | 7 +++ firmware/application/ui_navigation.cpp | 2 - firmware/tools/external_app_info.py | 2 +- 8 files changed, 86 insertions(+), 11 deletions(-) create mode 100644 firmware/application/external/adsbrx/main.cpp rename firmware/application/{apps => external/adsbrx}/ui_adsb_rx.cpp (98%) rename firmware/application/{apps => external/adsbrx}/ui_adsb_rx.hpp (99%) diff --git a/firmware/application/CMakeLists.txt b/firmware/application/CMakeLists.txt index dc642cfbb..64edcd517 100644 --- a/firmware/application/CMakeLists.txt +++ b/firmware/application/CMakeLists.txt @@ -286,7 +286,6 @@ set(CPPSRC apps/capture_app.cpp apps/pocsag_app.cpp apps/ui_about_simple.cpp - apps/ui_adsb_rx.cpp apps/ui_aprs_rx.cpp apps/ui_aprs_tx.cpp apps/ui_battinfo.cpp @@ -513,4 +512,4 @@ add_custom_target( DEPENDS ${PROJECT_NAME}.bin ) -add_dependencies(${PROJECT_NAME} baseband) \ No newline at end of file +add_dependencies(${PROJECT_NAME} baseband) diff --git a/firmware/application/external/adsbrx/main.cpp b/firmware/application/external/adsbrx/main.cpp new file mode 100644 index 000000000..45ee0f0b2 --- /dev/null +++ b/firmware/application/external/adsbrx/main.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2026 PortaPack Mayhem + * + * 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_adsb_rx.hpp" +#include "ui_navigation.hpp" +#include "external_app.hpp" + +namespace ui::external_app::adsbrx { + +void initialize_app(ui::NavigationView& nav) { + nav.push(); +} + +} // namespace ui::external_app::adsbrx + +extern "C" { + +__attribute__((section(".external_app.app_adsbrx.application_information"), used)) application_information_t _application_information_adsbrx = { + /*.memory_location = */ (uint8_t*)0x00000000, + /*.externalAppEntry = */ ui::external_app::adsbrx::initialize_app, + /*.header_version = */ CURRENT_HEADER_VERSION, + /*.app_version = */ VERSION_MD5, + + /*.app_name = */ "ADS-B", + /*.bitmap_data = */ { + 0x80, 0x01, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x03, + 0xC0, 0x03, 0xE0, 0x07, 0xF8, 0x1F, 0xFE, 0x7F, + 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x03, 0xC0, 0x03, + 0xC0, 0x03, 0xE0, 0x07, 0xF0, 0x0F, 0xF8, 0x1F, + }, + /*.icon_color = */ ui::Color::green().v, + /*.menu_location = */ app_location_t::RX, + /*.desired_menu_position = */ -1, + + /*.m4_app_tag = portapack::spi_flash::image_tag_adsbrx */ {'P', 'A', 'D', 'R'}, + /*.m4_app_offset = */ 0x00000000, +}; + +} // extern "C" diff --git a/firmware/application/apps/ui_adsb_rx.cpp b/firmware/application/external/adsbrx/ui_adsb_rx.cpp similarity index 98% rename from firmware/application/apps/ui_adsb_rx.cpp rename to firmware/application/external/adsbrx/ui_adsb_rx.cpp index 0adb8410a..16f556d65 100644 --- a/firmware/application/apps/ui_adsb_rx.cpp +++ b/firmware/application/external/adsbrx/ui_adsb_rx.cpp @@ -38,7 +38,7 @@ using namespace portapack; namespace pmem = portapack::persistent_memory; -namespace ui { +namespace ui::external_app::adsbrx { static const char speed_type_msg[][6] = {" Spd:", " IAS:", " TAS:"}; @@ -46,13 +46,19 @@ static std::string get_map_tag(const AircraftRecentEntry& entry) { return trimr(entry.callsign.empty() ? entry.icao_str : entry.callsign); } +} // namespace ui::external_app::adsbrx + +namespace ui { + template <> -void RecentEntriesTable::draw( +void RecentEntriesTable::draw( const Entry& entry, const Rect& target_rect, Painter& painter, const Style& style, RecentEntriesColumns& columns) { + using namespace external_app::adsbrx; + Color target_color; std::string entry_string; @@ -107,6 +113,10 @@ void RecentEntriesTable::draw( bitmap_target, target_color, style.background); } +} // namespace ui + +namespace ui::external_app::adsbrx { + /* ADSBLogger ********************************************/ void ADSBLogger::log(const ADSBLogEntry& log_entry) { @@ -816,4 +826,4 @@ void ADSBRxView::remove_expired_entries() { recent.erase(it.base(), recent.end()); } -} /* namespace ui */ +} // namespace ui::external_app::adsbrx diff --git a/firmware/application/apps/ui_adsb_rx.hpp b/firmware/application/external/adsbrx/ui_adsb_rx.hpp similarity index 99% rename from firmware/application/apps/ui_adsb_rx.hpp rename to firmware/application/external/adsbrx/ui_adsb_rx.hpp index c9a6e0468..1e761d9e6 100644 --- a/firmware/application/apps/ui_adsb_rx.hpp +++ b/firmware/application/external/adsbrx/ui_adsb_rx.hpp @@ -39,7 +39,7 @@ using namespace adsb; -namespace ui { +namespace ui::external_app::adsbrx { #define AIRCRAFT_ID_L 1 // aircraft ID message type (lowest type id) #define AIRCRAFT_ID_H 4 // aircraft ID message type (highest type id) @@ -491,4 +491,4 @@ class ADSBRxView : public View { }}; }; -} /* namespace ui */ +} // namespace ui::external_app::adsbrx diff --git a/firmware/application/external/external.cmake b/firmware/application/external/external.cmake index f1c85eccc..fcb010143 100644 --- a/firmware/application/external/external.cmake +++ b/firmware/application/external/external.cmake @@ -391,6 +391,10 @@ set(EXTCPPSRC external/tetra_rx/tetra_rcpc.cpp external/tetra_rx/tetra_viterbi.cpp + #adsb rx + external/adsbrx/main.cpp + external/adsbrx/ui_adsb_rx.cpp + ) set(EXTAPPLIST @@ -485,6 +489,7 @@ set(EXTAPPLIST secplustx signal_hunter tetra_rx + adsbrx ) # sdusb has type conflicts with PRALINE (HackRF Pro) - add only for non-PRALINE builds @@ -495,4 +500,3 @@ if(NOT BOARD STREQUAL "PRALINE") ) list(APPEND EXTAPPLIST sdusb) endif() - diff --git a/firmware/application/external/external.ld b/firmware/application/external/external.ld index 6fc27a33a..adcba5d35 100644 --- a/firmware/application/external/external.ld +++ b/firmware/application/external/external.ld @@ -115,6 +115,7 @@ MEMORY ram_external_app_vor_tx (rwx) : org = 0xAE0A0000, len = 32k ram_external_app_signal_hunter (rwx) : org = 0xAE0B0000, len = 32k ram_external_app_tetra_rx (rwx) : org = 0xAE0C0000, len = 32k + ram_external_app_adsbrx (rwx) : org = 0xAE0D0000, len = 32k } SECTIONS @@ -671,6 +672,12 @@ SECTIONS *(*ui*external_app*tetra_rx*); } > ram_external_app_tetra_rx + .external_app_adsbrx : ALIGN(4) SUBALIGN(4) + { + KEEP(*(.external_app.app_adsbrx.application_information)); + *(*ui*external_app*adsbrx*); + } > ram_external_app_adsbrx + } diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 6880b720e..e20056c53 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -30,7 +30,6 @@ #include "portapack.hpp" #include "ui_about_simple.hpp" -#include "ui_adsb_rx.hpp" #include "ui_aprs_rx.hpp" #include "ui_aprs_tx.hpp" #include "ui_btle_rx.hpp" @@ -99,7 +98,6 @@ const NavigationView::AppList NavigationView::appList = { {nullptr, "Games", HOME, Color::cyan(), &bitmap_icon_games, new ViewFactory()}, {nullptr, "Settings", HOME, Color::cyan(), &bitmap_icon_setup, new ViewFactory()}, /* RX ********************************************************************/ - {"adsbrx", "ADS-B", RX, Color::green(), &bitmap_icon_adsb, new ViewFactory()}, {"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()}, diff --git a/firmware/tools/external_app_info.py b/firmware/tools/external_app_info.py index 32a372f67..433aa3109 100644 --- a/firmware/tools/external_app_info.py +++ b/firmware/tools/external_app_info.py @@ -24,4 +24,4 @@ # external app address ranges below must match those in linker file "external.ld" maximum_application_size = 32*1024 external_apps_address_start = 0xADB00000 -external_apps_address_end = 0xAE0B0000 +external_apps_address_end = 0xAE0E0000