Something must be wrong with my EEProm routines.....
I had my watering system running for 3 or 4 days and it watered as id shoul but reported an Error today.
Error is reported when the sensor is below a certain minimum treshold or broken OR when he waters 5 times and the sensor does not register a higher wetness than the first time (broken water pipe or dropped from the pot).
So I disconnected it to watchthe EEprom recordings on PC.
I did set the READ flag and uploaded. But in the SerialPlotter it shows water going up always (far more as possible for the seldom times he watered) until it reached max (255).
-
So am I right EEprom is not touched when uploading the changed sketch (changed EERead Flag)?
-
What is wrong then with my EEprom routines?
-
And why was he reporting an wetness Error 5 Times after it worked for 3 days as it should and the pot was wet as I looked?
Any Ideas?
Attached the serial plot with remarks
OH WOW!
I can't post the full code because only 9000 chars are allowed......
So here are only my EEProm routines then.
How can I post the full sketch?
void EE_WriteCalib(int CalibWert) {
EEPROM.update(EECalib, map(CalibWert, 0, 1023, 0, 255)); // Mappe Kalibration von 1024 auf 256 und schreibe in Speicher für Kalibration
}
void EE_WriteValue(int MessWert) { // Schreibt gemessenen Wert ins EEProm
EEPROM.update(EEWriteAdress, map(MessWert, 0, 1023, 0, 255)); // Mappe Messwert von 1024 auf 256 und schreibe in Speicher
EEWriteAdress++; // Adresse hochzählen
if (EEWriteAdress == EEPROM.length()) {
// EEWriteAdress = EEData; // Adresse zurücksetzen und von vorne beginnen mit Aufzeichnen oder
EE_Enable = LOW; // Aufzeichnung stoppen
}
}
void EE_SerialPrint() {
// Startstrich im Serial Plotter erzeugen
Serial.println(255);
Serial.println(0);
// Daten ausgeben
for (int i = EEData; i < EEPROM.length(); i++) { // Gebe Daten aus von Startwert bis Ende EEProm
Serial.print(EEPROM.read(i)); // Anzeige gelesener Messwert
Serial.print(" "); // Trennung damit 2. Graph mit Messdaten erstellt wird
Serial.println(EEPROM.read(EECalib)); // Kalibrationswert ausgeben
BlinkPowerEERead(); // EEProm "Widergabe aktiviert" Anzeige auf Power LED
delay(EE_ReadDelay); // Verzögerung vor Ausgabe nächster Wert
}
}