peterhinch / micropython-mqtt

A 'resilient' asynchronous MQTT driver. Recovers from WiFi and broker outages.
MIT License
549 stars 116 forks source link

On a ESP32, using mqtt_as with range, and if I send 1 subscribe slow handling, if I send say 3 subscribes, only the 1st is slow to be recongized, the following are processed fast? #109

Open Jibun-no-Kage opened 1 year ago

Jibun-no-Kage commented 1 year ago

Using mqtt_as with range, and if I send 1 subscribe slow handling, if I send say 1 subscribes, only the 1st is slow to be recognized/processed on board the ESP32, the following are processed much faster? This is the 19.x (latest ESP32 micropython image). This the same comparable behavior I saw on Pico W before you disabled the power management on the Pico W by default.

peterhinch commented 1 year ago

I haven't noticed this, but it does sound like some kind of sleep behaviour. Aside from RP2 there is also special handling for ESP8266 here. Are you aware of a similar facility in ESP32?

Jibun-no-Kage commented 1 year ago

Found this... https://lastminuteengineers.com/esp32-sleep-modes-power-consumption/

peterhinch commented 1 year ago

Interesting. The ESP32 reference board takes about 55mA when connected to a network but otherwise idle. This is less than the 160-250mA quoted by your reference. Perhaps MicroPython changes modes dynamically?

I can see two difficulties. Firstly the growing number of ESP32 variants is likely to make this a significant research task. Secondly I'm rather busy with other things. However if you, or anyone else, can point me to a fix for one or more variants I'll happily implement it.

Jibun-no-Kage commented 1 year ago

Yup, no problem, I will keep digging. And like the Pico W scenario, if I can figure out a realistic change, will let you know. What I have is working, just not as fast as I expected, given my experience with ESP8266 and Pico. The ESP32s I have are older, but have been solid thus far. I am also going to implement the same logic via Arduino IDE (in C) just to compare.