From 93d13c36eb2882a2ab13bd1eed71200929aebd37 Mon Sep 17 00:00:00 2001 From: bkleiner Date: Sun, 12 Jan 2025 01:55:41 +0100 Subject: [PATCH] osd: add rolling refresh for hd systems --- src/driver/osd/osd.c | 16 ++++++++++++++++ src/driver/osd/osd.h | 1 + src/osd/render.c | 2 ++ 3 files changed, 19 insertions(+) diff --git a/src/driver/osd/osd.c b/src/driver/osd/osd.c index 55d8815ff..a63fecb5c 100644 --- a/src/driver/osd/osd.c +++ b/src/driver/osd/osd.c @@ -79,6 +79,22 @@ void osd_clear() { ; } +void osd_mark_row_dirty() { + static uint8_t row = 0; + + bool did_change = false; + const uint16_t offset = row * cols; + for (uint32_t i = 0; i < cols; i++) { + if (display[offset + i].val != ' ') { + display[offset + i].dirty = 1; + did_change = true; + } + } + display_dirty = display_row_dirty[row] = did_change; + + row = (row + 1) % rows; +} + uint8_t osd_clear_async() { static uint8_t state = 0; diff --git a/src/driver/osd/osd.h b/src/driver/osd/osd.h index f95f00efb..ff995bda4 100644 --- a/src/driver/osd/osd.h +++ b/src/driver/osd/osd.h @@ -60,6 +60,7 @@ bool osd_is_ready(); bool osd_update(); void osd_clear(); +void osd_mark_row_dirty(); uint8_t osd_clear_async(); void osd_display_refresh(); diff --git a/src/osd/render.c b/src/osd/render.c index dc6a04bf1..08cfc71a1 100644 --- a/src/osd/render.c +++ b/src/osd/render.c @@ -531,6 +531,8 @@ static void osd_display_regular() { // display warning if we can not detect a camera osd_start(OSD_ATTR_BLINK, 7, 7); osd_write_str("NO CAMERA SIGNAL"); + } else if (osd_system == OSD_SYS_HD) { + osd_mark_row_dirty(); } osd_state.element = 0; break;