Skip to content

Fix: Where's my friend #2864

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

Merged
merged 1 commit into from
Aug 6, 2024
Merged
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
10 changes: 5 additions & 5 deletions PyPortal/PyPortal_Wheres_My_Friend/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

# Adafruit IO shared feed key
IO_FEED_KEY = 'location'
# Fetch the location every 5 seconds
SLEEP_DELAY_SECONDS = 5
# Fetch the location every 5 minutes
SLEEP_DELAY_MINUTES = 5
# Set the backlight brightness, 0.0 (off) to 1.0 (max brightness)
BACKLIGHT_BRIGHTNESS = 0.5
# Location text and images
Expand Down Expand Up @@ -54,7 +54,7 @@
group.append(text_area)

# Draw a label for the location text
text_area_location = label.Label(font, text="@ home", color=0x000000, scale=3)
text_area_location = label.Label(font, text="", color=0x000000, scale=3)
text_area_location.x = TEXT_AREA_LOCATION_X
text_area_location.y = TEXT_AREA_LOCATION_Y
group.append(text_area_location)
Expand Down Expand Up @@ -106,12 +106,12 @@ def set_image(image_group, filename):
else:
print("Location not found in images!")
# Update the location text
text_area_location.text="Error: Unknown Value!"
text_area_location.text="@ unknown"
# Show the refreshed group
display.root_group = group
except RuntimeError as e:
print("Failed to fetch location data: ", e)

# Wait 5 minutes (300 seconds) before fetching the location feed again
print("Sleeping, fetching the location again in 5 minutes!")
time.sleep(SLEEP_DELAY_SECONDS * 60)
time.sleep(SLEEP_DELAY_MINUTES * 60)