diff --git a/adafruit_esp32spi/adafruit_esp32spi_socket.py b/adafruit_esp32spi/adafruit_esp32spi_socket.py index aec0f6d..bcace39 100644 --- a/adafruit_esp32spi/adafruit_esp32spi_socket.py +++ b/adafruit_esp32spi/adafruit_esp32spi_socket.py @@ -73,6 +73,8 @@ def connect(self, address, conntype=None): a hostname string). 'conntype' is an extra that may indicate SSL or not, depending on the underlying interface""" host, port = address + if conntype is None: + conntype = _the_interface.TCP_MODE if not _the_interface.socket_connect(self._socknum, host, port, conn_mode=conntype): raise RuntimeError("Failed to connect to host", host) self._buffer = b'' @@ -123,7 +125,7 @@ def read(self, size=0): received.append(recv) to_read -= len(recv) gc.collect() - if time.monotonic() - stamp > self._timeout: + if self._timeout > 0 and time.monotonic() - stamp > self._timeout: break #print(received) self._buffer += b''.join(received)