A little more background on the issue fixed above:
-
The emonTx4 EEPROM is used for two different functions:
1. Storing configuration e.g radio, nodeid, CT channel calibrations etc.
2. Storing cumulative energy values -
The emonTx4 EEPROM size is 512 bytes long.
-
The configuration section currently takes up bytes 0-105.
-
With the fix today (v1.5.4) the energy values are stored in a circular buffer 13x29bytes long = 377 bytes total, starting on byte 132 through to byte 508.
-
My mistake in the previous version was to mistake the block size to be 28 bytes, I then allocated 14 blocks starting at byte 110. (110+(28×14))=502 bytes which would have been ok. There is however an identification byte alongside each block of energy values, which makes each block 29 bytes long, (110+(29x14)) = 516 bytes, which unfortunately caused the last few bytes to wrap around and erase the expected signature at the start of the EEPROM resulting in the configuration resetting.
-
The fix today shortens the circulation buffer by one block and also moves that circular buffer a little further from the config section so that we can add more config options in future if needed.