I have a very large (2500 lines) lvgl based weather display project in the works. The code works fine when running in the host emulator. When running on an ESP32-S3 I unfortunately get a stack overflow.
The following bit of yaml is what is “causing” this:
- lambda: |-
id(arrayindex)=0;
- while:
condition:
lambda: return id(arrayindex)<30;
then:
# - lvgl.canvas.draw_line:
# id: wind_stick
# color: LIGHTGREEN
# width: 1
# points:
# - x: !lambda return 90 + (90 * (cos((id(hist_dir)[id(arrayindex)]-90)*PI/180)));
# y: !lambda return 90 + (90 * (sin((id(hist_dir)[id(arrayindex)]-90)*PI/180)));
# - x: !lambda return 90 + ((90-(70*id(hist_wind)[id(arrayindex)]/id(maxwind))) * (cos((id(hist_dir)[id(arrayindex)]-90)*PI/180)));
# y: !lambda return 90 + ((90-(70*id(hist_wind)[id(arrayindex)]/id(maxwind))) * (sin((id(hist_dir)[id(arrayindex)]-90)*PI/180)));
- lambda: id(arrayindex)++;
Note the commented code is not in play, the stack overflow happens when just this is added:
- while:
condition:
lambda: return id(arrayindex)<30;
then:
- lambda: id(arrayindex)++;
Have I just run into yet more memory limitations - or is there something else I am missing? Again - works fine on the host: platform.
EDIT: possibly memory? Reducing the number of loops to 10 instead of 30 stops the stack overflow… Opinions please?