-
Notifications
You must be signed in to change notification settings - Fork 38
Closed
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already exists
Description
I'm running a magtag in a 5 minute deep sleep loop.
On wake it connects to the WIFI and sets the system time by getting time from the Adafruit IO API.
This works for a while (~an hour) and then it hangs.
Less often I have seen #62.
Environment:
Adafruit CircuitPython 7.0.0 on 2021-09-20; Adafruit MagTag with ESP32S2
Board ID:adafruit_magtag_2.9_grayscale
This is the function I call to set the time.
def set_system_time(force_time=False):
if time.localtime().tm_year < 2020 or force_time==True:
print("Setting System Time in UTC")
pool = socketpool.SocketPool(wifi.radio)
requests = adafruit_requests.Session(pool, ssl.create_default_context())
print("Calling adafruit IO for time")
response = requests.get("https://io.adafruit.com/api/v2/time/seconds")
print(response)
if response:
if response.status_code == 200:
r = rtc.RTC()
r.datetime = time.localtime(int(response.text))
print(f"System Time: {r.datetime}")
else:
print("Setting time failed")
else:
print("Year seems good, skipping set time.")Opening this for tracking I'll keep looking into it.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already exists