This commit is contained in:
2026-08-11 12:14:53 +02:00
parent 831501ea41
commit 839ea1490a
2 changed files with 33 additions and 22 deletions
+1
View File
@@ -9,3 +9,4 @@ compile_commands.json
include/ include/
!scripts/include/ !scripts/include/
*.o *.o
test
+20 -10
View File
@@ -17,7 +17,6 @@
#include <iostream> #include <iostream>
#include <numbers> #include <numbers>
#include <string> #include <string>
#include <algorithm>
#ifndef CONFIG_AUTOSCALE #ifndef CONFIG_AUTOSCALE
constexpr constexpr
@@ -162,7 +161,6 @@ int main() {
// speed in pixels per hour // speed in pixels per hour
const float speed_pph = speed * pixels_per_km; const float speed_pph = speed * pixels_per_km;
// track in radians // track in radians
const float track_rad = const float track_rad =
std::fmod((track - 90), 360.0f) * std::fmod((track - 90), 360.0f) *
@@ -171,22 +169,30 @@ int main() {
{ {
float track_rate_rads; float track_rate_rads;
try { try {
track_rate_rads = craft["track_rate"].get<float>() * (static_cast<float>(std::numbers::pi) / 180.0f); track_rate_rads =
craft["track_rate"].get<float>() *
(static_cast<float>(std::numbers::pi) / 180.0f);
} catch (...) { } catch (...) {
std::clog << YELLOW std::clog
"[WARNING]" RESET << YELLOW "[WARNING]" RESET
" aircraft with no track_rate data detected!\n"; " aircraft with no track_rate data detected!\n";
track_rate_rads = 0; track_rate_rads = 0;
} }
draw::arc(x_center, y_center,track_rad,speed_pph/3600,track_rate_rads,CONFIG_TIME_BASED_VECTOR_LENGHT*60,color); draw::arc(x_center, y_center, track_rad, speed_pph / 3600,
track_rate_rads, CONFIG_TIME_BASED_VECTOR_LENGHT * 60,
color);
} }
#else #else
// lenght of Time-Based Vector // lenght of Time-Based Vector
const float vector_lenght = const float vector_lenght =
(speed_pph / 60) * CONFIG_TIME_BASED_VECTOR_LENGHT; (speed_pph / 60) * CONFIG_TIME_BASED_VECTOR_LENGHT;
draw::line(x_center, y_center, draw::line(
std::clamp(x_center + (vector_lenght * std::cos(track_rad)),0.0f, static_cast<float>(UINT16_MAX)), x_center, y_center,
std::clamp(y_center + (vector_lenght * std::sin(track_rad)),0.0f,static_cast<float>(UINT16_MAX)), color); std::clamp(x_center + (vector_lenght * std::cos(track_rad)),
0.0f, static_cast<float>(UINT16_MAX)),
std::clamp(y_center + (vector_lenght * std::sin(track_rad)),
0.0f, static_cast<float>(UINT16_MAX)),
color);
#endif #endif
draw::rhombus(x_center, y_center, 8 /*TODO: remove magic*/, draw::rhombus(x_center, y_center, 8 /*TODO: remove magic*/,
color); color);
@@ -214,7 +220,11 @@ int main() {
x_center + 10 /*TODO: remove magic*/, x_center + 10 /*TODO: remove magic*/,
y_center + FONT_HEIGHT + CONFIG_CHARACTER_SPACING, y_center + FONT_HEIGHT + CONFIG_CHARACTER_SPACING,
color); color);
font::puts(std::to_string(altitude) + ALTITUDE_UNIT, x_center + 10 /*TODO: remove magic*/, y_center + (FONT_HEIGHT + CONFIG_CHARACTER_SPACING)*2,color); font::puts(std::to_string(altitude) + ALTITUDE_UNIT,
x_center + 10 /*TODO: remove magic*/,
y_center +
(FONT_HEIGHT + CONFIG_CHARACTER_SPACING) * 2,
color);
} }
} catch (...) { } catch (...) {
std::clog << YELLOW "[WARNING]" RESET std::clog << YELLOW "[WARNING]" RESET