Change buffer sending process for waveshare_epaper (2.70in) (#1031)

* Change buffer sending process for waveshare_epaper (2.70in)

The current way ESPhome sending buffer to WaveshareEPaper2P7In does not show the expected content on the display, this commit is changing the data transferring process so the content is showing as expected.

The process is adapted from the demo code provided by Waveshare, manufacturer of the E-paper display.

* Fix linting eror
This commit is contained in:
ukewea 2020-04-25 22:00:52 +08:00 committed by GitHub
parent c9e224e999
commit bab0ba9c0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -425,20 +425,22 @@ void WaveshareEPaper2P7In::initialize() {
this->data(i); this->data(i);
} }
void HOT WaveshareEPaper2P7In::display() { void HOT WaveshareEPaper2P7In::display() {
uint32_t buf_len = this->get_buffer_length_();
// COMMAND DATA START TRANSMISSION 1 // COMMAND DATA START TRANSMISSION 1
this->command(0x10); this->command(0x10);
delay(2); delay(2);
this->start_data_(); for (uint32_t i = 0; i < buf_len; i++) {
this->write_array(this->buffer_, this->get_buffer_length_()); this->data(this->buffer_[i]);
this->end_data_(); }
delay(2); delay(2);
// COMMAND DATA START TRANSMISSION 2 // COMMAND DATA START TRANSMISSION 2
this->command(0x13); this->command(0x13);
delay(2); delay(2);
this->start_data_(); for (uint32_t i = 0; i < buf_len; i++) {
this->write_array(this->buffer_, this->get_buffer_length_()); this->data(this->buffer_[i]);
this->end_data_(); }
// COMMAND DISPLAY REFRESH // COMMAND DISPLAY REFRESH
this->command(0x12); this->command(0x12);