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 Inky Impression 7.3 support #30

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 19 additions & 3 deletions eco_indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def price_diff_to_symbol(price_today: float, price_tomorrow: float) -> tuple[str
except TypeError as inky_version:
raise TypeError("You need to update the Inky library to >= v1.1.0") from inky_version

img = Image.new("P", (inky_display.WIDTH, inky_display.HEIGHT))
img = Image.new("P", (inky_display.WIDTH, inky_display.HEIGHT), inky_display.WHITE)
draw = ImageDraw.Draw(img)

# deal with scaling for newer SSD1608 pHATs
Expand All @@ -163,6 +163,13 @@ def price_diff_to_symbol(price_today: float, price_tomorrow: float) -> tuple[str
x_scale_factor = 1
y_scale_factor = 1

# Inky Impression 7.3
if inky_display.resolution == (800, 480):
font_scale_factor = 2
x_scale_factor = 3
y_scale_factor = 2
graph_x_width = 126 * x_scale_factor

today = datetime.now().date()
print("Today is " + today.strftime("%a %-d %b %Y"))

Expand Down Expand Up @@ -319,8 +326,8 @@ def update_inky(conf: dict, inky_data: dict, demo: bool):
inky_display = auto(ask_user=False, verbose=True)
except TypeError as inky_version:
raise TypeError("You need to update the Inky library to >= v1.1.0") from inky_version

img = Image.new("P", (inky_display.WIDTH, inky_display.HEIGHT))
#make an image framebuffer, explicit background colour of white (required for some Inky displays)
img = Image.new("P", (inky_display.WIDTH, inky_display.HEIGHT), inky_display.WHITE)
draw = ImageDraw.Draw(img)

# deal with scaling for newer SSD1608 pHATs
Expand All @@ -337,6 +344,13 @@ def update_inky(conf: dict, inky_data: dict, demo: bool):
y_scale_factor = 1
graph_x_width = 126 * x_scale_factor

# Inky Impression 7.3
if inky_display.resolution == (800, 480):
font_scale_factor = 2
x_scale_factor = 3
y_scale_factor = 2
graph_x_width = 126 * x_scale_factor

data_duration = conf['InkyPHAT']['DataDuration']
graph_x_unit = graph_x_width / (data_duration * 2) # half hour slots!

Expand Down Expand Up @@ -518,6 +532,8 @@ def update_inky(conf: dict, inky_data: dict, demo: bool):
y_pos = 10 * y_scale_factor + (3 * 18 * y_scale_factor)
font = ImageFont.truetype(RobotoMedium, size=int(13 * font_scale_factor))



if conf['Mode'] == "agile_import" or conf['Mode'] == "carbon":
if '.' in str(low_slot_duration):
lsd_text = str(low_slot_duration).rstrip('0').rstrip('.')
Expand Down