Adafruit_CircuitPython_MiniMQTT
Adafruit_CircuitPython_MiniMQTT copied to clipboard
mqtt.loop() blocks loop temporarily
I have a Neopixel strip animation with my RPI Pico 2040 W which runs smoothly until I add mqtt.loop() to my main loop. This will cause a very noticeable halt in the animation. I experimented with different timeout values. I can decrease the timeout to 0.2 (necessitating a decrease to the socket_timeout to 0.2 as well). This improves the situation but the stall is still very noticeable. Decreasing the timeout even more causes network problems.
Of course it would be much nicer if there would be a async version of this library.
My main loop:
while True:
current_animation.animate()
mqtt_client.loop(timeout=0.2)
read_card(state)
publish_card(state)
TIA Marcel