Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added full update every x partial updates #9

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions esphome/components/lilygo_t5_47_display/LilygoT547Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,25 @@ void LilygoT547Display::setup() {
epd_set_rotation(orientation);
}
fb = epd_hl_get_framebuffer(&hl);
this->partial_updates_ = this->full_update_every_;
}

void LilygoT547Display::update() {
if (this->init_clear_executed_ == false && this->clear_ == true) {
LilygoT547Display::clear();
this->init_clear_executed_ = true;
}
if(this->partial_updates_ == 0 && this->full_update_every_ != 0 ) {
this->clear();
} else {
this->partial_updates_--;
}
this->do_update_();
LilygoT547Display::flush_screen_changes();
}

void LilygoT547Display::clear() {
this->partial_updates_ = this->full_update_every_;
epd_poweron();
epd_fullclear(&hl, this->temperature_);
epd_poweroff();
Expand Down
3 changes: 3 additions & 0 deletions esphome/components/lilygo_t5_47_display/LilygoT547Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class LilygoT547Display : public PollingComponent, public display::DisplayBuffer
void set_landscape(bool landscape);
void set_power_off_delay_enabled(bool power_off_delay_enabled);
void set_temperature(uint32_t temperature);
void set_full_update_every(uint32_t full_update_every) { this->full_update_every_ = full_update_every; }

int get_width_internal();

Expand All @@ -53,6 +54,8 @@ class LilygoT547Display : public PollingComponent, public display::DisplayBuffer
bool temperature_;
bool power_off_delay_enabled_;
bool landscape_;
uint32_t full_update_every_;
uint32_t partial_updates_{0};
};

} // namespace lilygo_t5_47_display
Expand Down
1 change: 1 addition & 0 deletions esphome/components/lilygo_t5_47_display/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ async def to_code(config):
cg.add(var.set_temperature(config[CONF_TEMPERATURE]))
cg.add(var.set_landscape(config[CONF_LANDSCAPE]))
cg.add(var.set_power_off_delay_enabled(config[CONF_POWER_OFF_DELAY_ENABLED]))
cg.add(var.set_full_update_every(config[CONF_FULL_UPDATE_EVERY]))
cg.add_library("https://github.com/vroland/epdiy.git", None)
cg.add_build_flag("-DBOARD_HAS_PSRAM")
cg.add_build_flag("-DCONFIG_EPD_DISPLAY_TYPE_ED047TC1")
Expand Down