Re: Wifi bridge for RPI Pico
Posted: Sun Jan 31, 2021 11:23 am
Well I don't know why they chose SPI but maybe that allows it to work with other hardware too? Regardless, it's a working ESP32 project that could be utilized as is.
You are right about it being a blocking socket. But I think it should be easy to implement a nonblocking socket using the existing implementation. Isn't the main difference just how you handle the read() method? The current implementation blocks until a timeout and seems to return b'' if nothing was received. With a nonblocking socket it'd need to return b'' if the connection is broken and None if there is no data in the buffer.
Having checked that, what I'm missing is some handling of broken sockets. This seems to be completely missing making me wonder if it automatically reconnects broken sockets on the esp32? Guess I need to dig into the C++ code of the nina-fw.. Not passing on the broken socket state to the micropython application would be a problem..
Or I need to join some curcuitpython/adafruit forum and ask there.
You are right about it being a blocking socket. But I think it should be easy to implement a nonblocking socket using the existing implementation. Isn't the main difference just how you handle the read() method? The current implementation blocks until a timeout and seems to return b'' if nothing was received. With a nonblocking socket it'd need to return b'' if the connection is broken and None if there is no data in the buffer.
Having checked that, what I'm missing is some handling of broken sockets. This seems to be completely missing making me wonder if it automatically reconnects broken sockets on the esp32? Guess I need to dig into the C++ code of the nina-fw.. Not passing on the broken socket state to the micropython application would be a problem..
Or I need to join some curcuitpython/adafruit forum and ask there.