Skip to content

Commit

Permalink
feat: flip screen
Browse files Browse the repository at this point in the history
  • Loading branch information
EuleMitKeule committed Dec 31, 2024
1 parent a9c2adf commit b00c6a2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions inky_phat_dashboard/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class VerticalAlign(Enum):
DEFAULT_WASTE_ALERT_DAYS = 1
DEFAULT_WASTE_DETAILED_DAYS = 3
DEFAULT_ENABLE_INKY = True
DEFAULT_FLIP_SCREEN = True

RESTART_DELAY_SECONDS = 5

Expand Down
12 changes: 12 additions & 0 deletions inky_phat_dashboard/image_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ def generate_detailed_view(
)

result = result.convert("P", palette=self._palette, colors=256)

if self._config.flip_screen:
result = result.rotate(180)

return result

def generate_detailed_view_two_lines(
Expand Down Expand Up @@ -157,6 +161,10 @@ def generate_detailed_view_two_lines(
)

result = result.convert("P", palette=self._palette, colors=256)

if self._config.flip_screen:
result = result.rotate(180)

return result

def generate_dashboard_view(
Expand Down Expand Up @@ -218,4 +226,8 @@ def generate_dashboard_view(
)

result = result.convert("P", palette=self._palette, colors=256)

if self._config.flip_screen:
result = result.rotate(180)

return result
2 changes: 2 additions & 0 deletions inky_phat_dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
DEFAULT_COLOR_MODE,
DEFAULT_DATA_TIMEOUT_SECONDS,
DEFAULT_ENABLE_INKY,
DEFAULT_FLIP_SCREEN,
DEFAULT_FONT_PATH,
DEFAULT_LOG_DATEFMT,
DEFAULT_LOG_FILEMODE,
Expand Down Expand Up @@ -147,6 +148,7 @@ class Config:
waste_detailed_days: int = DEFAULT_WASTE_DETAILED_DAYS
waste_alert_days: int = DEFAULT_WASTE_ALERT_DAYS
enable_inky: bool = DEFAULT_ENABLE_INKY
flip_screen: bool = DEFAULT_FLIP_SCREEN

config_file_path: Path = field(init=False, repr=False, compare=False)

Expand Down

0 comments on commit b00c6a2

Please sign in to comment.