From ed5ca01e47e487b6617575c0960751d3d638891b Mon Sep 17 00:00:00 2001 From: Henry Wurzburg Date: Fri, 10 Feb 2023 18:18:56 -0600 Subject: [PATCH] AP_OSD:add aspect ratio correction for DisplayPort --- libraries/AP_OSD/AP_OSD_Backend.h | 4 ++-- libraries/AP_OSD/AP_OSD_MSP_DisplayPort.cpp | 8 ++++++++ libraries/AP_OSD/AP_OSD_MSP_DisplayPort.h | 4 +++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libraries/AP_OSD/AP_OSD_Backend.h b/libraries/AP_OSD/AP_OSD_Backend.h index b52cf9b701..30e638f1f1 100644 --- a/libraries/AP_OSD/AP_OSD_Backend.h +++ b/libraries/AP_OSD/AP_OSD_Backend.h @@ -26,7 +26,7 @@ class AP_OSD_Backend public: //constructor - AP_OSD_Backend(AP_OSD &osd): _osd(osd) {}; + AP_OSD_Backend(AP_OSD &osd): _osd(osd) {} //destructor virtual ~AP_OSD_Backend(void) {} @@ -51,7 +51,7 @@ public: virtual void clear() { blink_phase = (blink_phase+1)%4; - }; + } // copy the backend specific symbol set to the OSD lookup table virtual void init_symbol_set(uint8_t *symbols, const uint8_t size); diff --git a/libraries/AP_OSD/AP_OSD_MSP_DisplayPort.cpp b/libraries/AP_OSD/AP_OSD_MSP_DisplayPort.cpp index 8a9191e8d8..0e46dfc2cd 100644 --- a/libraries/AP_OSD/AP_OSD_MSP_DisplayPort.cpp +++ b/libraries/AP_OSD/AP_OSD_MSP_DisplayPort.cpp @@ -133,4 +133,12 @@ AP_OSD_Backend *AP_OSD_MSP_DisplayPort::probe(AP_OSD &osd) } return backend; } + +// return a correction factor used to display angles correctly +float AP_OSD_MSP_DisplayPort::get_aspect_ratio_correction() const +{ + return 12.0/18.0; +} + + #endif diff --git a/libraries/AP_OSD/AP_OSD_MSP_DisplayPort.h b/libraries/AP_OSD/AP_OSD_MSP_DisplayPort.h index a273edd5db..2cc81eba27 100644 --- a/libraries/AP_OSD/AP_OSD_MSP_DisplayPort.h +++ b/libraries/AP_OSD/AP_OSD_MSP_DisplayPort.h @@ -28,6 +28,8 @@ public: // used to initialize the uart in the correct thread void osd_thread_run_once() override; + // return a correction factor used to display angles correctly + float get_aspect_ratio_correction() const override; protected: uint8_t format_string_for_osd(char* dst, uint8_t size, bool decimal_packed, const char *fmt, va_list ap) override; @@ -211,4 +213,4 @@ private: bool _blink_on; }; -#endif \ No newline at end of file +#endif