Add code to support Titano
Update code.py
This commit is contained in:
parent
ec03d18a18
commit
713d6fb363
2 changed files with 14 additions and 3 deletions
|
|
@ -37,11 +37,17 @@ HEIGHT = board.DISPLAY.height
|
|||
|
||||
# determine the current working directory needed so we know where to find files
|
||||
cwd = ("/"+__file__).rsplit('/', 1)[0]
|
||||
|
||||
if board.board_id == "pyportal_titano":
|
||||
bg_image_path = "/images/tides_bg_graph_480-320.bmp"
|
||||
else:
|
||||
bg_image_path = "/images/tides_bg_graph.bmp"
|
||||
|
||||
pyportal = PyPortal(url=DATA_SOURCE,
|
||||
headers={"Ocp-Apim-Subscription-Key":secrets['Ocp-Apim-Subscription-Key']},
|
||||
json_path=DATA_LOCATION,
|
||||
status_neopixel=board.NEOPIXEL,
|
||||
default_bg=cwd+"/images/tides_bg_graph.bmp")
|
||||
default_bg=cwd+bg_image_path)
|
||||
|
||||
# Connect to the internet and get local time
|
||||
pyportal.get_local_time()
|
||||
|
|
@ -65,8 +71,13 @@ date_font.load_glyphs(b'1234567890-')
|
|||
date_label = Label(date_font, text="0000-00-00", color=DATE_COLOR, x=7, y=14)
|
||||
pyportal.splash.append(date_label)
|
||||
|
||||
if board.board_id == "pyportal_titano":
|
||||
x_pos = 394
|
||||
else:
|
||||
x_pos = 234
|
||||
|
||||
# Setup time label
|
||||
time_label = Label(date_font, text="00:00:00", color=TIME_COLOR, x=234, y=14)
|
||||
time_label = Label(date_font, text="00:00:00", color=TIME_COLOR, x=x_pos, y=14)
|
||||
pyportal.splash.append(time_label)
|
||||
|
||||
# Setup current time marker
|
||||
|
|
|
|||
BIN
PyPortal_Tides/admiralty_tides_graphical/images/tides_bg_graph_480-320.bmp
Executable file
BIN
PyPortal_Tides/admiralty_tides_graphical/images/tides_bg_graph_480-320.bmp
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 600 KiB |
Loading…
Reference in a new issue