From 28776d9169fa09e8d84c2eedffd02ba50884c0da Mon Sep 17 00:00:00 2001 From: Tim Pehla Date: Mon, 11 Nov 2024 18:40:52 +0100 Subject: [PATCH] 1. Added comment "// NOLINT" after delay() 2. Updated formatting --- .../waveshare_epaper/waveshare_epaper.cpp | 32 ++++++------- .../waveshare_epaper/waveshare_epaper.h | 46 +++++++++---------- 2 files changed, 37 insertions(+), 41 deletions(-) diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.cpp b/esphome/components/waveshare_epaper/waveshare_epaper.cpp index 105fdf6b09..38e8b213f5 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.cpp +++ b/esphome/components/waveshare_epaper/waveshare_epaper.cpp @@ -2649,7 +2649,7 @@ bool WaveshareEPaper7P5InV2P::wait_until_idle_() { return false; } App.feed_wdt(); - delay(10); + delay(10); // NOLINT } return true; } @@ -2657,22 +2657,21 @@ bool WaveshareEPaper7P5InV2P::wait_until_idle_() { void WaveshareEPaper7P5InV2P::reset_() { if (this->reset_pin_ != nullptr) { this->reset_pin_->digital_write(true); - delay(20); + delay(20); // NOLINT this->reset_pin_->digital_write(false); - delay(2); + delay(2); // NOLINT this->reset_pin_->digital_write(true); - delay(20); + delay(20); // NOLINT } } void WaveshareEPaper7P5InV2P::turn_on_display_() { this->command(0x12); - delay(100); + delay(100); // NOLINT this->wait_until_idle_(); } void WaveshareEPaper7P5InV2P::initialize() { - this->reset_(); // COMMAND POWER SETTING @@ -2691,7 +2690,7 @@ void WaveshareEPaper7P5InV2P::initialize() { // COMMAND POWER DRIVER HAT UP this->command(0x04); - delay(100); + delay(100); // NOLINT this->wait_until_idle_(); // COMMAND PANEL SETTING @@ -2735,11 +2734,10 @@ void HOT WaveshareEPaper7P5InV2P::display() { ESP_LOGI(TAG, "Power on the display and hat"); this->command(0x04); - delay(200); + delay(200); // NOLINT this->wait_until_idle_(); if (this->full_update_every_ == 1) { - this->command(0x13); for (uint32_t i = 0; i < buf_len; i++) { this->data(~(this->buffer_[i])); @@ -2757,7 +2755,6 @@ void HOT WaveshareEPaper7P5InV2P::display() { this->data(0x07); if (this->at_update_ == 0) { - // Enable fast refresh this->command(0xE5); this->data(0x5A); @@ -2765,27 +2762,26 @@ void HOT WaveshareEPaper7P5InV2P::display() { this->command(0x92); this->command(0x10); - delay(2); + delay(2); // NOLINT for (uint32_t i = 0; i < buf_len; i++) { this->data(~(this->buffer_[i])); } - delay(100); + delay(100); // NOLINT this->wait_until_idle_(); this->command(0x13); - delay(2); + delay(2); // NOLINT for (uint32_t i = 0; i < buf_len; i++) { this->data(this->buffer_[i]); } - delay(100); + delay(100); // NOLINT this->wait_until_idle_(); this->turn_on_display_(); } else { - // Enable partial refresh this->command(0xE5); this->data(0x6E); @@ -2807,12 +2803,12 @@ void HOT WaveshareEPaper7P5InV2P::display() { this->data(0x01); this->command(0x13); - delay(2); + delay(2); // NOLINT for (uint32_t i = 0; i < buf_len; i++) { this->data(this->buffer_[i]); } - delay(100); + delay(100); // NOLINT this->wait_until_idle_(); this->turn_on_display_(); @@ -2838,7 +2834,7 @@ void WaveshareEPaper7P5InV2P::dump_config() { LOG_PIN(" Busy Pin: ", this->busy_pin_); LOG_UPDATE_INTERVAL(this); } - void WaveshareEPaper7P5InV2P::set_full_update_every(uint32_t full_update_every) { +void WaveshareEPaper7P5InV2P::set_full_update_every(uint32_t full_update_every) { this->full_update_every_ = full_update_every; } diff --git a/esphome/components/waveshare_epaper/waveshare_epaper.h b/esphome/components/waveshare_epaper/waveshare_epaper.h index feb9f99f93..6d9bf1229c 100644 --- a/esphome/components/waveshare_epaper/waveshare_epaper.h +++ b/esphome/components/waveshare_epaper/waveshare_epaper.h @@ -689,40 +689,40 @@ class WaveshareEPaper7P5InV2alt : public WaveshareEPaper7P5InV2 { }; class WaveshareEPaper7P5InV2P : public WaveshareEPaper { - public: - bool wait_until_idle_(); + public: + bool wait_until_idle_(); - void initialize() override; + void initialize() override; - void display() override; + void display() override; - void dump_config() override; + void dump_config() override; - void deep_sleep() override { - // COMMAND POWER OFF - this->command(0x02); - this->wait_until_idle_(); - // COMMAND DEEP SLEEP - this->command(0x07); - this->data(0xA5); // check byte - } + void deep_sleep() override { + // COMMAND POWER OFF + this->command(0x02); + this->wait_until_idle_(); + // COMMAND DEEP SLEEP + this->command(0x07); + this->data(0xA5); // check byte + } - void set_full_update_every(uint32_t full_update_every); + void set_full_update_every(uint32_t full_update_every); - protected: - int get_width_internal() override; + protected: + int get_width_internal() override; - int get_height_internal() override; + int get_height_internal() override; - uint32_t idle_timeout_() override; + uint32_t idle_timeout_() override; - uint32_t full_update_every_{30}; - uint32_t at_update_{0}; + uint32_t full_update_every_{30}; + uint32_t at_update_{0}; - private: - void reset_(); + private: + void reset_(); - void turn_on_display_(); + void turn_on_display_(); }; class WaveshareEPaper7P5InHDB : public WaveshareEPaper {