Compare commits

...

6 Commits

Author SHA1 Message Date
Totoo b3edaf3cd0 AIS name fix (#2793)
* AIS name fix
2025-09-17 22:40:46 +02:00
Totoo 9afd3a9dca Standalone imp (#2791)
* Moved ui elements to common folder in standalone, and add screen parameters to the api v4

* pass it as a pointer, so if standalone app supports it can change
2025-09-16 20:29:05 +02:00
Totoo d80f41e9d7 Beep on search find something.
Beep on search find something. Solves #2643
2025-09-14 07:22:48 +00:00
Totoo 46d87d95ae Set MIC app's freq step a bit lower to 12.5k. Solves #2728 (#2788) 2025-09-13 12:38:29 +02:00
Totoo 7626dff1ef Add blue bar (Channel) to sonde app. 2025-09-13 12:37:34 +02:00
Totoo f101680521 fixes osm marker display bug #2783 (#2786) 2025-09-13 12:37:01 +02:00
51 changed files with 75 additions and 26 deletions
+6 -6
View File
@@ -223,9 +223,9 @@ void AISRecentEntry::update(const ais::Packet& packet) {
break;
case 5:
call_sign = packet.text(70, 7);
name = packet.text(112, 20);
destination = packet.text(302, 20);
call_sign = trim(packet.text(70, 7));
name = trim(packet.text(112, 20));
destination = trim(packet.text(302, 20));
break;
case 18:
@@ -238,7 +238,7 @@ void AISRecentEntry::update(const ais::Packet& packet) {
break;
case 21:
name = packet.text(43, 20);
name = trim(packet.text(43, 20));
last_position.timestamp = packet.received_at();
last_position.latitude = packet.latitude(192);
last_position.longitude = packet.longitude(164);
@@ -247,11 +247,11 @@ void AISRecentEntry::update(const ais::Packet& packet) {
case 24:
switch (packet.read(38, 2)) {
case 0:
name = packet.text(40, 20);
name = trim(packet.text(40, 20));
break;
case 1:
call_sign = packet.text(90, 7);
call_sign = trim(packet.text(90, 7));
break;
default:
+2
View File
@@ -446,6 +446,8 @@ MicTXView::MicTXView(
field_frequency.set_value(tx_frequency);
// TODO: would be nice if frequency step was configurable in this app
// but now, make it a bit lower
receiver_model.set_frequency_step(12'500); // set freq step to 12.5kHz
field_frequency.set_step(receiver_model.frequency_step());
// WARNING: transmitter_model.set_target_frequency() and receiver_model.set_target_frequency() both update the same tuning freq, but one has an offset!
+11
View File
@@ -26,8 +26,10 @@
#include "binder.hpp"
#include "string_format.hpp"
#include "ui_freqman.hpp"
#include "audio.hpp"
using namespace portapack;
namespace pmem = portapack::persistent_memory;
namespace ui {
@@ -121,9 +123,15 @@ SearchView::SearchView(
on_range_changed();
receiver_model.enable();
if (pmem::beep_on_packets()) {
audio::set_rate(audio::Rate::Hz_24000);
audio::output::start();
}
}
SearchView::~SearchView() {
audio::output::stop();
receiver_model.disable();
baseband::shutdown();
}
@@ -205,6 +213,9 @@ void SearchView::do_detection() {
locked = true;
locked_bin = bin_max;
if (pmem::beep_on_packets()) {
baseband::request_audio_beep(1000, 24000, 60);
}
// TODO: open Audio.
} else
text_infos.set("Out of range");
+1
View File
@@ -54,6 +54,7 @@ SondeView::SondeView(NavigationView& nav)
&field_lna,
&field_vga,
&rssi,
&channel,
&field_volume,
&check_log,
&check_crc,
+3
View File
@@ -118,6 +118,9 @@ class SondeView : public View {
RSSI rssi{
{21 * 8, 0, 6 * 8, 4}};
Channel channel{
{21 * 8, 5, 6 * 8, 4},
};
AudioVolumeField field_volume{
{screen_width - 2 * 8, 0 * 16}};
@@ -233,6 +233,9 @@ standalone_application_api_t api = {
.draw_pixels = &ext_draw_pixels,
.draw_pixel = &ext_draw_pixel,
.exit_app = &exit_app,
// version 4
.screen_height = &screen_height,
.screen_width = &screen_width,
};
StandaloneView::StandaloneView(NavigationView& nav, uint8_t* app_image)
+13 -6
View File
@@ -773,15 +773,22 @@ void GeoMap::clear_markers() {
MapMarkerStored GeoMap::store_marker(GeoMarker& marker) {
const auto r = screen_rect();
MapMarkerStored ret;
// Check if it could be on screen
// (Shows more distant planes when zoomed out)
GeoPoint mapPoint = lat_lon_to_map_pixel(marker.lat, marker.lon);
int x_dist = abs((int)mapPoint.x - (int)x_pos);
int y_dist = abs((int)mapPoint.y - (int)y_pos);
int zoom_out = (map_zoom < 0) ? -map_zoom : 1;
bool can_see_on_map = true;
if (!use_osm) {
GeoPoint mapPoint = lat_lon_to_map_pixel(marker.lat, marker.lon);
int x_dist = abs((int)mapPoint.x - (int)x_pos);
int y_dist = abs((int)mapPoint.y - (int)y_pos);
int zoom_out = (map_zoom < 0) ? -map_zoom : 1;
if ((x_dist >= (zoom_out * r.width() / 2)) || (y_dist >= (zoom_out * r.height() / 2))) {
can_see_on_map = false;
}
} else {
// osm is so zoomable, we try to store all possible. maybe need to refine it a bit more later
}
if ((x_dist >= (zoom_out * r.width() / 2)) || (y_dist >= (zoom_out * r.height() / 2))) {
if (!can_see_on_map) {
ret = MARKER_NOT_STORED;
} else if (markerListLen < NumMarkerListElements) {
markerList[markerListLen] = marker;
+6 -1
View File
@@ -29,7 +29,7 @@
#include "ui.hpp"
#include "file.hpp"
#define CURRENT_STANDALONE_APPLICATION_API_VERSION 3
#define CURRENT_STANDALONE_APPLICATION_API_VERSION 4
struct standalone_application_api_t {
// Version 1
@@ -105,6 +105,11 @@ struct standalone_application_api_t {
void (*draw_pixels)(const ui::Rect r, const ui::Color* const colors, const size_t count);
void (*draw_pixel)(const ui::Point p, const ui::Color color);
void (*exit_app)();
// Version 4
uint16_t* screen_height;
uint16_t* screen_width;
// TODO: add baseband access functions
// HOW TO extend this interface:
@@ -86,15 +86,17 @@ set(LDSCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/external.ld)
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
FILE(GLOB_RECURSE Sources_C ${CMAKE_CURRENT_LIST_DIR}/*.c)
FILE(GLOB_RECURSE Sources_C_COMMON ${CMAKE_CURRENT_LIST_DIR}/../common/*.c)
set(CSRC
${Sources_C}
${Sources_C} ${Sources_C_COMMON}
)
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
FILE(GLOB_RECURSE Sources_CPP ${CMAKE_CURRENT_LIST_DIR}/*.cpp)
FILE(GLOB_RECURSE Sources_CPP_COMMON ${CMAKE_CURRENT_LIST_DIR}/../common/*.cpp)
set(CPPSRC
${Sources_CPP}
${Sources_CPP} ${Sources_CPP_COMMON}
)
# C sources to be compiled in ARM mode regardless of the global setting.
@@ -122,6 +124,8 @@ set(ASMSRC)
set(INCDIR
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../common
${CMAKE_CURRENT_SOURCE_DIR}/../common/ui
${COMMON}
${COMMON}/../application
${COMMON}/../application/hw
@@ -31,7 +31,9 @@ void initialize(const standalone_application_api_t& api) {
_api = &api;
context = new ui::Context();
standaloneViewMirror = new StandaloneViewMirror(*context, {0, 16, 240, 304});
screen_height = *(_api->screen_height);
screen_width = *(_api->screen_width);
standaloneViewMirror = new StandaloneViewMirror(*context, {0, 16, screen_width, screen_height - 16});
}
// event 1 == frame sync. called each 1/60th of second, so 6 = 100ms
@@ -78,7 +80,7 @@ ui::Widget* captured_widget{nullptr};
void OnTouchEvent(int, int, uint32_t) {
if (standaloneViewMirror) {
_api->exit_app();
/*
/* //left here for example, but not used in digital rain
ui::TouchEvent event{{x, y}, static_cast<ui::TouchEvent::Type>(type)};
if (event.type == ui::TouchEvent::Type::Start) {
@@ -105,7 +107,8 @@ bool OnKeyEvent(uint8_t) {
// ui::KeyEvent key = (ui::KeyEvent)key_val;
if (context) {
_api->exit_app();
/* auto focus_widget = context->focus_manager().focus_widget();
/* left here for example, but not used in digital rain
auto focus_widget = context->focus_manager().focus_widget();
if (focus_widget) {
if (focus_widget->on_key(key))
@@ -130,6 +133,7 @@ bool OnEncoder(int32_t) {
if (context) {
_api->exit_app();
/*
left here for example, but not used in digital rain
auto focus_widget = context->focus_manager().focus_widget();
if (focus_widget) return focus_widget->on_encoder((ui::EncoderEvent)delta);
@@ -143,6 +147,7 @@ bool OnKeyboad(uint8_t) {
if (context) {
_api->exit_app();
/*
left here for example, but not used in digital rain
auto focus_widget = context->focus_manager().focus_widget();
if (focus_widget)
@@ -45,17 +45,19 @@ bool OnKeyboad(uint8_t);
void PaintViewMirror();
extern const standalone_application_api_t* _api;
extern uint16_t screen_height;
extern uint16_t screen_width;
class DigitalRain {
private:
ui::Painter painter{};
static const int WIDTH = 240;
static const int HEIGHT = 325;
static const int MARGIN_TOP = 20;
static const int CHAR_WIDTH = 5;
static const int CHAR_HEIGHT = 8;
static const int COLS = WIDTH / CHAR_WIDTH;
static const int ROWS = (HEIGHT - MARGIN_TOP) / CHAR_HEIGHT;
int WIDTH = 0; // 240;
int HEIGHT = 0; // 325;
int MARGIN_TOP = 20;
int CHAR_WIDTH = 5;
int CHAR_HEIGHT = 8;
int COLS = 0; // WIDTH / CHAR_WIDTH;
int ROWS = 0; //(HEIGHT - MARGIN_TOP) / CHAR_HEIGHT;
static const int MAX_DROPS = 36;
const ui::Font& font = ui::font::fixed_5x8();
@@ -124,7 +126,10 @@ class DigitalRain {
public:
DigitalRain() {
std::srand(0);
WIDTH = screen_width;
HEIGHT = screen_height + 5;
COLS = WIDTH / CHAR_WIDTH;
ROWS = (HEIGHT - MARGIN_TOP) / CHAR_HEIGHT;
for (uint8_t i = 0; i < MAX_DROPS; ++i) {
init_drop(i, true);
}
+3
View File
@@ -176,3 +176,6 @@ extern "C" int f_printf(FIL* fp, const TCHAR* str, ...) {
extern "C" TCHAR* f_gets(TCHAR* buff, int len, FIL* fp) {
return _api->f_gets(buff, len, fp);
}
uint16_t screen_height = 320;
uint16_t screen_width = 240;