From 6f43e21ef9e1d2bf639a13530b33701390b55294 Mon Sep 17 00:00:00 2001 From: Dylan Benzi Date: Sun, 15 Nov 2026 20:49:39 +0000 Subject: [PATCH 1/2] update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index acd5ad1..e4a5a86 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ ### To clone `git clone --recurse-submodules `https://gitea.dylanbenzi.com/dylan/flightwall` +`git submodule update --init --recursive` From d550e78d96449bd8327341884c2eb346c3d653b1 Mon Sep 17 00:00:00 2001 From: Dylan Benzi Date: Sun, 15 Nov 2026 20:49:47 +0000 Subject: [PATCH 2/2] add draw to matrix --- FlightWall.cpp | 18 +++++++++--------- LEDMatrix.cpp | 38 +++++++++++++++++++------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/FlightWall.cpp b/FlightWall.cpp index 88ce128..fcc3494 100644 --- a/FlightWall.cpp +++ b/FlightWall.cpp @@ -1,7 +1,7 @@ -#include "TrackedAircraft.h" #include "LEDMatrix.cpp" #include "Network.cpp" #include "SBS1Decoder.cpp" +#include "TrackedAircraft.h" #include #include #include @@ -21,8 +21,6 @@ struct FlightWallOpts { class FlightWall { private: - FlightWallOpts opts_; - // hex ident, all other info std::unordered_map tracked; double min_distance = INT_MAX; @@ -45,10 +43,11 @@ private: return EARTH_RADIUS_M * std::hypot(x, y); } + FlightWallOpts opts_; + LEDMatrix m{&min_distance_aircraft}; + public: - FlightWall(FlightWallOpts opts) : opts_(opts) { - LEDMatrix m(&min_distance_aircraft); - } + FlightWall(FlightWallOpts opts) : opts_(opts) {} int start() { Network n(opts_.server_ip, opts_.port); @@ -56,7 +55,6 @@ public: char buffer[1024]; std::string line; - while (true) { ssize_t bytes_rec = recv(n.get_sock(), buffer, sizeof(buffer) - 1, 0); if (bytes_rec < 0) { @@ -137,8 +135,8 @@ public: // update min distance and aircraft if changed if (parsed->latitude && parsed->longitude) { - double parsed_dist = - get_distance(opts_.lat, opts_.lon, *parsed->latitude, *parsed->longitude); + double parsed_dist = get_distance( + opts_.lat, opts_.lon, *parsed->latitude, *parsed->longitude); if (parsed_dist < min_distance) { min_distance = parsed_dist; min_aircraft_icao = parsed->hex_ident; @@ -150,6 +148,8 @@ public: std::cout << "Closest aircraft: " << min_aircraft_icao << ", distance: " << min_distance << "m\n"; + m.draw(); + line.erase(0, pos + 1); } } diff --git a/LEDMatrix.cpp b/LEDMatrix.cpp index df58cb5..f949785 100644 --- a/LEDMatrix.cpp +++ b/LEDMatrix.cpp @@ -70,6 +70,25 @@ private: return {operator_or_reg, flight_number}; } + void draw_display_text() { + for (Text t : display_text) { + rgb_matrix::DrawText(canvas, font, t.x, t.y + font.baseline(), t.color, + NULL, t.text.c_str(), t.spacing); + } + rgb_matrix::DrawText(canvas, font, flight_number.x, flight_number.y + font.baseline(), flight_number.color, + NULL, flight_number.text.c_str(), flight_number.spacing); + rgb_matrix::DrawText(canvas, font, flight_operator.x, flight_operator.y + font.baseline(), flight_operator.color, + NULL, flight_operator.text.c_str(), flight_operator.spacing); + rgb_matrix::DrawText(canvas, font, altitude.x, altitude.y + font.baseline(), altitude.color, + NULL, altitude.text.c_str(), altitude.spacing); + rgb_matrix::DrawText(canvas, font, speed.x, speed.y + font.baseline(), speed.color, + NULL, speed.text.c_str(), speed.spacing); + rgb_matrix::DrawText(canvas, font, track.x, track.y + font.baseline(), track.color, + NULL, track.text.c_str(), track.spacing); + rgb_matrix::DrawText(canvas, font, vertical_speed.x, vertical_speed.y + font.baseline(), vertical_speed.color, + NULL, vertical_speed.text.c_str(), vertical_speed.spacing); + } + public: LEDMatrix() {}; @@ -100,25 +119,6 @@ public: ~LEDMatrix() { delete canvas; } - void draw_display_text() { - for (Text t : display_text) { - rgb_matrix::DrawText(canvas, font, t.x, t.y + font.baseline(), t.color, - NULL, t.text.c_str(), t.spacing); - } - rgb_matrix::DrawText(canvas, font, flight_number.x, flight_number.y + font.baseline(), flight_number.color, - NULL, flight_number.text.c_str(), flight_number.spacing); - rgb_matrix::DrawText(canvas, font, flight_operator.x, flight_operator.y + font.baseline(), flight_operator.color, - NULL, flight_operator.text.c_str(), flight_operator.spacing); - rgb_matrix::DrawText(canvas, font, altitude.x, altitude.y + font.baseline(), altitude.color, - NULL, altitude.text.c_str(), altitude.spacing); - rgb_matrix::DrawText(canvas, font, speed.x, speed.y + font.baseline(), speed.color, - NULL, speed.text.c_str(), speed.spacing); - rgb_matrix::DrawText(canvas, font, track.x, track.y + font.baseline(), track.color, - NULL, track.text.c_str(), track.spacing); - rgb_matrix::DrawText(canvas, font, vertical_speed.x, vertical_speed.y + font.baseline(), vertical_speed.color, - NULL, vertical_speed.text.c_str(), vertical_speed.spacing); - } - void draw() { if (!current_aircraft->callsign->empty()) { std::string current_callsign = *current_aircraft->callsign;