Update callbacks to support also fast update MODE_DU configurable with updateMode enum

This commit is contained in:
martinberlin 2021-06-13 09:42:19 +02:00
parent 97a330ca42
commit 255a1a7680
2 changed files with 11 additions and 5 deletions

View file

@ -10,6 +10,9 @@ uint16_t flushcalls = 0;
uint8_t * framebuffer; uint8_t * framebuffer;
uint8_t temperature = 25; uint8_t temperature = 25;
bool init = true; bool init = true;
// MODE_DU: Fast monochrome | MODE_GC16 slow with 16 grayscales
enum EpdDrawMode updateMode = MODE_DU;
#define BUF_MAX 111600 #define BUF_MAX 111600
/* Display initialization routine */ /* Display initialization routine */
@ -78,7 +81,7 @@ void epdiy_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_ma
// Does not work for full screen update yet (Should check large of buf) // Does not work for full screen update yet (Should check large of buf)
buf_copy_to_framebuffer(update_area, buf); buf_copy_to_framebuffer(update_area, buf);
epd_hl_update_area(&hl, MODE_GC16, temperature, update_area); //update_area epd_hl_update_area(&hl, updateMode, temperature, update_area); //update_area
printf("epdiy_flush %d x:%d y:%d w:%d h:%d\n", flushcalls,(uint16_t)area->x1,(uint16_t)area->y1,w,h); printf("epdiy_flush %d x:%d y:%d w:%d h:%d\n", flushcalls,(uint16_t)area->x1,(uint16_t)area->y1,w,h);
/* Inform the graphics library that you are ready with the flushing */ /* Inform the graphics library that you are ready with the flushing */
@ -105,7 +108,7 @@ void epdiy_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t* buf,
// 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) {
epd_color = (int16_t)color.full/3; epd_color = (updateMode==MODE_DU) ? 0 : (int16_t)color.full/3;
} }
//Instead of using epd_draw_pixel: Set pixel directly in *buf that comes afterwards in flush as *color_map //Instead of using epd_draw_pixel: Set pixel directly in *buf that comes afterwards in flush as *color_map

View file

@ -7,9 +7,12 @@
#include "epd_driver.h" #include "epd_driver.h"
#include "epd_highlevel.h" #include "epd_highlevel.h"
/********************* /**************************************************************************************************
* DEFINES * NOTE: This file iis the first version that writes directly on the set_px callback
*********************/ * each pixel into the epaper display buffer. The second version is not epdiy_epaper.cpp
* It writes *buf and then it comes as *color_map on the flush callback.
* Feel free to experiment with this 2. epdiy_epaper.cpp works better to make a small UX
**************************************************************************************************/
#define TAG "EPDIY" #define TAG "EPDIY"
EpdiyHighlevelState hl; EpdiyHighlevelState hl;
uint16_t flushcalls = 0; uint16_t flushcalls = 0;