Hello! New to this server and doing my very first project with an adafruit board, so very much in the "know practically nothing" category.
I have a Metro M4 Airlift Lite and am connecting to wifi via esp32spi since it doesn't have the wifi module as an option. (CircuitPython 7.3.3)
I can connect to wifi and confirm internet connectivity just fine, but esp.get_time() can't get beyond the OSERROR about returning 0. I've set it to reattempt every second, but it's still just returning that exception after 30 minutes of trying.
Below is the section of code I have connecting to the internet and trying to get time (stitched together from different adafruit tutorials).
I confirmed that it is connecting to my wifi, reporting back its local ip address, and able to reach the internet to report the ip address of adafruit.com and ping to google.com. I'm about ready to just manually scrape the current time from the web or other api, but I wanted to check if someone might be familiar with this issue and could point out a simple error/solution. π (I've read several posts about the method initally returning 0, before getting a good response after 15 seconds or so. However, patience doesn't seem to be working here.)
Code is truncated since Discord says it's too long:
###...
# Create esp
esp32_cs = DigitalInOut(board.ESP_CS)
esp32_ready = DigitalInOut(board.ESP_BUSY)
esp32_reset = DigitalInOut(board.ESP_RESET)
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
requests.set_socket(socket, esp)
###...
# Set current datetime
now_utc = None
attempt = 1
while now_utc is None:
try:
now_utc = time.localtime(esp.get_time()[0])
except OSError:
print(f'Attempt {attempt}')
attempt += 1
time.sleep(1)
print(now_utc)
Much thanks for taking the time to read. π
