Externalize antenna calc and wav view (#2498)

* externalize antenna calc and wav view
* Added a tool to check if all the pictures in graphics are used in internal apps
This commit is contained in:
gullradriel 2025-01-26 21:36:21 +01:00 committed by GitHub
parent b2bb37af74
commit a65ef3ce2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 191 additions and 93 deletions

View File

@ -317,9 +317,7 @@ set(CPPSRC
apps/ui_text_editor.cpp
apps/ui_touch_calibration.cpp
apps/ui_touchtunes.cpp
apps/ui_view_wav.cpp
apps/ui_weatherstation.cpp
apps/ui_whipcalc.cpp
protocols/aprs.cpp
protocols/ax25.cpp
protocols/bht.cpp

View File

@ -987,44 +987,6 @@ static constexpr Bitmap bitmap_icon_previous{
{16, 16},
bitmap_icon_previous_data};
static constexpr uint8_t bitmap_icon_tools_antenna_data[] = {
0x38,
0x3E,
0x10,
0x22,
0x10,
0x26,
0x10,
0x22,
0x10,
0x2E,
0x10,
0x22,
0x10,
0x26,
0x10,
0x22,
0x38,
0x2E,
0x38,
0x22,
0x38,
0x26,
0x38,
0x22,
0x38,
0x2E,
0x38,
0x22,
0x38,
0x3E,
0x00,
0x00,
};
static constexpr Bitmap bitmap_icon_tools_antenna{
{16, 16},
bitmap_icon_tools_antenna_data};
static constexpr uint8_t bitmap_icon_batt_text_data[] = {
0x00,
0x00,
@ -1799,6 +1761,45 @@ static constexpr uint8_t bitmap_icon_lge_data[] = {
0x00,
0x00,
};
static constexpr uint8_t bitmap_icon_file_iq_data[] = {
0xFC,
0x03,
0x04,
0x06,
0x04,
0x0E,
0x04,
0x1E,
0x04,
0x3E,
0x04,
0x20,
0x04,
0x20,
0x04,
0x21,
0x44,
0x25,
0x54,
0x25,
0xF4,
0x2F,
0xA4,
0x2A,
0x84,
0x22,
0x04,
0x22,
0x04,
0x20,
0xFC,
0x3F,
};
static constexpr Bitmap bitmap_icon_file_iq{
{16, 16},
bitmap_icon_file_iq_data};
static constexpr Bitmap bitmap_icon_lge{
{16, 16},
bitmap_icon_lge_data};
@ -2713,44 +2714,6 @@ static constexpr Bitmap bitmap_icon_touchtunes{
{16, 16},
bitmap_icon_touchtunes_data};
static constexpr uint8_t bitmap_icon_file_iq_data[] = {
0xFC,
0x03,
0x04,
0x06,
0x04,
0x0E,
0x04,
0x1E,
0x04,
0x3E,
0x04,
0x20,
0x04,
0x20,
0x04,
0x21,
0x44,
0x25,
0x54,
0x25,
0xF4,
0x2F,
0xA4,
0x2A,
0x84,
0x22,
0x04,
0x22,
0x04,
0x20,
0xFC,
0x3F,
};
static constexpr Bitmap bitmap_icon_file_iq{
{16, 16},
bitmap_icon_file_iq_data};
static constexpr uint8_t bitmap_icon_sd_data[] = {
0x00,
0x00,

View File

@ -0,0 +1,50 @@
/*
* Copyright (C) 2024 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_whipcalc.hpp"
#include "ui_navigation.hpp"
#include "external_app.hpp"
namespace ui::external_app::antenna_length {
void initialize_app(ui::NavigationView& nav) {
nav.push<WhipCalcView>();
}
} // namespace ui::external_app::antenna_length
extern "C" {
__attribute__((section(".external_app.app_antenna_length.application_information"), used)) application_information_t _application_information_antenna_length = {
/*.memory_location = */ (uint8_t*)0x00000000,
/*.externalAppEntry = */ ui::external_app::antenna_length::initialize_app,
/*.header_version = */ CURRENT_HEADER_VERSION,
/*.app_version = */ VERSION_MD5,
/*.app_name = */ "Antenna Length",
/*.bitmap_data = */ {0x38, 0x3E, 0x10, 0x22, 0x10, 0x26, 0x10, 0x22, 0x10, 0x2E, 0x10, 0x22, 0x10, 0x26, 0x10, 0x22, 0x38, 0x2E, 0x38, 0x22, 0x38, 0x26, 0x38, 0x22, 0x38, 0x2E, 0x38, 0x22, 0x38, 0x3E, 0x00, 0x00},
/*.icon_color = */ ui::Color::cyan().v,
/*.menu_location = */ app_location_t::SETTINGS,
/*.desired_menu_position = */ -1,
/*.m4_app_tag = portapack::spi_flash::image_tag_none */ {0, 0, 0, 0},
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
};
}

View File

@ -32,8 +32,9 @@
#include <cstring>
using namespace portapack;
using namespace ui;
namespace ui {
namespace ui::external_app::antenna_length {
void WhipCalcView::focus() {
field_frequency.focus();
@ -176,4 +177,4 @@ void WhipCalcView::load_antenna_db() {
void WhipCalcView::add_default_antenna() {
antenna_db.push_back({"ANT500", {185, 315, 450, 586, 724, 862}}); // store a default ant500
}
} // namespace ui
} // namespace ui::external_app::antenna_length

View File

@ -31,7 +31,10 @@
#include "string_format.hpp"
#include <vector>
namespace ui {
using namespace ui;
namespace ui::external_app::antenna_length {
class WhipCalcView : public View {
public:
WhipCalcView(NavigationView& nav);
@ -90,6 +93,6 @@ class WhipCalcView : public View {
"Back"};
};
} /* namespace ui */
} // namespace ui::external_app::antenna_length
#endif /*__UI_WHIPCALC__*/

View File

@ -150,6 +150,14 @@ set(EXTCPPSRC
#app_manager
external/app_manager/main.cpp
external/app_manager/ui_app_manager.cpp
# whip calculator
external/antenna_length/main.cpp
external/antenna_length/ui_whipcalc.cpp
# wav viewer
external/wav_view/main.cpp
external/wav_view/ui_view_wav.cpp
)
set(EXTAPPLIST
@ -189,4 +197,6 @@ set(EXTAPPLIST
tuner
metronome
app_manager
)
antenna_length
view_wav
)

View File

@ -59,6 +59,8 @@ MEMORY
ram_external_app_tuner(rwx) : org = 0xADD20000, len = 32k
ram_external_app_metronome(rwx) : org = 0xADD30000, len = 32k
ram_external_app_app_manager(rwx) : org = 0xADD40000, len = 32k
ram_external_app_antenna_length(rwx) : org = 0xADD50000, len = 32k
ram_external_app_view_wav(rwx) : org = 0xADD60000, len = 32k
}
SECTIONS
@ -279,4 +281,17 @@ SECTIONS
KEEP(*(.external_app.app_app_manager.application_information));
*(*ui*external_app*app_manager*);
} > ram_external_app_app_manager
.external_app_antenna_length : ALIGN(4) SUBALIGN(4)
{
KEEP(*(.external_app.app_antenna_length.application_information));
*(*ui*external_app*antenna_length*);
} > ram_external_app_antenna_length
.external_app_view_wav : ALIGN(4) SUBALIGN(4)
{
KEEP(*(.external_app.app_view_wav.application_information));
*(*ui*external_app*view_wav*);
} > ram_external_app_view_wav
}

View File

@ -0,0 +1,50 @@
/*
* Copyright (C) 2024 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_view_wav.hpp"
#include "ui_navigation.hpp"
#include "external_app.hpp"
namespace ui::external_app::view_wav {
void initialize_app(ui::NavigationView& nav) {
nav.push<ViewWavView>();
}
} // namespace ui::external_app::view_wav
extern "C" {
__attribute__((section(".external_app.app_view_wav.application_information"), used)) application_information_t _application_information_view_wav = {
/*.memory_location = */ (uint8_t*)0x00000000,
/*.externalAppEntry = */ ui::external_app::view_wav::initialize_app,
/*.header_version = */ CURRENT_HEADER_VERSION,
/*.app_version = */ VERSION_MD5,
/*.app_name = */ "WAV Viewer",
/*.bitmap_data = */ {0xF0, 0x0F, 0x1C, 0x18, 0x17, 0x38, 0x15, 0x78, 0x15, 0xF8, 0x15, 0x82, 0x15, 0x8B, 0xD5, 0x83, 0xD5, 0xBB, 0xD5, 0x83, 0x15, 0x8B, 0x15, 0x92, 0x15, 0xA0, 0x17, 0x80, 0x1C, 0x80, 0xF0, 0xFF},
/*.icon_color = */ ui::Color::green().v,
/*.menu_location = */ app_location_t::SETTINGS,
/*.desired_menu_position = */ -1,
/*.m4_app_tag = portapack::spi_flash::image_tag_none */ {0, 0, 0, 0},
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
};
}

