Skip to content

raise error in get_time if zero returned #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 15, 2019
Merged

raise error in get_time if zero returned #73

merged 2 commits into from
Sep 15, 2019

Conversation

jerryneedell
Copy link
Contributor

@jerryneedell jerryneedell commented Sep 14, 2019

fixes #72
on startup, sometimes it takes awhile (up to 15 seconds) for get_time() to return a non-zero result.
Raising the ValueError lets the user retry if desired

tested on PyPortal and Metro_m4_express with with Nina v 1.3.0
test code:

import time
import board
import busio
from digitalio import DigitalInOut
from adafruit_esp32spi import adafruit_esp32spi

# If you are using a board with pre-defined ESP32 Pins:
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)

print("Connecting to AP...")
while not esp.is_connected:
    try:
        esp.connect_AP(b"MYSSID", b"MYPASSWORD")
    except RuntimeError as e:
        print("could not connect to AP, retrying: ", e)
        continue

while True:
    try:
        print(esp.get_time())
    except ValueError as e:
        print(e," try again")
        pass
    time.sleep(1)

@jerryneedell
Copy link
Contributor Author

It is still not clear to me why this happens. Is it an issue in the nina firmware?

@docmollo
Copy link
Contributor

It is still not clear to me why this happens. Is it an issue in the nina firmware?

Hey @jerryneedell! You bring up a good point. The NINA firmware simply makes calls to the Espressif IDF, so I doubt the bug or issue is in the NINA firmware, but it entirely could be something updated in the IDF. I just took a quick break from what I'm working on today to look through the IDF releases since I last poked at the Adafruit fork of NINA. I had compiled and provided a binary against v3.2 of the IDF and they've since released v3.2.2 and v3.2.3. They've also started a LTS verision in v3.3 that's supported until March 2022 that is compatible with 3.x code.

If you don't beat me to it, I'll try compiling the Adafruit NINA firmware against v3.3 and see how that goes. Maybe later tonight, but probably tomorrow (Sunday). BTW I'm not always in the Adafruit Discord, but if you mention me, I'll get the notification and jump in ASAP.

Copy link
Member

@ladyada ladyada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very minor nitpick!

@jerryneedell
Copy link
Contributor Author

@ladyada done -- brain cramp ;-)

@jerryneedell
Copy link
Contributor Author

@docmollo I'll be happy to help with testing/incorporating the updates to the NINA firmware. Unfortunately, i will not be able to do anything until late next week. I'll be offline for most if not all of the next several days. I'll check on the state of things when I get back online.

@jerryneedell jerryneedell merged commit 424c489 into adafruit:master Sep 15, 2019
@jerryneedell jerryneedell deleted the jerryn_get_time branch September 15, 2019 10:51
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_time( ) returns (0,) for awhile
3 participants