Skip to content

Commit

Permalink
#31 Correcting partial Update. Power on mode has to be F8
Browse files Browse the repository at this point in the history
  • Loading branch information
martinberlin committed Feb 14, 2021
1 parent 5f5988d commit 4faed14
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion components/CalEPD/include/gdeh0154d67.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class Gdeh0154d67 : public Epd
Gdeh0154d67(EpdSpi& IO);
uint8_t colors_supported = 1;
bool _initial_refresh = false;
bool _power_is_on = false;
bool _using_partial_mode = false;

static const uint16_t power_on_time = 100; // ms, e.g. 95583us
static const uint16_t power_off_time = 150; // ms, e.g. 140621us
static const uint16_t full_refresh_time = 2600; // ms, e.g. 2509602us
Expand Down
16 changes: 10 additions & 6 deletions components/CalEPD/models/gdeh0154d67.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ void Gdeh0154d67::_wakeUp(){
void Gdeh0154d67::update()
{
initFullUpdate();
_using_partial_mode = false;
_initial_refresh = true;
printf("BUFF Size:%d\n",sizeof(_buffer));

Expand Down Expand Up @@ -124,6 +125,7 @@ void Gdeh0154d67::_setRamDataEntryMode(uint8_t em)
em = gx_uint16_min(em, 0x03);
IO.cmd(0x11);
IO.data(em);

switch (em)
{
case 0x00: // x decrease, y decrease
Expand Down Expand Up @@ -168,9 +170,8 @@ void Gdeh0154d67::_SetRamPointer(uint8_t addrX, uint8_t addrY, uint8_t addrY1)

void Gdeh0154d67::_PowerOn(void)
{
_power_is_on = true;
IO.cmd(0x22);
IO.data(0xc0);
IO.data(0xf8);
IO.cmd(0x20);
_waitBusy("_PowerOn", power_on_time);
}
Expand All @@ -196,7 +197,9 @@ void Gdeh0154d67::updateWindow(int16_t x, int16_t y, int16_t w, int16_t h, bool
uint16_t ye = gx_uint16_min(GDEH0154D67_HEIGHT, y + h) - 1;
uint16_t xs_d8 = x / 8;
uint16_t xe_d8 = xe / 8;

initPartialUpdate();

_SetRamArea(xs_d8, xe_d8, y % 256, y / 256, ye % 256, ye / 256); // X-source area,Y-gate area
_SetRamPointer(xs_d8, y % 256, y / 256); // set ram
_waitBusy("ram_pointer1", 100);
Expand All @@ -216,10 +219,11 @@ void Gdeh0154d67::updateWindow(int16_t x, int16_t y, int16_t w, int16_t h, bool
IO.cmd(0x22);
IO.data(0xff);
IO.cmd(0x20);
_waitBusy("_Update_Part", partial_refresh_time);
//vTaskDelay(GDEH0154D67_PU_DELAY/portTICK_RATE_MS);
vTaskDelay(GDEH0154D67_PU_DELAY/portTICK_RATE_MS);

return; // Stop here without erasing buffer

// update erase buffer
// update erase buffer
_SetRamArea(xs_d8, xe_d8, y % 256, y / 256, ye % 256, ye / 256); // X-source area,Y-gate area
_SetRamPointer(xs_d8, y % 256, y / 256); // set ram
_waitBusy("ram_pointer2", 100);
Expand All @@ -234,6 +238,7 @@ void Gdeh0154d67::updateWindow(int16_t x, int16_t y, int16_t w, int16_t h, bool
}
}
vTaskDelay(GDEH0154D67_PU_DELAY/portTICK_RATE_MS);

}

void Gdeh0154d67::_waitBusy(const char* message, uint16_t busy_time){
Expand Down Expand Up @@ -276,7 +281,6 @@ void Gdeh0154d67::_waitBusy(const char* message){
}

void Gdeh0154d67::_sleep(){
_power_is_on = false;
IO.cmd(0x22); // power off display
IO.data(0xc3);
IO.cmd(0x20);
Expand Down
4 changes: 3 additions & 1 deletion main/demos/demo-epaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ void demoPartialUpdate(uint16_t bkcolor, uint16_t fgcolor, uint16_t box_x, uint1
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 @@ -95,7 +97,7 @@ void app_main(void)
display.update();
return; // STOP */

demoPartialUpdate(EPD_BLACK,EPD_WHITE,10,10);
demoPartialUpdate(EPD_BLACK, EPD_WHITE,10,10);
return;

uint16_t firstBlock = display.width()/4;
Expand Down

0 comments on commit 4faed14

Please sign in to comment.