1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 01:35:41 +03:00

Add osd_canvas_width/height variables (#12164)

This commit is contained in:
Steve Evans 2023-01-10 02:25:22 +00:00 committed by GitHub
parent 7dd0f60544
commit 1e3fcbfcee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 11 deletions

View file

@ -512,6 +512,14 @@ void osdInit(displayPort_t *osdDisplayPortToUse, osdDisplayPortDevice_e displayP
#endif
if (osdDisplayPort->cols && osdDisplayPort->rows) {
// Ensure that osd_canvas_width/height are correct
if (osdConfig()->canvas_cols != osdDisplayPort->cols) {
osdConfigMutable()->canvas_cols = osdDisplayPort->cols;
}
if (osdConfig()->canvas_rows != osdDisplayPort->rows) {
osdConfigMutable()->canvas_rows = osdDisplayPort->rows;
}
// Ensure that all OSD elements are on the canvas once number of row/columns is known
for (int i = 0; i < OSD_ITEM_COUNT; i++) {
uint16_t itemPos = osdElementConfig()->item_pos[i];