From 7af7279ea46fbb4e622fb99007574dfb118d5bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20Deisinger?= Date: Sun, 23 Jan 2022 22:34:01 +0100 Subject: [PATCH] Fix ADS-B not updating Altitude in Map #473 This commit will fix altitude not automatically updating when in Map mode. Also set default altitude for AIS to 0. --- firmware/application/apps/ais_app.cpp | 2 +- firmware/application/apps/ui_adsb_rx.cpp | 2 +- firmware/application/apps/ui_aprs_rx.cpp | 2 +- firmware/application/ui/ui_geomap.cpp | 4 +++- firmware/application/ui/ui_geomap.hpp | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/firmware/application/apps/ais_app.cpp b/firmware/application/apps/ais_app.cpp index 24f2976e..0155f5e7 100644 --- a/firmware/application/apps/ais_app.cpp +++ b/firmware/application/apps/ais_app.cpp @@ -240,7 +240,7 @@ AISRecentEntryDetailView::AISRecentEntryDetailView(NavigationView& nav) { void AISRecentEntryDetailView::update_position() { if (send_updates) - geomap_view->update_position(ais::format::latlon_float(entry_.last_position.latitude.normalized()), ais::format::latlon_float(entry_.last_position.longitude.normalized()), (float)entry_.last_position.true_heading); + geomap_view->update_position(ais::format::latlon_float(entry_.last_position.latitude.normalized()), ais::format::latlon_float(entry_.last_position.longitude.normalized()), (float)entry_.last_position.true_heading, 0); } void AISRecentEntryDetailView::focus() { diff --git a/firmware/application/apps/ui_adsb_rx.cpp b/firmware/application/apps/ui_adsb_rx.cpp index 0d177917..40583f2c 100644 --- a/firmware/application/apps/ui_adsb_rx.cpp +++ b/firmware/application/apps/ui_adsb_rx.cpp @@ -261,7 +261,7 @@ void ADSBRxDetailsView::update(const AircraftRecentEntry& entry) { text_frame_pos_odd.set(to_string_hex_array(entry_copy.frame_pos_odd.get_raw_data(), 14)); if (send_updates) - geomap_view->update_position(entry_copy.pos.latitude, entry_copy.pos.longitude, entry_copy.velo.heading); + geomap_view->update_position(entry_copy.pos.latitude, entry_copy.pos.longitude, entry_copy.velo.heading, entry_copy.pos.altitude); } ADSBRxDetailsView::~ADSBRxDetailsView() { diff --git a/firmware/application/apps/ui_aprs_rx.cpp b/firmware/application/apps/ui_aprs_rx.cpp index 3c8f2eca..6732e626 100644 --- a/firmware/application/apps/ui_aprs_rx.cpp +++ b/firmware/application/apps/ui_aprs_rx.cpp @@ -351,7 +351,7 @@ void APRSDetailsView::update() { } if (send_updates) - geomap_view->update_position(entry_copy.pos.latitude, entry_copy.pos.longitude, 0); + geomap_view->update_position(entry_copy.pos.latitude, entry_copy.pos.longitude, 0, 0); } APRSDetailsView::~APRSDetailsView() { diff --git a/firmware/application/ui/ui_geomap.cpp b/firmware/application/ui/ui_geomap.cpp index 1d09880d..4d0d7e29 100644 --- a/firmware/application/ui/ui_geomap.cpp +++ b/firmware/application/ui/ui_geomap.cpp @@ -253,14 +253,16 @@ void GeoMapView::focus() { nav_.display_modal("No map", "No world_map.bin file in\n/ADSB/ directory", ABORT, nullptr); } -void GeoMapView::update_position(float lat, float lon, uint16_t angle) { +void GeoMapView::update_position(float lat, float lon, uint16_t angle, int32_t altitude) { lat_ = lat; lon_ = lon; + altitude_ = altitude; // Stupid hack to avoid an event loop geopos.set_report_change(false); geopos.set_lat(lat_); geopos.set_lon(lon_); + geopos.set_altitude(altitude_); geopos.set_report_change(true); geomap.set_angle(angle); diff --git a/firmware/application/ui/ui_geomap.hpp b/firmware/application/ui/ui_geomap.hpp index 30fd6983..1a80eeea 100644 --- a/firmware/application/ui/ui_geomap.hpp +++ b/firmware/application/ui/ui_geomap.hpp @@ -177,7 +177,7 @@ public: void focus() override; - void update_position(float lat, float lon, uint16_t angle); + void update_position(float lat, float lon, uint16_t angle, int32_t altitude); std::string title() const override { return "Map view"; };