From f12df8c69bd9a39ff45e6a8d5f618e917d47b670 Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Sun, 4 Oct 2020 16:08:11 +1300 Subject: [PATCH] Merge pull request #10229 from etracer65/msp_displayport_fix Remove unnecessary drawScreen() calls for MSP displayPort OSD --- src/main/osd/osd.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/osd/osd.c b/src/main/osd/osd.c index 874c3cc497..b2a6c977d3 100644 --- a/src/main/osd/osd.c +++ b/src/main/osd/osd.c @@ -1036,8 +1036,18 @@ void osdUpdate(timeUs_t currentTimeUs) osdRefresh(currentTimeUs); showVisualBeeper = false; } else { - // rest of time redraw screen 10 chars per idle so it doesn't lock the main idle - displayDrawScreen(osdDisplayPort); + bool doDrawScreen = true; +#if defined(USE_CMS) && defined(USE_MSP_DISPLAYPORT) && defined(USE_OSD_OVER_MSP_DISPLAYPORT) + // For the MSP displayPort device only do the drawScreen once per + // logical OSD cycle as there is no output buffering needing to be flushed. + if (osdDisplayPortDeviceType == OSD_DISPLAYPORT_DEVICE_MSP) { + doDrawScreen = (counter % DRAW_FREQ_DENOM == 1); + } +#endif + // Redraw a portion of the chars per idle to spread out the load and SPI bus utilization + if (doDrawScreen) { + displayDrawScreen(osdDisplayPort); + } } ++counter; }