Add NTP time synchronization after WiFi connection

This commit is contained in:
Aaron 2025-11-05 22:54:17 -05:00
parent 2c10fdff62
commit db34c25bb4

View File

@ -77,6 +77,14 @@ if wifi and wifi.isconnected():
# Send startup message with IP
send_discord_message(f"Pico W online at http://{ifconfig[0]}")
# Sync time with NTP
try:
import ntptime
ntptime.settime()
print("Time synced with NTP server")
except Exception as e:
print("Failed to sync time: {}".format(e))
else:
print("\n" + "="*50)
print("WiFi Connection Failed!")