Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WHAT
Improved EEPROM handling, event log handling in memory and minimizing the number of writes to the flash-emulated EEPROM
WHY
To clear and re-initialize the event log if it seems incompatible/weird and to reduce the number of writes to EEPROM
HOW
Reducing writes: A counter counts the number of events that are logged. A timer keeps an XX minute timeout. Logged events are only written if the defined time has passed AND we have logged any events.
Log init: Check for a magic number, clear the log if the number differs from what you expect. Could be an older version, junk, etc.
TESTING
Tested on the dining room table, currently live in my setup. Appears to work as intended, i.e. only write to the log if there are events to write.
Serial print at startup (i.e. showing the event log):
View of events set since startup in web UI (NOT fetched from the event log, those are currently only visible in the message at boot):