You use PlatformIO, and your program works correctly when compiled in “release” mode.
However, when you compile with the “debug” mode, the ESP8266 behaves weirdly or crashes with
This is a known issue due to a stack overflow in the recursive part of
Indeed, when compiled with the flag
-Og (the default when you build in “debug” mode), the stack usage in
deserializeJson() is multiplied by five (we still don’t know how to explain that).
Fortunately, there is a very simple workaround: change the
Instead of the default
-Og -g2 -ggdb2, use
-O0 -g2 -ggdb2.
; platformio.ini build_type = debug debug_build_flags = -O0 -g2 -ggdb2