Skip to content

Remove timeout Exception #206

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 1 commit into from
May 21, 2024

Conversation

justmobilize
Copy link
Collaborator

@justmobilize justmobilize commented May 21, 2024

This removes the custom timeout Exception that makes this socket library behave like CPython versions pre 3.10 and updates it to behave like espressif and pico-w.

This should fix the issues with adafruit/Adafruit_CircuitPython_MiniMQTT#216

If this is successful, a similar PR can be opened for the WIZnet5k, and a comment only PR for MiniMQTT to specify what devices hit which paths

@justmobilize
Copy link
Collaborator Author

@prcutler I did some basic testing with this and didn't have any issues. Would you be willing to test? In order to do so, can you:

  1. Install MiniMQTT v7.8.0 (which is now in the bundle)
  2. Download this version on esp32spi and place it in the root (not the lib, since it's frozen on the pyportal)
  3. Run your code

If all goes well this should work as planned. I would let it loop through enough times that it logs KeepAlive period elapsed, then try to post a message and see if it keeps going through.

@prcutler
Copy link

I think I need a little help. Trying to follow the instructions above, I've installed the latest MiniMQTT via Circup. I downloaded this repo as a zip file and copied adafruit_esp32spi.py to the root of my PyPortal.

I get the error:

Traceback (most recent call last):
  File "main.py", line 78, in <module>
  File "adafruit_connection_manager.py", line 134, in get_radio_socketpool
ImportError: no module named 'adafruit_esp32spi.adafruit_esp32spi_socketpool'

If I copy over adafruit_esp32spi_socketpool.py and adafruit_esp32spi_wifimanager.py` and put them in the root direcotry too, I get the same error:

Traceback (most recent call last):
  File "main.py", line 78, in <module>
  File "adafruit_connection_manager.py", line 134, in get_radio_socketpool
ImportError: no module named 'adafruit_esp32spi.adafruit_esp32spi_socketpool'

If I copy the whole directory to the root of my PyPortal, I get:

main.py output:
Traceback (most recent call last):
  File "main.py", line 64, in <module>
AttributeError: 'module' object has no attribute 'ESP_SPIcontrol'

and line 64 is: esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)

Any pointers appreciated. Thanks!

@dhalbert
Copy link
Contributor

Copying the whole adafruit_esp32spi/ directory to CIRCUITPY is correct. Then also remove the solo files you copied over.

@justmobilize justmobilize marked this pull request as ready for review May 21, 2024 13:35
@prcutler
Copy link

This now is succesfully working - thanks @justmobilize .

I've sent a few messages without any crashes and it's been up and running for the last 15 minutes without any issues.

Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

This looks good and thanks @prcutler for testing.

Do you want to clean up the code or comments in MiniMQTT? I think it should still handle the timeout exception, but the comments might be misleading. It could also handle TimeOutError explicitly. TimeoutError was added in CPython 3.3 so I think it's fine to use it.

@dhalbert dhalbert merged commit deb2a5f into adafruit:main May 21, 2024
1 check passed
@justmobilize justmobilize deleted the remove-timeout-exception branch May 21, 2024 14:46
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request May 22, 2024
Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 8.3.0 from 8.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#206 from justmobilize/remove-timeout-exception
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#205 from justmobilize/remove-socket-pool-contants

Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 7.1.1 from 7.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#162 from justmobilize/remove-socket-pool-contants
  > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#163 from justmobilize/remove-timeout-exception

Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 7.8.1 from 7.8.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#217 from justmobilize/update-comments

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
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.

3 participants