Skip to content

A few ESP32SPI fixes #114

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 4 commits into from
Nov 6, 2020
Merged

Conversation

tannewt
Copy link
Member

@tannewt tannewt commented Nov 5, 2020

  • Only allow one TLS connection at a time. Nina FW doesn't work well with multiple.
  • Raise OSError(23) when out of socket slots.
  • Close a socket when a send doesn't complete.
  • Don't raise an exception when close fails.

* Only allow one TLS connection at a time. Nina FW doesn't work well
  with multiple.
* Raise OSError(23) when out of socket slots.
* Close a socket when a send doesn't complete.
* Don't raise an exception when close fails.
@makermelissa
Copy link
Collaborator

I'm trying to test this, but am running into:

Traceback (most recent call last):
  File "code.py", line 59, in <module>
  File "code.py", line 48, in <module>
  File "/lib/adafruit_pyportal.py", line 1082, in fetch
  File "/lib/adafruit_pyportal.py", line 1079, in fetch
  File "/lib/adafruit_pyportal.py", line 1056, in fetch
  File "/lib/adafruit_pyportal.py", line 1056, in fetch
OSError: 

No writable filesystem found for saving datastream. Insert an SD card or set internal filesystem to be unsafe by setting 'disable_concurrent_write_protection' in the mount options in boot.py

The reason for this is because an image file is not being written and it can't open a file that doesn't exist. This could be due to the changes made here. I'll continue to test.

@makermelissa
Copy link
Collaborator

With the adafruit_esp32spi library from the latest bundle it gives this error instead:
wget didn't write a complete file

@tannewt
Copy link
Member Author

tannewt commented Nov 6, 2020

Could you modify the code so it returns the exception that originates in requests? What example are you trying? You can also mention me on discord so we can debug in real time.

@makermelissa
Copy link
Collaborator

It looks like it may be caused by the missing content-length header in the PyPortal library. I'm continuing to dig.

@makermelissa
Copy link
Collaborator

Oh, just got this:

Traceback (most recent call last):
  File "code.py", line 47, in <module>
  File "/lib/adafruit_pyportal.py", line 1084, in fetch
  File "/lib/adafruit_pyportal.py", line 1081, in fetch
  File "/lib/adafruit_pyportal.py", line 1053, in fetch
  File "/lib/adafruit_pyportal.py", line 760, in wget
  File "/lib/adafruit_requests.py", line 650, in get
  File "/lib/adafruit_requests.py", line 554, in request
  File "/lib/adafruit_requests.py", line 551, in request
  File "/lib/adafruit_requests.py", line 461, in _send_request
  File "/lib/adafruit_requests.py", line 456, in _send
RuntimeError: Connection closed

@makermelissa
Copy link
Collaborator

Yeah, just got the same error again. I think the content-length thing was a fluke.

@makermelissa
Copy link
Collaborator

The thing is, the erroring is now consistent rather than intermittent in that it fails 100% of the time now.

@makermelissa
Copy link
Collaborator

I believe I didn't have your changes in place when I ran into that error. I'm trying again.

@makermelissa
Copy link
Collaborator

Here's the error with your changes in place:

Traceback (most recent call last):
  File "code.py", line 47, in <module>
  File "/lib/adafruit_pyportal.py", line 1087, in fetch
  File "/lib/adafruit_pyportal.py", line 1084, in fetch
  File "/lib/adafruit_pyportal.py", line 1058, in fetch
  File "/lib/adafruit_pyportal.py", line 760, in wget
  File "/lib/adafruit_requests.py", line 650, in get
  File "/lib/adafruit_requests.py", line 539, in request
  File "/lib/adafruit_requests.py", line 429, in _get_socket
  File "/lib/adafruit_requests.py", line 425, in _get_socket
  File "/lib/adafruit_requests.py", line 608, in connect
  File "/lib/adafruit_requests.py", line 605, in connect
  File "/lib/adafruit_esp32spi/adafruit_esp32spi_socket.py", line 75, in connect
  File "/lib/adafruit_esp32spi/adafruit_esp32spi.py", line 755, in socket_connect
  File "/lib/adafruit_esp32spi/adafruit_esp32spi.py", line 640, in socket_open
OSError: 23

Copy link
Collaborator

@makermelissa makermelissa left a comment

Choose a reason for hiding this comment

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

The above error is fixed with adafruit/Adafruit_CircuitPython_Requests#50. In tandem they work great.

@makermelissa makermelissa merged commit fce466b into adafruit:master Nov 6, 2020
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Nov 7, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_BNO055 to 5.2.2 from 5.2.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_BNO055#60 from adafruit/fix-super-call

Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 3.5.3 from 3.5.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#114 from tannewt/esp32spi_fixes

Updating https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH to 5.1.5 from 5.1.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_LIS3DH#63 from adafruit/ladyada-patch-3

Updating https://github.com/adafruit/Adafruit_CircuitPython_PyPortal to 3.6.2 from 3.6.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_PyPortal#93 from makermelissa/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 2.9.3 from 2.9.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#96 from FoamyGuy/add_matrixportal_example

Updating https://github.com/adafruit/Adafruit_CircuitPython_MatrixPortal to 1.9.0 from 1.8.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_MatrixPortal#38 from makermelissa/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_miniesptool to 0.2.5 from 0.2.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_miniesptool#23 from adafruit/nina-fw-1.7.1-updates

Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 1.7.5 from 1.7.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#50 from tannewt/better_error_handling
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#49 from adafruit/no-https-wifitest
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#45 from tannewt/fix_close
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.

2 participants