Skip to content

Commit fcce05e

Browse files
authored
Merge pull request #2126 from aioue/main
Update Tides code to support PyPortal Titano
2 parents b51f754 + 713d6fb commit fcce05e

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

PyPortal_Tides/admiralty_tides_graphical/code.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
raise
1919

2020
#--| USER CONFIG |--------------------------
21-
STATION_ID = "0245" # tide location, find yours from admiralty website
21+
STATION_ID = "0245" # tide location, find yours from admiralty website
2222
PLOT_SIZE = 2 # tide plot thickness
2323
PLOT_COLOR = 0x00FF55 # tide plot color
2424
MARK_SIZE = 6 # current time marker size
@@ -37,11 +37,17 @@
3737

3838
# determine the current working directory needed so we know where to find files
3939
cwd = ("/"+__file__).rsplit('/', 1)[0]
40+
41+
if board.board_id == "pyportal_titano":
42+
bg_image_path = "/images/tides_bg_graph_480-320.bmp"
43+
else:
44+
bg_image_path = "/images/tides_bg_graph.bmp"
45+
4046
pyportal = PyPortal(url=DATA_SOURCE,
4147
headers={"Ocp-Apim-Subscription-Key":secrets['Ocp-Apim-Subscription-Key']},
4248
json_path=DATA_LOCATION,
4349
status_neopixel=board.NEOPIXEL,
44-
default_bg=cwd+"/images/tides_bg_graph.bmp")
50+
default_bg=cwd+bg_image_path)
4551

4652
# Connect to the internet and get local time
4753
pyportal.get_local_time()
@@ -65,8 +71,13 @@
6571
date_label = Label(date_font, text="0000-00-00", color=DATE_COLOR, x=7, y=14)
6672
pyportal.splash.append(date_label)
6773

74+
if board.board_id == "pyportal_titano":
75+
x_pos = 394
76+
else:
77+
x_pos = 234
78+
6879
# Setup time label
69-
time_label = Label(date_font, text="00:00:00", color=TIME_COLOR, x=234, y=14)
80+
time_label = Label(date_font, text="00:00:00", color=TIME_COLOR, x=x_pos, y=14)
7081
pyportal.splash.append(time_label)
7182

7283
# Setup current time marker
Binary file not shown.

0 commit comments

Comments
 (0)