55 lines
1.6 KiB
Python
55 lines
1.6 KiB
Python
from app.display import NeoPixel_64x64
|
|
from app.display.fonts import font_5x7
|
|
from app.tryout import Font_Checker, Weather_Checker, Emoji_Checker
|
|
from app.utils import show_system_load, sync_ntp_time, get_datetime_string, get_german_datetime
|
|
from app.web import Wlan
|
|
import time
|
|
import uasyncio as asyncio # type: ignore
|
|
|
|
CITY_LIST: list[str]= ["Großhansdorf","Columbus", "London", "Ebeltoft", "Tokio"]
|
|
|
|
async def weather_check_task(weather_checker):
|
|
while True:
|
|
for city in CITY_LIST:
|
|
weather_checker.check(city=city, lang="de", test_mode=False)
|
|
print(f"Checked {city}")
|
|
await asyncio.sleep(1 * 60) # Non-blocking sleep
|
|
|
|
async def other_task():
|
|
while True:
|
|
print("Other task running...")
|
|
await asyncio.sleep(2)
|
|
|
|
|
|
async def main(weather_checker)->None:
|
|
# Run both tasks concurrently
|
|
await asyncio.gather(weather_check_task(weather_checker), other_task())
|
|
|
|
# Programm Startpunkt
|
|
if __name__ == '__main__':
|
|
display = NeoPixel_64x64()
|
|
wlan: Wlan = Wlan( )
|
|
wlan.connect( ssid="Wokwi-Wlan", password="12345678")
|
|
|
|
sync_ntp_time()
|
|
|
|
# font_checker : Font_Checker = Font_Checker( display)
|
|
# font_checker.fonts_check(pretty=False)
|
|
|
|
# emoji_checker : Emoji_Checker = Emoji_Checker(display)
|
|
# emoji_checker.check()
|
|
|
|
# tryout.weather_check(display, test_mode=False)
|
|
display.set_font(font_5x7)
|
|
weather_checker: Weather_Checker = Weather_Checker( display=display)
|
|
|
|
|
|
|
|
# while True:
|
|
# for city in sorted(CITY_LIST):
|
|
# weather_checker.check(city=city, lang="de", test_mode=False)
|
|
# time.sleep(5*60)
|
|
|
|
# show_system_load()
|
|
asyncio.run(main(weather_checker))
|