Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_OSD:add aspect ratio correction for DisplayPort #22901

Merged
merged 1 commit into from Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/AP_OSD/AP_OSD_Backend.h
Expand Up @@ -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) {}
Expand All @@ -51,7 +51,7 @@ class AP_OSD_Backend
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);
Expand Down
8 changes: 8 additions & 0 deletions libraries/AP_OSD/AP_OSD_MSP_DisplayPort.cpp
Expand Up @@ -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;
Hwurzburg marked this conversation as resolved.
Show resolved Hide resolved
}


#endif
4 changes: 3 additions & 1 deletion libraries/AP_OSD/AP_OSD_MSP_DisplayPort.h
Expand Up @@ -28,6 +28,8 @@ class AP_OSD_MSP_DisplayPort : public AP_OSD_Backend
// 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;
Expand Down Expand Up @@ -211,4 +213,4 @@ class AP_OSD_MSP_DisplayPort : public AP_OSD_Backend

bool _blink_on;
};
#endif
#endif