-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Labels
Library: EEPROMThe EEPROM Arduino libraryThe EEPROM Arduino libraryWaiting for feedbackMore information must be provided before we can proceedMore information must be provided before we can proceed
Description
When setting bool to true or false, only the lower bit is set to 1 or 0.
But a test compares the full byte.
When for some reason, for example restoring à bool from EEPROM, some of the higher bits of the octet are set to 1, if (mybool) is always true even if the mybool is set to false jut before the test..
There is no way to set this bool to false.
For static variable this happens or not from one version to another, depending probably on what is present in memory at startup.
To solve that, in my software I declared some defines (BOOL uint8_t, TRUE 1, FALSE 0) and do not manipulate bool any longer.
I program on Arduino MEGA 2560
Metadata
Metadata
Assignees
Labels
Library: EEPROMThe EEPROM Arduino libraryThe EEPROM Arduino libraryWaiting for feedbackMore information must be provided before we can proceedMore information must be provided before we can proceed