1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 15:18:16 +00:00

fix: (Component WaveshareEpaper) Correct display tx cmd

This commit is contained in:
rrachasak 2024-12-22 21:09:16 +07:00
parent c39b3781d3
commit 9d5d86b06c
No known key found for this signature in database

View File

@ -1960,22 +1960,17 @@ void WaveshareEPaper4P2InBV2::initialize() {
} }
void HOT WaveshareEPaper4P2InBV2::display() { void HOT WaveshareEPaper4P2InBV2::display() {
const uint32_t buf_half_len = this->get_buffer_length_() / 2u;
// COMMAND DATA START TRANSMISSION 1 (B/W data) // COMMAND DATA START TRANSMISSION 1 (B/W data)
this->command(0x10); this->command(0x10);
this->start_data_(); this->start_data_();
for (size_t i = 0; i < buf_half_len; i++) { this->write_array(this->buffer_, this->get_buffer_length_());
this->data(this->buffer_[i]);
}
this->end_data_(); this->end_data_();
// COMMAND DATA START TRANSMISSION 2 (RED data) // COMMAND DATA START TRANSMISSION 2 (RED data)
this->command(0x13); this->command(0x13);
this->start_data_(); this->start_data_();
for (size_t i = 0; i < buf_half_len; i++) { for (size_t i = 0; i < this->get_buffer_length_(); i++)
this->data(this->buffer_[i + buf_half_len]); this->write_byte(0xFF);
}
this->end_data_(); this->end_data_();
delay(2); delay(2);
@ -2022,19 +2017,20 @@ void WaveshareEPaper4P2InBV2BWR::initialize() {
} }
void HOT WaveshareEPaper4P2InBV2BWR::display() { void HOT WaveshareEPaper4P2InBV2BWR::display() {
// COMMAND DATA START TRANSMISSION 1 (B/W data) const uint32_t buf_len = this->get_buffer_length_() / 2u;
this->command(0x10);
this->start_data_();
this->write_array(this->buffer_, this->get_buffer_length_());
this->end_data_();
// COMMAND DATA START TRANSMISSION 2 (RED data) this->command(0x10); // Send BW data Transmission
this->command(0x13); delay(2); // Delay to prevent Watchdog error
this->start_data_(); for (uint32_t i = 0; i < buf_len; ++i) {
for (size_t i = 0; i < this->get_buffer_length_(); i++) this->data(this->buffer_[i]);
this->write_byte(0xFF); }
this->end_data_();
delay(2); this->command(0x13); // Send red data Transmission
delay(2); // Delay to prevent Watchdog error
for (uint32_t i = 0; i < buf_len; ++i) {
// Red color need to flip bit from the buffer. Otherwise, red will conqure the screen!
this->data(~this->buffer_[buf_len + i]);
}
// COMMAND DISPLAY REFRESH // COMMAND DISPLAY REFRESH
this->command(0x12); this->command(0x12);