-
Notifications
You must be signed in to change notification settings - Fork 18
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
Dependence on adafruit_esp32spi #16
Comments
Great! I made a pull request to implement socket methods that were missing in adafruit_wiznet5k: Seems to work, but I assume the implementation is intended to be used with So I made a change to be able to have a minimum poll specified on the NTP object, default is 5 hours. I don't know if you want to implement a change like that, or if you want me to send you a pull request @askpatrickw ? |
That would be up to @tannewt |
My intention wasn't to use it with set_time_source but rather to adjust the internal RTC once in a while based on it. The tricky bit in all of this is making sure we don't break ESP32SPI in the process. |
How would that look in code? Would there already be rate limiting on how often the request is made? |
The existing library for ESP32SPI is quite different in approach than the return-time-once UDP implementation for ESP32-S2. Some additional background here. As I understand it:
If not different libraries, at least different classes or methods would be needed, or a breaking change to unify the API. Although even in the latter case, ESP32SPI-based UDP code may not be fully compatible (might need conditionals at least), would need some research and test. |
I think we need to remove all uses of this library as it is now. (Those should just do what set_time does themselves.) Once we do that, then we can change this one. In the bundle:
Learn:
|
Maybe @dherrada can help us fix all these up. |
@tannewt So you'd like me to remove the above files? |
@dherrada No, the code needs to be modified so it doesn't use the NTP library. Instead, they need to set they circuitpython time directly. Something similar to this (from this library as-is): try:
now = self._esp.get_time()
now = time.localtime(now[0] + tz_offset)
rtc.RTC().datetime = now
self.valid_time = True
except ValueError as error:
if self.debug:
print(str(error))
return |
@tannewt Ah, makes sense. Added to my list |
Just a note that
|
@brentru Are you aware of this issue? I think you are the original author of this library. |
@tannewt I am now, wasn't getting email notifications. I do not know what I need to do with this library. Do we still need to remove all uses + archive this repository? Has the above task been done already @evaherrada? Would you like me to do it? |
I think we need to remove or change all uses and then switch this library over to doing real NTP like I've done in https://github.com/tannewt/Adafruit_CircuitPython_NTP/tree/raw_ntp . This current code shouldn't be called NTP though because that's not what it does at all. We could move this code to a new library or to ESP32SPI directly and switch the uses to it instead. Then, we can change this to the actual UDP NTP code. |
@brentru Yeah sorry that slipped my mind. That'd be great |
This completely redoes the library in favor of using a native socket to fetch time from an NTP server. Fixes adafruit#17 and fixes adafruit#16
It seems this library only works with adafruit_esp32spi.
What can be done to make it compatible with other backends such as adafruit_wiznet5k?
The current implementation calls
get_time
on on the interface object. So is the right way to implement this to add this method to the adafruit_wiznet5k interface object? Or should this module be rewritten to use generic socket calls?The text was updated successfully, but these errors were encountered: