From 7aa1c83f586612cd0d9d0c5c3beec1b40d370304 Mon Sep 17 00:00:00 2001 From: whowechina Date: Tue, 18 Jun 2024 10:57:09 +0800 Subject: [PATCH] Minor gui loop change fix --- firmware/src/gui.c | 10 +++++++--- firmware/src/st7789.c | 2 +- firmware/src/st7789.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/firmware/src/gui.c b/firmware/src/gui.c index 2d4da4a..4fe986b 100644 --- a/firmware/src/gui.c +++ b/firmware/src/gui.c @@ -406,8 +406,6 @@ static void sliding_render() void gui_loop() { - event_proc(); - run_background(); if (slide.sliding) { @@ -416,5 +414,11 @@ void gui_loop() pages[curr_page].render(); } - st7789_render(true); + st7789_flush(false); + + /* Control things when updating LCD */ + gui_level(aic_cfg->lcd.backlight); + event_proc(); + + st7789_vsync(); } diff --git a/firmware/src/st7789.c b/firmware/src/st7789.c index 39cd0e2..cc7fe02 100644 --- a/firmware/src/st7789.c +++ b/firmware/src/st7789.c @@ -196,7 +196,7 @@ void st7789_vsync() dma_channel_wait_for_finish_blocking(ctx.spi_dma); } -void st7789_render(bool vsync) +void st7789_flush(bool vsync) { if (dma_channel_is_busy(ctx.spi_dma)) { return; diff --git a/firmware/src/st7789.h b/firmware/src/st7789.h index 1f6eb2d..07fc096 100644 --- a/firmware/src/st7789.h +++ b/firmware/src/st7789.h @@ -18,7 +18,7 @@ uint16_t st7789_get_crop_width(); uint16_t st7789_get_crop_height(); void st7789_dimmer(uint8_t level); void st7789_vsync(); -void st7789_render(bool vsync); +void st7789_flush(bool vsync); #define st7789_rgb32(r, g, b) ((r << 16) | (g << 8) | b) #define st7789_rgb565(rgb32) ((rgb32 >> 8) & 0xf800) | ((rgb32 >> 5) & 0x0780) | ((rgb32 >> 3) & 0x001f)