adafruit / Adafruit_CircuitPython_ESP32SPI

ESP32 as wifi with SPI interface
MIT License
101 stars 74 forks source link

socket.connect(): Auto-select UDP_MODE #201

Closed jepler closed 4 months ago

jepler commented 4 months ago

This improves compatibility with the standard socket module

Not tested. Prompted by https://github.com/adafruit/Adafruit_CircuitPython_NTP/pull/32

justmobilize commented 4 months ago

@jepler this makes sense to me

FoamyGuy commented 4 months ago

Does this need to come along with some other change inside adafruit_connection_manager or elsewhere? I tried this branch on a PyPortal Titano with the currently released connection manager and the esp32spi_simpletest.py from requests library but I seem to consistently get this exception raised:

Traceback (most recent call last):
  File "code.py", line 46, in <module>
  File "adafruit_connection_manager.py", line 124, in get_radio_socketpool
ImportError: no module named 'adafruit_esp32spi.adafruit_esp32spi_socket'

Maybe this is related to https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/pull/198

FoamyGuy commented 4 months ago

Does this need to come along with some other change...

I understand now. adafruit_connection_manager is frozen into the builds it appears. And the current release of ESP32SPI is not compatible with the version of adafruit_connection_manager that is frozen in to the current stable release (haven't tried newest).

With the current connection manager pasted into the root of CIRCUITPY to override the frozen instance, I was able to test this successfully as well with that simpletest script.

As an aside, it might be nice if circup were aware of the list of frozen modules per device so that it could give you a warning if / when you install a library that is not going to have any effect by default due to being overridden by a frozen one.

justmobilize commented 4 months ago

@FoamyGuy I had asked at one point about frozen libs, and since the amount of devices were low, it was said it wasn't worth it.

Also, it will install things in lib that are frozen, and then they don't get used... I had thought of adding a method to install in root to fix this as well.

Happy to take this in if wanted