Skip to content

Commit 9210da3

Browse files
committed
Added SPDX Identifier
1 parent 6bdc53c commit 9210da3

File tree

1 file changed

+12
-12
lines changed
  • Matrix_Portal_S3_itsaSNAP_Daily_Forecast_Display

1 file changed

+12
-12
lines changed

Matrix_Portal_S3_itsaSNAP_Daily_Forecast_Display/code.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2024 Trevor Beaton for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
15
import time
26
import terminalio
37
from adafruit_matrixportal.matrixportal import MatrixPortal
@@ -23,18 +27,13 @@
2327
WEATHER_IMAGES = {
2428
"Sunny": "images/sunny.bmp",
2529
"Clear": "images/moon.bmp",
26-
"Cloudy": "images/cloudy.bmp",
30+
"Cldy": "images/cloudy.bmp", # Updated to use shortened version
2731
"Drizzle": "images/rain.bmp",
2832
"Rainy": "images/cloudy.bmp",
2933
"Heavy rain": "images/rain.bmp",
30-
"Thunderstorms": "images/thunder.bmp",
31-
"Isolated thunderstorms": "images/thunder.bmp",
32-
"Scattered thunderstorms": "images/thunder.bmp",
33-
"Strong storms": "images/thunder.bmp",
34+
"TStorms": "images/thunder.bmp",
3435
"Sun showers": "images/rain.bmp",
3536
"Snow": "images/snow.bmp",
36-
"Light snow": "images/snow.bmp",
37-
"Heavy snow": "images/snow.bmp",
3837
}
3938

4039
# Update this to your weather feed
@@ -56,12 +55,13 @@ def is_daytime(hour):
5655
def clean_condition(condition, is_day):
5756
condition = condition.replace("Mostly ", "").replace("Partly ", "")
5857
condition_mapping = {
58+
"Cloudy": "Cldy", # Added shortened version of Cloudy
5959
"Drizzle or light rain": "Rainy",
6060
"Heavy rain": "Rainy",
61-
"Isolated thunderstorms": "Thunderstorms",
61+
"Isolated thunderstorms": "TStorms",
6262
"Sun showers": "Rainy",
63-
"Scattered thunderstorms": "Thunderstorms",
64-
"Strong storms": "Thunderstorms",
63+
"Scattered thunderstorms": "TStorms",
64+
"Strong storms": "TStorms",
6565
"Light snow": "Snow",
6666
"Heavy snow": "Snow",
6767
}
@@ -109,7 +109,7 @@ def update_display():
109109
print(f"Error loading image for {current_condition}: {e}")
110110
else:
111111
print(f"Failed to parse weather data: {weather_data}")
112-
matrixportal.set_text("Parse Error", 0)
112+
matrixportal.set_text("Error", 0)
113113
matrixportal.set_text("", 1)
114114
else:
115115
print("Failed to retrieve data from feed")
@@ -126,4 +126,4 @@ def update_display():
126126
update_display()
127127
last_update = current_time
128128

129-
time.sleep(1) # Sleep for 1 second
129+
time.sleep(1) # Sleep for 1 second

0 commit comments

Comments
 (0)