Skip to content

Commit

Permalink
#31 Still something to cleanup and correct. 2nd partial repeats bug f…
Browse files Browse the repository at this point in the history
…ound before power on data correction (F8)
  • Loading branch information
martinberlin committed Feb 14, 2021
1 parent 4faed14 commit f47d267
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
26 changes: 20 additions & 6 deletions components/CalEPD/models/gdeh0154d67.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}

Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down
16 changes: 7 additions & 9 deletions main/demos/demo-epaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit f47d267

Please sign in to comment.