From 4650001bdedc898b0cc18eaef332aafe8d4da7e2 Mon Sep 17 00:00:00 2001 From: Martin Fasani Date: Tue, 15 Jun 2021 10:59:32 +0200 Subject: [PATCH] Rendering correctly in full screen and small updates --- lvgl_helpers.h | 4 ++-- lvgl_tft/epdiy_epaper.cpp | 23 +++-------------------- lvgl_tft/epdiy_epaper.h | 3 +-- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/lvgl_helpers.h b/lvgl_helpers.h index dae0c35..7fea4bf 100644 --- a/lvgl_helpers.h +++ b/lvgl_helpers.h @@ -42,9 +42,9 @@ extern "C" { #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7796S #define DISP_BUF_SIZE (LV_HOR_RES_MAX * LV_VER_RES_MAX/3) -// Here is the issue that it does not draw full epaper. Insufficient buffer: +// IMPORTANT: This will render the screen in 10 times: #elif defined (CONFIG_LV_EPAPER_EPDIY_DISPLAY_CONTROLLER) -#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 38) + #define DISP_BUF_SIZE LV_HOR_RES_MAX*(LV_VER_RES_MAX/10) #elif defined (CONFIG_LV_EPAPER_CALEPD_DISPLAY_CONTROLLER) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 90) diff --git a/lvgl_tft/epdiy_epaper.cpp b/lvgl_tft/epdiy_epaper.cpp index 898889b..784096a 100644 --- a/lvgl_tft/epdiy_epaper.cpp +++ b/lvgl_tft/epdiy_epaper.cpp @@ -12,8 +12,6 @@ uint8_t temperature = 25; bool init = true; // MODE_DU: Fast monochrome | MODE_GC16 slow with 16 grayscales enum EpdDrawMode updateMode = MODE_DU; -// Ideally this BUF should be width/2*height = 259200. Now set to 111600 -#define BUF_MAX 110400 /* Display initialization routine */ void epdiy_init(void) @@ -43,13 +41,6 @@ void buf_copy_to_framebuffer(EpdRect image_area, const uint8_t *image_data) { assert(framebuffer != NULL); for (uint32_t i = 0; i < image_area.width * image_area.height; i++) { - // Get out if we get the end of the buffer. Question: How to detect the end without a lenght? - // Zero terminator check gets out before: (image_data[value_index / 2]== '\0') - // 111684 seems to be the last element in image_data - /* if (i / 2 > BUF_MAX) { - printf("FOUND END incr:%d Aw:%d Ah:%d\n", i, image_area.width, image_area.height); - break; - } */ uint8_t val = (i % 2) ? (image_data[i / 2] & 0xF0) >> 4 : image_data[i / 2] & 0x0F; int xx = image_area.x + i % image_area.width; @@ -90,10 +81,11 @@ void epdiy_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_ma printf("%x ", buf[index]); } */ - // Does not work for full screen update yet (Should check large of buf) + // UNCOMMENT only one of this options + // SAFE Option with EPDiy copy of epd_copy_to_framebuffer buf_copy_to_framebuffer(update_area, buf); - //Faster mode suggested in LVGL forum (Leaves ghosting) + //Faster mode suggested in LVGL forum (Leaves ghosting&prints bad sections / experimental) NOTE: Do NOT use in production //buf_area_to_framebuffer(area, buf); epd_hl_update_area(&hl, updateMode, temperature, update_area); //update_area @@ -110,15 +102,6 @@ void epdiy_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t* buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa) { - // Debug - if (init) { - printf("Initialize *buf with white\n\n"); - for (int i=0; i