hardwario / SoilSensor

Arduino library for HARDWARIO Soil Sensor
3 stars 5 forks source link

Error loading EEPROM calibration data #6

Closed petrkr closed 2 years ago

petrkr commented 5 years ago

For some reason data structures are about 2 B bigger than stored "length" value in EEPROM. I do not know if it's problem of size of structures or wrong saved value in EEPROM chip. I have more sensors and both do same.

Loading header...OK
EEPROM header: DEADBEEF 1 42 13756
Checking signature... OK
Checking version... OK
Checking data length... Bad header length - soilSensorEeprom: 42 header vs 44
Reading eeprom to struct... OK
Checking data CRC... Bad header CRC
EEPROM data (prefill): 0 1  8025 8242 8459 8676 8896 9113 9330 9547 9764 9981 65535 
Running eeprom fill
EEPROM data: 0 104  1700 1818 1936 2054 2172 2290 2408 2526 2644 2762 3000 
Error loading eeprom data

Can see, in EEPROM is stored 42 B, but size of struct is 44.

Also you can see last calibration data was 65535, so value in EEPROM is actually right (about length).

If I will change char label[16+1] to label[14+1] (actually 15 chars instead 17). Then it works correctly.

Do not know if documentation is wrong (regarding to this article about data structure https://developers.bigclown.com/hardware/about-soil-moisture-sensor) - Because also there is written Length of that is 64B (Which does not make sense at all)

Loading header...OK
EEPROM header: DEADBEEF 1 42 13756
Checking signature... OK
Checking version... OK
Checking data length... OK
Reading eeprom to struct... OK
Checking data CRC... OK
EEPROM data (prefill): 0 1  7808 8025 8242 8459 8676 8896 9113 9330 9547 9764 9981 
EEPROM data: 0 1  7808 8025 8242 8459 8676 8896 9113 9330 9547 9764 9981 
EEPROM Loaded ok
petrkr commented 2 years ago

not relevant anymore