Merge branch 'master' of github.com:0110/PlantCtrl

This commit is contained in:
Ollo 2020-11-11 22:16:30 +01:00
commit 1eba578f20

View File

@ -382,7 +382,8 @@ bool readSensors()
delay(200); delay(200);
/* Required to read the temperature once */ /* Required to read the temperature once */
for (int i = 0; i < 5; i++) int readAgain = 5;
while (readAgain > 0)
{ {
int sensors = dallas.readAllTemperatures(pFloat, 2); int sensors = dallas.readAllTemperatures(pFloat, 2);
if (sensors > 0) if (sensors > 0)
@ -395,9 +396,6 @@ bool readSensors()
Serial << "t2: " << String(temp[1]) << endl; Serial << "t2: " << String(temp[1]) << endl;
temp2.add(temp[1]); temp2.add(temp[1]);
} }
delay(50);
}
if ((temp1.getAverage() - rtcLastTemp1 > TEMPERATURE_DELTA_TRIGGER_IN_C) || if ((temp1.getAverage() - rtcLastTemp1 > TEMPERATURE_DELTA_TRIGGER_IN_C) ||
(rtcLastTemp1 - temp1.getAverage() > TEMPERATURE_DELTA_TRIGGER_IN_C)) { (rtcLastTemp1 - temp1.getAverage() > TEMPERATURE_DELTA_TRIGGER_IN_C)) {
leaveMode1 = true; leaveMode1 = true;
@ -406,6 +404,15 @@ bool readSensors()
(rtcLastTemp2 - temp2.getAverage() > TEMPERATURE_DELTA_TRIGGER_IN_C)) { (rtcLastTemp2 - temp2.getAverage() > TEMPERATURE_DELTA_TRIGGER_IN_C)) {
leaveMode1 = true; leaveMode1 = true;
} }
if(!leaveMode1){
readAgain = 0;
}
readAgain--;
delay(50);
}
rtcLastTemp1 = temp1.getAverage(); rtcLastTemp1 = temp1.getAverage();
rtcLastTemp2 = temp2.getAverage(); rtcLastTemp2 = temp2.getAverage();