From f47d2671945d522fdc5093891c6796efd24d591c Mon Sep 17 00:00:00 2001 From: martinberlin Date: Sun, 14 Feb 2021 13:07:51 +0100 Subject: [PATCH] #31 Still something to cleanup and correct. 2nd partial repeats bug found before power on data correction (F8) --- components/CalEPD/models/gdeh0154d67.cpp | 26 ++++++++++++++++++------ main/demos/demo-epaper.cpp | 16 +++++++-------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/components/CalEPD/models/gdeh0154d67.cpp b/components/CalEPD/models/gdeh0154d67.cpp index df9dddc..e2d6f38 100644 --- a/components/CalEPD/models/gdeh0154d67.cpp +++ b/components/CalEPD/models/gdeh0154d67.cpp @@ -95,6 +95,7 @@ void Gdeh0154d67::_wakeUp(){ void Gdeh0154d67::update() { + uint64_t startTime = esp_timer_get_time(); initFullUpdate(); _using_partial_mode = false; _initial_refresh = true; @@ -110,11 +111,19 @@ void Gdeh0154d67::update() IO.data(~data); } } + uint64_t endTime = esp_timer_get_time(); + IO.cmd(0x22); IO.data(0xf7); IO.cmd(0x20); _waitBusy("_Update_Full", full_refresh_time); + uint64_t updateTime = esp_timer_get_time(); + + printf("\n\nSTATS (ms)\n%llu _wakeUp settings+send Buffer\n%llu update \n%llu total time in millis\n", + (endTime - startTime) / 1000, (updateTime - endTime) / 1000, (updateTime - startTime) / 1000); + + _sleep(); } @@ -188,10 +197,11 @@ void Gdeh0154d67::updateWindow(int16_t x, int16_t y, int16_t w, int16_t h, bool return; } - printf("updateWindow()\n"); - /* if (!_initial_refresh) { + if (!_initial_refresh) { + printf("updateWindow() doing initial refresh\n"); update(); - } */ + } + uint64_t startTime = esp_timer_get_time(); uint16_t xe = gx_uint16_min(GDEH0154D67_WIDTH, x + w) - 1; uint16_t ye = gx_uint16_min(GDEH0154D67_HEIGHT, y + h) - 1; @@ -214,14 +224,18 @@ void Gdeh0154d67::updateWindow(int16_t x, int16_t y, int16_t w, int16_t h, bool IO.data(~data); } } - + uint64_t endTime = esp_timer_get_time(); + // Update partial IO.cmd(0x22); IO.data(0xff); IO.cmd(0x20); - vTaskDelay(GDEH0154D67_PU_DELAY/portTICK_RATE_MS); + uint64_t updateTime = esp_timer_get_time(); - return; // Stop here without erasing buffer + printf("\n\nSTATS (ms)\n%llu _wakeUp settings+send Buffer\n%llu update \n%llu total time in millis\n", + (endTime - startTime) / 1000, (updateTime - endTime) / 1000, (updateTime - startTime) / 1000); + + vTaskDelay(GDEH0154D67_PU_DELAY/portTICK_RATE_MS); // update erase buffer _SetRamArea(xs_d8, xe_d8, y % 256, y / 256, ye % 256, ye / 256); // X-source area,Y-gate area diff --git a/main/demos/demo-epaper.cpp b/main/demos/demo-epaper.cpp index 963e037..cb2e70e 100644 --- a/main/demos/demo-epaper.cpp +++ b/main/demos/demo-epaper.cpp @@ -43,15 +43,13 @@ void demoPartialUpdate(uint16_t bkcolor, uint16_t fgcolor, uint16_t box_x, uint1 display.setTextColor(fgcolor); uint16_t box_w = display.width() - box_x - 10; - uint16_t box_h = 120; + uint16_t box_h = 60; printf("Partial update box x:%d y:%d width:%d height:%d\n", box_x, box_y, box_w, box_h); uint16_t cursor_y = box_y + 20; display.fillRect(box_x, box_y, box_w, box_h, bkcolor); - display.setCursor(box_x, cursor_y + 40); + display.setCursor(box_x, cursor_y + 20); display.setFont(&Ubuntu_M18pt8b); display.println("PARTIAL"); - display.setCursor(box_x, cursor_y + 70); - display.println("REFRESH"); //display.update(); // Full update works good // Partial does not (Black is not full black) display.updateWindow(box_x, box_y, box_w, box_h, true); @@ -81,7 +79,7 @@ void app_main(void) display.init(false); //display.setRotation(2); - display.update(); + //display.update(); //delay(1000); // Sizes are calculated dividing the screen in 4 equal parts it may not be perfect for all models @@ -93,11 +91,11 @@ void app_main(void) printf("display.colors_supported:%d\n", display.colors_supported); foregroundColor = EPD_RED; } - /* display.fillScreen(EPD_RED); - display.update(); - return; // STOP */ - + + // draw two different partial updates demoPartialUpdate(EPD_BLACK, EPD_WHITE,10,10); + delay(2000); + demoPartialUpdate(EPD_WHITE, EPD_BLACK,10,100); return; uint16_t firstBlock = display.width()/4;