diff --git a/esphome/components/waveshare_epaper/waveshare_213v3.cpp b/esphome/components/waveshare_epaper/waveshare_213v3.cpp index 196aeed3f7..3748f74d70 100644 --- a/esphome/components/waveshare_epaper/waveshare_213v3.cpp +++ b/esphome/components/waveshare_epaper/waveshare_213v3.cpp @@ -86,7 +86,11 @@ void WaveshareEPaper2P13InV3::send_reset_() { } void WaveshareEPaper2P13InV3::setup() { - setup_pins_(); + this->init_internal_(this->get_buffer_length_()); + this->setup_pins_(); + this->spi_setup(); + this->reset_(); + delay(20); this->send_reset_(); // as a one-off delay this is not worth working around. diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.cpp b/esphome/components/waveshare_epaper/waveshare_epaper.cpp index a2c08d4683..74024a285e 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.cpp +++ b/esphome/components/waveshare_epaper/waveshare_epaper.cpp @@ -111,8 +111,14 @@ static const uint8_t PARTIAL_UPD_2IN9_LUT[PARTIAL_UPD_2IN9_LUT_SIZE] = }; // clang-format on -void WaveshareEPaperBase::setup_pins_() { +void WaveshareEPaperBase::setup() { this->init_internal_(this->get_buffer_length_()); + this->setup_pins_();//was in setup + this->spi_setup(); + this->reset_(); + this->initialize();//was in setup +} +void WaveshareEPaperBase::setup_pins_() { this->dc_pin_->setup(); // OUTPUT this->dc_pin_->digital_write(false); if (this->reset_pin_ != nullptr) { @@ -122,9 +128,6 @@ void WaveshareEPaperBase::setup_pins_() { if (this->busy_pin_ != nullptr) { this->busy_pin_->setup(); // INPUT } - this->spi_setup(); - - this->reset_(); } float WaveshareEPaperBase::get_setup_priority() const { return setup_priority::PROCESSOR; } void WaveshareEPaperBase::command(uint8_t value) { diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.h b/esphome/components/waveshare_epaper/waveshare_epaper.h index d6776bc6d1..e840fee05c 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.h +++ b/esphome/components/waveshare_epaper/waveshare_epaper.h @@ -27,10 +27,7 @@ class WaveshareEPaperBase : public display::DisplayBuffer, void update() override; - void setup() override { - this->setup_pins_(); - this->initialize(); - } + void setup() override; void on_safe_shutdown() override;