diff --git a/esphome/components/display/display_buffer.h b/esphome/components/display/display_buffer.h index 4b4228443f..b7c4db56be 100644 --- a/esphome/components/display/display_buffer.h +++ b/esphome/components/display/display_buffer.h @@ -25,7 +25,7 @@ class DisplayBuffer : public Display { protected: virtual void draw_absolute_pixel_internal(int x, int y, Color color) = 0; - virtual void init_internal_(uint32_t buffer_length); + void init_internal_(uint32_t buffer_length); uint8_t *buffer_{nullptr}; }; diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.cpp b/esphome/components/waveshare_epaper/waveshare_epaper.cpp index 74024a285e..51ce639a15 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.cpp +++ b/esphome/components/waveshare_epaper/waveshare_epaper.cpp @@ -113,10 +113,10 @@ static const uint8_t PARTIAL_UPD_2IN9_LUT[PARTIAL_UPD_2IN9_LUT_SIZE] = void WaveshareEPaperBase::setup() { this->init_internal_(this->get_buffer_length_()); - this->setup_pins_();//was in setup + this->setup_pins_(); this->spi_setup(); this->reset_(); - this->initialize();//was in setup + this->initialize(); } void WaveshareEPaperBase::setup_pins_() { this->dc_pin_->setup(); // OUTPUT @@ -177,7 +177,14 @@ void WaveshareEPaper::fill(Color color) { for (uint32_t i = 0; i < this->get_buffer_length_(); i++) this->buffer_[i] = fill; } -void WaveshareEPaper7C::init_internal_(uint32_t buffer_length) { +void WaveshareEPaper7C::setup() { + this->init_internal_7c_(this->get_buffer_length_()); + this->setup_pins_(); + this->spi_setup(); + this->reset_(); + this->initialize(); +} +void WaveshareEPaper7C::init_internal_7c_(uint32_t buffer_length) { ExternalRAMAllocator allocator(ExternalRAMAllocator::ALLOW_FAILURE); uint32_t small_buffer_length = buffer_length / NUM_BUFFERS; diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.h b/esphome/components/waveshare_epaper/waveshare_epaper.h index e840fee05c..c414a20de7 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.h +++ b/esphome/components/waveshare_epaper/waveshare_epaper.h @@ -93,7 +93,8 @@ class WaveshareEPaper7C : public WaveshareEPaperBase { protected: void draw_absolute_pixel_internal(int x, int y, Color color) override; uint32_t get_buffer_length_() override; - void init_internal_(uint32_t buffer_length); + void setup() override; + void init_internal_7c_(uint32_t buffer_length); static const int NUM_BUFFERS = 10; uint8_t *buffers_[NUM_BUFFERS];