So this bug has been open against the compiler for over 6 years.
I guess that the most direct solution is to use:
if
else if
else if
else if
. . .
So this bug has been open against the compiler for over 6 years.
I guess that the most direct solution is to use:
if
else if
else if
else if
. . .
Changed all the switch's to if's. The example code now looks like
{uint8_t iSWITCH=(My_Decoder.value & 0xFF);
if ( (iSWITCH) == (0x00) ) { F_Cmd = F_0; } else
if ( (iSWITCH) == (0x01) ) { F_Cmd = F_1; } else
if ( (iSWITCH) == (0x02) ) { F_Cmd = F_2; } else
if ( (iSWITCH) == (0x03) ) { F_Cmd = F_3; } else
if ( (iSWITCH) == (0x04) ) { F_Cmd = F_4; } else
. . .
if ( (iSWITCH) == (0xE1) ) { F_Cmd = F_Enter; }
}
The memory usage is now:
Sketch uses 20284 bytes (62%) of program storage space. Maximum is 32256 bytes.
Global variables use 1076 bytes (52%) of dynamic memory, leaving 972 bytes for local variables. Maximum is 2048 bytes.
Sketch went from 17080 to 20284 bytes.
That sounds like a big increase, but I uncommented ALL the case statements that prevented the code from compiling.
Global variables use went from 1574 to 1076 bytes.
A VERY large savings of a VERY limited resource.
I don't like the problem.
I don't like that it hasn't been fixed yet.
I don't like the solution.
I do like that my code now works.