You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
drawPolygon defaults to MAXN=32. The Exact kernel (drawPolygonCore in src/fl/gfx/primitives.h) then uses about 4.2 KB of stack, which is more than the 2 KB of SRAM on an ATmega328P (Uno). A sketch that calls drawPolygon with the default template arguments on an Uno silently overflows the stack. The examples avoid this by picking a smaller tier (MAXN=8 is about 870 B), but nothing stops a user from doing it.
Proposed fix
Pick one of these:
Use a platform-dependent default MAXN: small on !FL_PLATFORM_HAS_LARGE_MEMORY or AVR, 32 elsewhere.
Or cut the per-vertex stack footprint.
Also add a compile-time guard or doc note, and verify by compiling for uno with a default-argument call and checking the stack estimate (for example -fstack-usage).
Activity
fix(gfx): platform-dependent drawPolygon default MAXN/CHUNK for low-m…