Skip to content

mqtt.loop() blocks loop temporarily #241

@mjmare

Description

@mjmare

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions