mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 23:48:11 +01:00
1. Added comment "// NOLINT" after delay()
2. Updated formatting
This commit is contained in:
parent
1e08562a58
commit
28776d9169
2 changed files with 37 additions and 41 deletions
|
@ -2649,7 +2649,7 @@ bool WaveshareEPaper7P5InV2P::wait_until_idle_() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
App.feed_wdt();
|
App.feed_wdt();
|
||||||
delay(10);
|
delay(10); // NOLINT
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2657,22 +2657,21 @@ bool WaveshareEPaper7P5InV2P::wait_until_idle_() {
|
||||||
void WaveshareEPaper7P5InV2P::reset_() {
|
void WaveshareEPaper7P5InV2P::reset_() {
|
||||||
if (this->reset_pin_ != nullptr) {
|
if (this->reset_pin_ != nullptr) {
|
||||||
this->reset_pin_->digital_write(true);
|
this->reset_pin_->digital_write(true);
|
||||||
delay(20);
|
delay(20); // NOLINT
|
||||||
this->reset_pin_->digital_write(false);
|
this->reset_pin_->digital_write(false);
|
||||||
delay(2);
|
delay(2); // NOLINT
|
||||||
this->reset_pin_->digital_write(true);
|
this->reset_pin_->digital_write(true);
|
||||||
delay(20);
|
delay(20); // NOLINT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveshareEPaper7P5InV2P::turn_on_display_() {
|
void WaveshareEPaper7P5InV2P::turn_on_display_() {
|
||||||
this->command(0x12);
|
this->command(0x12);
|
||||||
delay(100);
|
delay(100); // NOLINT
|
||||||
this->wait_until_idle_();
|
this->wait_until_idle_();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveshareEPaper7P5InV2P::initialize() {
|
void WaveshareEPaper7P5InV2P::initialize() {
|
||||||
|
|
||||||
this->reset_();
|
this->reset_();
|
||||||
|
|
||||||
// COMMAND POWER SETTING
|
// COMMAND POWER SETTING
|
||||||
|
@ -2691,7 +2690,7 @@ void WaveshareEPaper7P5InV2P::initialize() {
|
||||||
|
|
||||||
// COMMAND POWER DRIVER HAT UP
|
// COMMAND POWER DRIVER HAT UP
|
||||||
this->command(0x04);
|
this->command(0x04);
|
||||||
delay(100);
|
delay(100); // NOLINT
|
||||||
this->wait_until_idle_();
|
this->wait_until_idle_();
|
||||||
|
|
||||||
// COMMAND PANEL SETTING
|
// COMMAND PANEL SETTING
|
||||||
|
@ -2735,11 +2734,10 @@ void HOT WaveshareEPaper7P5InV2P::display() {
|
||||||
ESP_LOGI(TAG, "Power on the display and hat");
|
ESP_LOGI(TAG, "Power on the display and hat");
|
||||||
|
|
||||||
this->command(0x04);
|
this->command(0x04);
|
||||||
delay(200);
|
delay(200); // NOLINT
|
||||||
this->wait_until_idle_();
|
this->wait_until_idle_();
|
||||||
|
|
||||||
if (this->full_update_every_ == 1) {
|
if (this->full_update_every_ == 1) {
|
||||||
|
|
||||||
this->command(0x13);
|
this->command(0x13);
|
||||||
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]));
|
||||||
|
@ -2757,7 +2755,6 @@ void HOT WaveshareEPaper7P5InV2P::display() {
|
||||||
this->data(0x07);
|
this->data(0x07);
|
||||||
|
|
||||||
if (this->at_update_ == 0) {
|
if (this->at_update_ == 0) {
|
||||||
|
|
||||||
// Enable fast refresh
|
// Enable fast refresh
|
||||||
this->command(0xE5);
|
this->command(0xE5);
|
||||||
this->data(0x5A);
|
this->data(0x5A);
|
||||||
|
@ -2765,27 +2762,26 @@ void HOT WaveshareEPaper7P5InV2P::display() {
|
||||||
this->command(0x92);
|
this->command(0x92);
|
||||||
|
|
||||||
this->command(0x10);
|
this->command(0x10);
|
||||||
delay(2);
|
delay(2); // NOLINT
|
||||||
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]));
|
||||||
}
|
}
|
||||||
|
|
||||||
delay(100);
|
delay(100); // NOLINT
|
||||||
this->wait_until_idle_();
|
this->wait_until_idle_();
|
||||||
|
|
||||||
this->command(0x13);
|
this->command(0x13);
|
||||||
delay(2);
|
delay(2); // NOLINT
|
||||||
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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
delay(100);
|
delay(100); // NOLINT
|
||||||
this->wait_until_idle_();
|
this->wait_until_idle_();
|
||||||
|
|
||||||
this->turn_on_display_();
|
this->turn_on_display_();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Enable partial refresh
|
// Enable partial refresh
|
||||||
this->command(0xE5);
|
this->command(0xE5);
|
||||||
this->data(0x6E);
|
this->data(0x6E);
|
||||||
|
@ -2807,12 +2803,12 @@ void HOT WaveshareEPaper7P5InV2P::display() {
|
||||||
this->data(0x01);
|
this->data(0x01);
|
||||||
|
|
||||||
this->command(0x13);
|
this->command(0x13);
|
||||||
delay(2);
|
delay(2); // NOLINT
|
||||||
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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
delay(100);
|
delay(100); // NOLINT
|
||||||
this->wait_until_idle_();
|
this->wait_until_idle_();
|
||||||
|
|
||||||
this->turn_on_display_();
|
this->turn_on_display_();
|
||||||
|
@ -2838,7 +2834,7 @@ void WaveshareEPaper7P5InV2P::dump_config() {
|
||||||
LOG_PIN(" Busy Pin: ", this->busy_pin_);
|
LOG_PIN(" Busy Pin: ", this->busy_pin_);
|
||||||
LOG_UPDATE_INTERVAL(this);
|
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;
|
this->full_update_every_ = full_update_every;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -689,40 +689,40 @@ class WaveshareEPaper7P5InV2alt : public WaveshareEPaper7P5InV2 {
|
||||||
};
|
};
|
||||||
|
|
||||||
class WaveshareEPaper7P5InV2P : public WaveshareEPaper {
|
class WaveshareEPaper7P5InV2P : public WaveshareEPaper {
|
||||||
public:
|
public:
|
||||||
bool wait_until_idle_();
|
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 {
|
void deep_sleep() override {
|
||||||
// COMMAND POWER OFF
|
// COMMAND POWER OFF
|
||||||
this->command(0x02);
|
this->command(0x02);
|
||||||
this->wait_until_idle_();
|
this->wait_until_idle_();
|
||||||
// COMMAND DEEP SLEEP
|
// COMMAND DEEP SLEEP
|
||||||
this->command(0x07);
|
this->command(0x07);
|
||||||
this->data(0xA5); // check byte
|
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:
|
protected:
|
||||||
int get_width_internal() override;
|
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 full_update_every_{30};
|
||||||
uint32_t at_update_{0};
|
uint32_t at_update_{0};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void reset_();
|
void reset_();
|
||||||
|
|
||||||
void turn_on_display_();
|
void turn_on_display_();
|
||||||
};
|
};
|
||||||
|
|
||||||
class WaveshareEPaper7P5InHDB : public WaveshareEPaper {
|
class WaveshareEPaper7P5InHDB : public WaveshareEPaper {
|
||||||
|
|
Loading…
Reference in a new issue