mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 09:18:00 +01:00
Clang tidy
This commit is contained in:
parent
232e36300a
commit
b0f6eb9828
2 changed files with 36 additions and 36 deletions
|
@ -3034,51 +3034,51 @@ void WaveshareEPaper13P3InK::dump_config() {
|
|||
|
||||
void WaveshareEPaperPolled::update() {
|
||||
this->do_update_();
|
||||
if (this->state_ == State::sleeping) {
|
||||
this->set_state_(State::update_requested);
|
||||
if (this->state_ == State::SLEEPING) {
|
||||
this->set_state_(State::UPDATE_REQUESTED);
|
||||
}
|
||||
}
|
||||
|
||||
void WaveshareEPaperPolled::loop() {
|
||||
switch (this->state_) {
|
||||
case State::sleeping:
|
||||
case State::SLEEPING:
|
||||
break;
|
||||
case State::update_requested:
|
||||
case State::UPDATE_REQUESTED:
|
||||
this->reset_pin_->digital_write(false);
|
||||
this->set_state_(State::resetting);
|
||||
this->set_state_(State::RESETTING);
|
||||
break;
|
||||
case State::resetting:
|
||||
case State::RESETTING:
|
||||
if (millis() - this->last_state_change_ >= this->reset_duration_) {
|
||||
this->reset_pin_->digital_write(true);
|
||||
this->set_state_(State::initializing);
|
||||
this->set_state_(State::INITIALIZING);
|
||||
}
|
||||
break;
|
||||
case State::initializing:
|
||||
case State::INITIALIZING:
|
||||
if (millis() - this->last_state_change_ >= 200) {
|
||||
this->power_on();
|
||||
this->set_state_(State::powering_on);
|
||||
this->set_state_(State::POWERING_ON);
|
||||
}
|
||||
break;
|
||||
case State::powering_on:
|
||||
case State::POWERING_ON:
|
||||
if (millis() - this->last_state_change_ >= 100 && (!this->busy_pin_ || !this->busy_pin_->digital_read())) {
|
||||
this->configure();
|
||||
this->set_state_(State::configuring);
|
||||
this->set_state_(State::CONFIGURING);
|
||||
}
|
||||
break;
|
||||
case State::configuring:
|
||||
case State::CONFIGURING:
|
||||
this->display();
|
||||
this->set_state_(State::displaying);
|
||||
this->set_state_(State::DISPLAYING);
|
||||
break;
|
||||
case State::displaying:
|
||||
case State::DISPLAYING:
|
||||
if (millis() - this->last_state_change_ >= 200 && (!this->busy_pin_ || !this->busy_pin_->digital_read())) {
|
||||
this->power_off();
|
||||
this->set_state_(State::powering_off);
|
||||
this->set_state_(State::POWERING_OFF);
|
||||
}
|
||||
break;
|
||||
case State::powering_off:
|
||||
case State::POWERING_OFF:
|
||||
if (!this->busy_pin_ || !this->busy_pin_->digital_read()) {
|
||||
this->deep_sleep();
|
||||
this->set_state_(State::sleeping);
|
||||
this->set_state_(State::SLEEPING);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -3088,28 +3088,28 @@ void WaveshareEPaperPolled::set_state_(State state) {
|
|||
this->state_ = state;
|
||||
this->last_state_change_ = millis();
|
||||
switch (this->state_) {
|
||||
case State::sleeping:
|
||||
case State::SLEEPING:
|
||||
ESP_LOGD(TAG, "sleeping");
|
||||
break;
|
||||
case State::update_requested:
|
||||
case State::UPDATE_REQUESTED:
|
||||
ESP_LOGD(TAG, "update_requested");
|
||||
break;
|
||||
case State::resetting:
|
||||
case State::RESETTING:
|
||||
ESP_LOGD(TAG, "resetting");
|
||||
break;
|
||||
case State::initializing:
|
||||
case State::INITIALIZING:
|
||||
ESP_LOGD(TAG, "initializing");
|
||||
break;
|
||||
case State::powering_on:
|
||||
case State::POWERING_ON:
|
||||
ESP_LOGD(TAG, "powering_on");
|
||||
break;
|
||||
case State::configuring:
|
||||
case State::CONFIGURING:
|
||||
ESP_LOGD(TAG, "configuring");
|
||||
break;
|
||||
case State::displaying:
|
||||
case State::DISPLAYING:
|
||||
ESP_LOGD(TAG, "displaying");
|
||||
break;
|
||||
case State::powering_off:
|
||||
case State::POWERING_OFF:
|
||||
ESP_LOGD(TAG, "powering_off");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -813,7 +813,7 @@ class WaveshareEPaperPolled : public WaveshareEPaper {
|
|||
virtual void configure() = 0;
|
||||
|
||||
// Send image data and refresh the display
|
||||
virtual void display() = 0;
|
||||
void display() override = 0;
|
||||
|
||||
// Power off the driver
|
||||
virtual void power_off() = 0;
|
||||
|
@ -823,21 +823,21 @@ class WaveshareEPaperPolled : public WaveshareEPaper {
|
|||
|
||||
private:
|
||||
enum class State : uint8_t {
|
||||
sleeping,
|
||||
update_requested,
|
||||
resetting,
|
||||
initializing,
|
||||
powering_on,
|
||||
configuring,
|
||||
displaying,
|
||||
powering_off,
|
||||
SLEEPING,
|
||||
UPDATE_REQUESTED,
|
||||
RESETTING,
|
||||
INITIALIZING,
|
||||
POWERING_ON,
|
||||
CONFIGURING,
|
||||
DISPLAYING,
|
||||
POWERING_OFF,
|
||||
};
|
||||
|
||||
// Set the current state of the display
|
||||
void set_state_(State state);
|
||||
|
||||
// Current state of the display
|
||||
State state_{State::sleeping};
|
||||
State state_{State::SLEEPING};
|
||||
// Timestamp of last state changed, used to wait between states
|
||||
uint32_t last_state_change_{0};
|
||||
};
|
||||
|
@ -854,7 +854,7 @@ class WaveshareEPaper7In5BV2 : public WaveshareEPaperPolled {
|
|||
void power_off() override;
|
||||
void deep_sleep() override;
|
||||
|
||||
virtual std::vector<Color> get_supported_colors() override { return {display::COLOR_ON, Color(255, 0, 0, 0)}; }
|
||||
std::vector<Color> get_supported_colors() override { return {display::COLOR_ON, Color(255, 0, 0, 0)}; }
|
||||
|
||||
protected:
|
||||
int get_width_internal() override { return 800; }
|
||||
|
|
Loading…
Reference in a new issue