-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Description
Please fix the limit of 'if' and/or 'switch/case' total in the compiler. It strongly appears to be a memory allocation or limit that is set in the compiler and affects both 'if' and 'switch/case' statements alike. Originally I had 2 different switches with 155 cases total throughout my program (each with 1 line command per case). When I commented out 6 (bringing the total to 149) the program compiles and runs as expected. Anything over that, the compiler will compile and upload, but the program will not run. Any attempt to add more conditions per case, causes the same issue of the program not running if even more case statements are not commented out. I went as far as re-writing approximately 25% of my program to replace all the 'switch/case' statements with 'if' statements. Physical memory on the board is not a problem as this is where I'm currently at on my atMega2560:
Sketch uses 120778 bytes (47%) of program storage space. Maximum is 253952 bytes.
Global variables use 3034 bytes (37%) of dynamic memory, leaving 5158 bytes for local variables. Maximum is 8192 bytes.