Skip to content

Commit

Permalink
#31 Make cleaning buffer 7x faster
Browse files Browse the repository at this point in the history
  • Loading branch information
martinberlin committed Feb 14, 2021
1 parent 3740d66 commit 140e63d
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions components/CalEPD/models/gdeh0154d67.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ void Gdeh0154d67::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_
}

void Gdeh0154d67::_wakeUp(){
printf("wakeup() start commands\n");

IO.cmd(0x12);
_waitBusy("epd_wakeup_power:ON", power_on_time);
IO.cmd(0x01); // Driver output control
Expand Down Expand Up @@ -225,6 +223,7 @@ 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
Expand All @@ -234,17 +233,29 @@ void Gdeh0154d67::updateWindow(int16_t x, int16_t y, int16_t w, int16_t h, bool
_waitBusy("partial_update", 100);
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);


// Clean buffer: 0x01 is essential
_setRamDataEntryMode(0x01);

// v2 SPI optimizing. Check: https://github.com/martinberlin/cale-idf/wiki/About-SPI-optimization
IO.cmd(0x24);
for (int16_t x1 = xs_d8; x1 <= GDEH0154D67_BUFFER_SIZE; x1++)

uint8_t xLineBytes = GDEH0154D67_WIDTH / 8;
uint8_t x1buf[xLineBytes];
for (uint16_t y = 1; y <= GDEH0154D67_HEIGHT; y++)
{
IO.data(0xFF);
for (uint16_t x = 1; x <= xLineBytes; x++)
{
x1buf[x - 1] = 0xFF;
}
IO.data(x1buf, sizeof(x1buf));
}

uint64_t cleanTime = esp_timer_get_time();
printf("\n\nSTATS (ms)\n%llu _wakeUp settings+send Buffer\n%llu update \nclean_buffer:%llu\n%llu total time in millis\n",
(endTime - startTime) / 1000, (updateTime - endTime) / 1000, (cleanTime - updateTime) / 1000, (cleanTime - startTime) / 1000);


}

void Gdeh0154d67::_waitBusy(const char* message, uint16_t busy_time){
Expand Down

0 comments on commit 140e63d

Please sign in to comment.