From 523d19053edb9760026dffb70b791f3f93e4ea11 Mon Sep 17 00:00:00 2001 From: Jonas B Date: Sun, 27 Oct 2024 18:20:58 +0100 Subject: [PATCH] implemented BWR Mode for WaveshareEPaper7P5InBV3 --- esphome/components/waveshare_epaper/display.py | 6 +++--- .../waveshare_epaper/waveshare_epaper.cpp | 16 +++++++++++----- .../waveshare_epaper/waveshare_epaper.h | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/esphome/components/waveshare_epaper/display.py b/esphome/components/waveshare_epaper/display.py index 4d3965449f..017f97c534 100644 --- a/esphome/components/waveshare_epaper/display.py +++ b/esphome/components/waveshare_epaper/display.py @@ -1,7 +1,7 @@ -import esphome.codegen as cg -import esphome.config_validation as cv from esphome import core, pins +import esphome.codegen as cg from esphome.components import display, spi +import esphome.config_validation as cv from esphome.const import ( CONF_BUSY_PIN, CONF_DC_PIN, @@ -74,7 +74,7 @@ WaveshareEPaper7P5InBV2 = waveshare_epaper_ns.class_( "WaveshareEPaper7P5InBV2", WaveshareEPaper ) WaveshareEPaper7P5InBV3 = waveshare_epaper_ns.class_( - "WaveshareEPaper7P5InBV3", WaveshareEPaper + "WaveshareEPaper7P5InBV3", WaveshareEPaperBWR ) WaveshareEPaper7P5InV2 = waveshare_epaper_ns.class_( "WaveshareEPaper7P5InV2", WaveshareEPaper diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.cpp b/esphome/components/waveshare_epaper/waveshare_epaper.cpp index 7c1d436673..f1bc835d30 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.cpp +++ b/esphome/components/waveshare_epaper/waveshare_epaper.cpp @@ -2213,7 +2213,7 @@ void WaveshareEPaper7P5InBV3::init_display_() { this->wait_until_idle_(); // COMMAND PANEL SETTING 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 this->command(0x61); @@ -2226,7 +2226,7 @@ void WaveshareEPaper7P5InBV3::init_display_() { this->data(0x00); // COMMAND VCOM AND DATA INTERVAL SETTING this->command(0x50); - this->data(0x10); + this->data(0x20); this->data(0x00); // COMMAND TCON SETTING this->command(0x60); @@ -2286,17 +2286,23 @@ void WaveshareEPaper7P5InBV3::init_display_() { }; void HOT WaveshareEPaper7P5InBV3::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++) { 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 delay(2); 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 diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.h b/esphome/components/waveshare_epaper/waveshare_epaper.h index 7572982a20..97715f6552 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.h +++ b/esphome/components/waveshare_epaper/waveshare_epaper.h @@ -581,7 +581,7 @@ class WaveshareEPaper7P5InBV2 : public WaveshareEPaper { int get_height_internal() override; }; -class WaveshareEPaper7P5InBV3 : public WaveshareEPaper { +class WaveshareEPaper7P5InBV3 : public WaveshareEPaperBWR { public: bool wait_until_idle_();