View File

@ -28,8 +28,9 @@
#include "string_format.hpp"
using namespace portapack;
using namespace ui;
namespace ui {
namespace ui::external_app::view_wav {
void ViewWavView::update_scale(int32_t new_scale) {
scale = new_scale;
@ -345,4 +346,4 @@ ViewWavView::~ViewWavView() {
baseband::shutdown();
}
} /* namespace ui */
} /* namespace ui::external_app::view_wav */

View File

@ -28,7 +28,9 @@
#include "ui_receiver.hpp"
#include "replay_thread.hpp"
namespace ui {
using namespace ui;
namespace ui::external_app::view_wav {
class ViewWavView : public View {
public:
@ -202,4 +204,4 @@ class ViewWavView : public View {
}};
};
} /* namespace ui */
} /* namespace ui::external_app::view_wav */

View File

@ -63,10 +63,8 @@
// #include "ui_test.hpp"
#include "ui_text_editor.hpp"
#include "ui_touchtunes.hpp"
#include "ui_view_wav.hpp"
#include "ui_weatherstation.hpp"
#include "ui_subghzd.hpp"
#include "ui_whipcalc.hpp"
#include "ui_battinfo.hpp"
#include "ui_external_items_menu_loader.hpp"
@ -163,16 +161,13 @@ const NavigationView::AppList NavigationView::appList = {
{"soundbrd", "Soundbrd", TX, ui::Color::green(), &bitmap_icon_soundboard, new ViewFactory<SoundBoardView>()},
{"touchtune", "TouchTune", TX, ui::Color::green(), &bitmap_icon_touchtunes, new ViewFactory<TouchTunesView>()},
/* UTILITIES *************************************************************/
{"antennalength", "Antenna Length", UTILITIES, Color::green(), &bitmap_icon_tools_antenna, new ViewFactory<WhipCalcView>()},
{"filemanager", "File Manager", UTILITIES, Color::green(), &bitmap_icon_dir, new ViewFactory<FileManagerView>()},
{"freqman", "Freq. Manager", UTILITIES, Color::green(), &bitmap_icon_freqman, new ViewFactory<FrequencyManagerView>()},
{"notepad", "Notepad", UTILITIES, Color::dark_cyan(), &bitmap_icon_notepad, new ViewFactory<TextEditorView>()},
{"iqtrim", "IQ Trim", UTILITIES, Color::orange(), &bitmap_icon_trim, new ViewFactory<IQTrimView>()},
{"notepad", "Notepad", UTILITIES, Color::dark_cyan(), &bitmap_icon_notepad, new ViewFactory<TextEditorView>()},
{nullptr, "SD Over USB", UTILITIES, Color::yellow(), &bitmap_icon_hackrf, new ViewFactory<SdOverUsbView>()},
{"signalgen", "Signal Gen", UTILITIES, Color::green(), &bitmap_icon_cwgen, new ViewFactory<SigGenView>()},
//{"testapp", "Test App", UTILITIES, Color::dark_grey(), nullptr, new ViewFactory<TestView>()},
{"wavview", "Wav View", UTILITIES, Color::yellow(), &bitmap_icon_soundboard, new ViewFactory<ViewWavView>()},
// Dangerous apps.
{nullptr, "Flash Utility", UTILITIES, Color::red(), &bitmap_icon_peripherals_details, new ViewFactory<FlashUtilityView>()},
{nullptr, "Wipe SD card", UTILITIES, Color::red(), &bitmap_icon_tools_wipesd, new ViewFactory<WipeSDView>()},

View File

@ -0,0 +1,10 @@
#!/bin/bash
for fname in $(ls ../graphics/); do
fname=$(echo "$fname" | awk -F'.' '{print $1}')
out=$(grep -r --exclude="bitmap.hpp" "$fname" ../* )
ret=$?
if [[ "$ret" -ne 0 ]]; then
echo "$fname not found"
fi
done