Resetting the decoder
Closed this issue · 1 comments
marko-pi commented
On resetting the decoder, CV8 -> 8, notifyCVResetFactoryDefault() is triggered seven times. It is probably not a good idea for EEPROM to be rewritten too many times.
As a patch, I used if (FactoryDefaultCVIndex == 0) in front of FactoryDefaultCVIndex = sizeof(FactoryDefaultCVs)/sizeof(CVPair);
This reduces seven EEPROM writes to "only" three.
I am using PiSPROG DCC controller/programmer and ATmega328.
Best regards!
kiwi64ajs commented
I don't think this is really an issue as the NmraDcc library reads the current EEPROM value and compares the current value to the new value first before overwriting it to avoid needless EEPROM Writes.
Here is the code: https://github.com/mrrwa/NmraDcc/blob/master/NmraDcc.cpp#L871