Skip to content

Commit

Permalink
Less deghosting to save battery
Browse files Browse the repository at this point in the history
  • Loading branch information
OSi (Ondrej Sienczak) committed Sep 10, 2024
1 parent 8efa82f commit d9adcd1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Binary file modified esp32/micropython.bin
Binary file not shown.
5 changes: 4 additions & 1 deletion simulator/ui/acep/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ def repaint_welcome(self):

def repaint_forecast(self, volt):
if self.connection is not None:
with self.Drawing("weather", self):
forecast = self.forecast
dt = forecast.time.get_date_time(forecast.weather.dt)
hour = dt[3]
with self.Drawing("weather", self, hour == 3):
# We have forecast, so lets draw it on screen. Don't draw
# always everything as forecast is changing not so often,
# but temperature is.
Expand Down
5 changes: 3 additions & 2 deletions simulator/ui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ def forecast_blocks(self):
x2 += block

class Drawing:
def __init__(self, name, epd):
def __init__(self, name, epd, deghost=True):
self.name = name
self.epd = epd
self.deghost = deghost

def __enter__(self):
logger.info(f"Drawing {self.name} ...")
Expand All @@ -149,7 +150,7 @@ def __enter__(self):
def __exit__(self, *args):
logger.info(f"Flushing {self.name} ...")
self.epd.led.mode(self.epd.led.FLUSHING)
self.epd.canvas.flush()
self.epd.canvas.flush(self.deghost)


def with_forecast(fn):
Expand Down

0 comments on commit d9adcd1

Please sign in to comment.