Skip to content

Commit

Permalink
fix code.py
Browse files Browse the repository at this point in the history
  • Loading branch information
brentru committed Aug 5, 2024
1 parent 1e62b17 commit 9470610
Showing 1 changed file with 5 additions and 5 deletions.
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)

0 comments on commit 9470610

Please sign in to comment.