if `MY_NODE_ID` is not AUTO
-
if (MY_NODE_ID != AUTO) { // Set static id _nc.nodeId = MY_NODE_ID; // Save static id in eeprom hwWriteConfig(EEPROM_NODE_ID_ADDRESS, MY_NODE_ID); }
In the
stInitTransition
function,ifMY_NODE_ID
is not AUTO,the code will write eeprom one time.if the node reset because some mistakes,It's to bad for the eeprom.Isn't it?
-
What do you mean?
-
It will only write to EEPROM if the value differs from the one already stored. So no, this won't affect EEPROM.
-
@hek For example,If i define
MY_NODE_ID
is2
,When the node reset,,the logic of this code will write the eeprom again(hwWriteConfig(EEPROM_NODE_ID_ADDRESS, MY_NODE_ID);
). Isn't it?
-
hwWriteConfig == eeprom_update_byte
See doc:
http://www.nongnu.org/avr-libc/user-manual/group__avr__eeprom.htmlupdate reads before writing
-
@magicw ok,thanks!