Rendering correctly in full screen and small updates

This commit is contained in:
Martin Fasani 2021-06-15 10:59:32 +02:00
parent 588b14f029
commit 4650001bde
3 changed files with 6 additions and 24 deletions

View file

@ -42,9 +42,9 @@ extern "C" {
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7796S #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7796S
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * LV_VER_RES_MAX/3) #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) #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) #elif defined (CONFIG_LV_EPAPER_CALEPD_DISPLAY_CONTROLLER)
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 90) #define DISP_BUF_SIZE (LV_HOR_RES_MAX * 90)

View file

@ -12,8 +12,6 @@ uint8_t temperature = 25;
bool init = true; bool init = true;
// MODE_DU: Fast monochrome | MODE_GC16 slow with 16 grayscales // MODE_DU: Fast monochrome | MODE_GC16 slow with 16 grayscales
enum EpdDrawMode updateMode = MODE_DU; 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 */ /* Display initialization routine */
void epdiy_init(void) void epdiy_init(void)
@ -43,13 +41,6 @@ void buf_copy_to_framebuffer(EpdRect image_area, const uint8_t *image_data) {
assert(framebuffer != NULL); assert(framebuffer != NULL);
for (uint32_t i = 0; i < image_area.width * image_area.height; i++) { 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 uint8_t val = (i % 2) ? (image_data[i / 2] & 0xF0) >> 4
: image_data[i / 2] & 0x0F; : image_data[i / 2] & 0x0F;
int xx = image_area.x + i % image_area.width; 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]); 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); 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); //buf_area_to_framebuffer(area, buf);
epd_hl_update_area(&hl, updateMode, temperature, update_area); //update_area 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_coord_t buf_w, lv_coord_t x, lv_coord_t y,
lv_color_t color, lv_opa_t opa) lv_color_t color, lv_opa_t opa)
{ {
// Debug
if (init) {
printf("Initialize *buf with white\n\n");
for (int i=0; i<BUF_MAX; i++) {
buf[i] = 0xff;
}
init = false;
}
// Test using RGB232 // Test using RGB232
int16_t epd_color = 255; int16_t epd_color = 255;
if ((int16_t)color.full<250) { if ((int16_t)color.full<250) {

View file

@ -24,8 +24,7 @@ void epdiy_init(void);
/* LVGL callbacks */ /* LVGL callbacks */
void epdiy_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map); void epdiy_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map);
/* Only for monochrome displays. But we use epdiy_set_px also for epapers */ /* Sets a pixel in *buf temporary buffer that comes afterwards in flush as *image_map */
//void epdiy_rounder(lv_disp_drv_t *disp_drv, lv_area_t *area);
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); 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);
#ifdef __cplusplus #ifdef __cplusplus