implemented BWR Mode for WaveshareEPaper7P5InBV3

This commit is contained in:
Jonas B 2024-10-27 18:20:58 +01:00
parent 1e2497748d
commit 523d19053e
3 changed files with 15 additions and 9 deletions

View file

@ -1,7 +1,7 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import core, pins from esphome import core, pins
import esphome.codegen as cg
from esphome.components import display, spi from esphome.components import display, spi
import esphome.config_validation as cv
from esphome.const import ( from esphome.const import (
CONF_BUSY_PIN, CONF_BUSY_PIN,
CONF_DC_PIN, CONF_DC_PIN,
@ -74,7 +74,7 @@ WaveshareEPaper7P5InBV2 = waveshare_epaper_ns.class_(
"WaveshareEPaper7P5InBV2", WaveshareEPaper "WaveshareEPaper7P5InBV2", WaveshareEPaper
) )
WaveshareEPaper7P5InBV3 = waveshare_epaper_ns.class_( WaveshareEPaper7P5InBV3 = waveshare_epaper_ns.class_(
"WaveshareEPaper7P5InBV3", WaveshareEPaper "WaveshareEPaper7P5InBV3", WaveshareEPaperBWR
) )
WaveshareEPaper7P5InV2 = waveshare_epaper_ns.class_( WaveshareEPaper7P5InV2 = waveshare_epaper_ns.class_(
"WaveshareEPaper7P5InV2", WaveshareEPaper "WaveshareEPaper7P5InV2", WaveshareEPaper

View file

@ -2213,7 +2213,7 @@ void WaveshareEPaper7P5InBV3::init_display_() {
this->wait_until_idle_(); this->wait_until_idle_();
// COMMAND PANEL SETTING // COMMAND PANEL SETTING
this->command(0x00); this->command(0x00);
this->data(0x3F); // KW-3f KWR-2F BWROTP 0f BWOTP 1f this->data(0x0F); // KW-3f KWR-2F BWROTP 0f BWOTP 1f
// COMMAND RESOLUTION SETTING // COMMAND RESOLUTION SETTING
this->command(0x61); this->command(0x61);
@ -2226,7 +2226,7 @@ void WaveshareEPaper7P5InBV3::init_display_() {
this->data(0x00); this->data(0x00);
// COMMAND VCOM AND DATA INTERVAL SETTING // COMMAND VCOM AND DATA INTERVAL SETTING
this->command(0x50); this->command(0x50);
this->data(0x10); this->data(0x20);
this->data(0x00); this->data(0x00);
// COMMAND TCON SETTING // COMMAND TCON SETTING
this->command(0x60); this->command(0x60);
@ -2286,17 +2286,23 @@ void WaveshareEPaper7P5InBV3::init_display_() {
}; };
void HOT WaveshareEPaper7P5InBV3::display() { void HOT WaveshareEPaper7P5InBV3::display() {
this->init_display_(); this->init_display_();
uint32_t buf_len = this->get_buffer_length_(); const uint32_t buf_len = this->get_buffer_length_() / 2u;
this->command(0x10); /*this->command(0x10);
for (uint32_t i = 0; i < buf_len; i++) { for (uint32_t i = 0; i < buf_len; i++) {
this->data(0xFF); this->data(0xFF);
}*/
this->command(0x10); // Start Transmission
delay(2);
for (uint32_t i = 0; i < buf_len; i++) {
this->data(this->buffer_[i]);
} }
this->command(0x13); // Start Transmission this->command(0x13); // Start Transmission
delay(2); delay(2);
for (uint32_t i = 0; i < buf_len; i++) { for (uint32_t i = 0; i < buf_len; i++) {
this->data(~this->buffer_[i]); this->data(this->buffer_[i + buf_len]);
} }
this->command(0x12); // Display Refresh this->command(0x12); // Display Refresh

View file

@ -581,7 +581,7 @@ class WaveshareEPaper7P5InBV2 : public WaveshareEPaper {
int get_height_internal() override; int get_height_internal() override;
}; };
class WaveshareEPaper7P5InBV3 : public WaveshareEPaper { class WaveshareEPaper7P5InBV3 : public WaveshareEPaperBWR {
public: public:
bool wait_until_idle_(); bool wait_until_idle_();