diff --git a/.gitignore b/.gitignore index 8634bb5..a1d4ee2 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ compile_commands.json .config.* include/ !scripts/include/ -*.o \ No newline at end of file +*.o +test \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 0b2f598..a9abd81 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #ifndef CONFIG_AUTOSCALE constexpr @@ -135,9 +134,9 @@ int main() { " aircraft with no ground speed or track data detected!\n"; speed = 0; track = 0; - #ifndef CONFIG_METRIC +#ifndef CONFIG_METRIC speed_knot = 0; - #endif +#endif } draw::color_t color = get_altitude_color(altitude); try { @@ -161,32 +160,39 @@ int main() { // speed in pixels per hour const float speed_pph = speed * pixels_per_km; - // track in radians const float track_rad = std::fmod((track - 90), 360.0f) * (static_cast(std::numbers::pi) / 180.0f); #ifdef CONFIG_VECTOR_FOLLOW_TRACK_RATE -{ - float track_rate_rads; - try { - track_rate_rads = craft["track_rate"].get() * (static_cast(std::numbers::pi) / 180.0f); - } catch (...) { - std::clog << YELLOW - "[WARNING]" RESET - " aircraft with no track_rate data detected!\n"; + { + float track_rate_rads; + try { + track_rate_rads = + craft["track_rate"].get() * + (static_cast(std::numbers::pi) / 180.0f); + } catch (...) { + std::clog + << YELLOW "[WARNING]" RESET + " aircraft with no track_rate data detected!\n"; 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 - // lenght of Time-Based Vector - const float vector_lenght = - (speed_pph / 60) * CONFIG_TIME_BASED_VECTOR_LENGHT; - draw::line(x_center, y_center, - std::clamp(x_center + (vector_lenght * std::cos(track_rad)),0.0f, static_cast(UINT16_MAX)), - std::clamp(y_center + (vector_lenght * std::sin(track_rad)),0.0f,static_cast(UINT16_MAX)), color); + // lenght of Time-Based Vector + const float vector_lenght = + (speed_pph / 60) * CONFIG_TIME_BASED_VECTOR_LENGHT; + draw::line( + x_center, y_center, + std::clamp(x_center + (vector_lenght * std::cos(track_rad)), + 0.0f, static_cast(UINT16_MAX)), + std::clamp(y_center + (vector_lenght * std::sin(track_rad)), + 0.0f, static_cast(UINT16_MAX)), + color); #endif draw::rhombus(x_center, y_center, 8 /*TODO: remove magic*/, color); @@ -214,7 +220,11 @@ int main() { x_center + 10 /*TODO: remove magic*/, y_center + FONT_HEIGHT + CONFIG_CHARACTER_SPACING, 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 (...) { std::clog << YELLOW "[WARNING]" RESET