Closed clementnuss closed 4 years ago
You might try this flag in PlatformIO:
build_flags =
${env.build_flags}
-DCONFIG_ASYNC_TCP_RUNNING_CORE=1
This will order AsycTCP to use core 1 (same as your sketch loop code) and modify watchdog handling
//If core is not defined, then we are running in Arduino or PIO
#ifndef CONFIG_ASYNC_TCP_RUNNING_CORE
#define CONFIG_ASYNC_TCP_RUNNING_CORE -1 //any available core
#define CONFIG_ASYNC_TCP_USE_WDT 1 //if enabled, adds between 33us and 200us per event
#endif
Probably you also can try to define CONFIG_ASYNC_TCP_USE_WD separately
BTW: There is currently something wrong with TCP handling with ESP32 (AsyncTCP) when several publishs are done one after another. (I already reported this to @philbowles and he is working on it)
This issue with TCP ACK handling in ESP32 is connected with way AsycTCP handles cansend() differently than ESPAsycTCP.
You might do a check: (only for a test of course !) Just change one line in asynctcp.cpp (1134)
bool AsyncClient::canSend(){
return space() > 0;
}
to
bool AsyncClient::canSend(){
return !_pcb_busy && (space() > 0);
}
Just report if it works then (?) Then it should be possible to modify PangolinMQTT to work with both.
I tried the DCONFIG_ASYNC_TCP_RUNNING_CORE=1
flag, which prevented the crash but the software still was not working correctly.
Finally, the solution to check !_pcb_busy
does work ! (with and without the compile flag).
Great if you can accomodate this in PangolinMQTT 👌
I have just pushed a dev branch which I think fixes the ESP32 ack problem - grateful if you could try that and report back
I just downloaded the new code from dev branch and compiled it into my ESP32 sketch: Works pretty well now, no "_pcb_busy-workaround" needed anymore.
Thanks, Rainer!
When running the Quickstart_P.ino sketch, adapted to run on an ESP32, it successfully connects to the WiFi, from the console it appears that it correctly sends the MQTT test messages with QoS 0, 1, and 2.
On the other side, reading with node-red, I only see the QoS 0 test payload on my (local) MQTT server.