Skip to content

Commit

Permalink
fix Emergencystop rearm and offset
Browse files Browse the repository at this point in the history
  • Loading branch information
murmeltier08 committed Dec 1, 2022
1 parent 9115618 commit 0273746
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/rancilio-pid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ int relayETriggerON, relayETriggerOFF;
void testEmergencyStop() {
if (temperature > EmergencyStopTemp && emergencyStop == false) {
emergencyStop = true;
} else if (temperature < 100 && emergencyStop == true) {
} else if (temperature < (setPointTemp+5) && emergencyStop == true) {
emergencyStop = false;
}
}
Expand Down Expand Up @@ -552,7 +552,7 @@ void calculateTemperatureMovingAverage() {
*/
boolean checkSensor(float tempInput) {
boolean sensorOK = false;
boolean badCondition = (tempInput < 0 || tempInput > 150 || fabs(tempInput - previousInput) > 5);
boolean badCondition = (tempInput < 0 || tempInput > 150 || fabs(tempInput - previousInput) > (5+brewTempOffset));

if (badCondition && !sensorError) {
error++;
Expand Down Expand Up @@ -596,16 +596,16 @@ void refreshTemp() {
temperature = sensors.getTempCByIndex(0);
#endif

if (machineState != kSteam) {
temperature -= brewTempOffset;
}

if (!checkSensor(temperature) && movingAverageInitialized) {
temperature = previousInput;
return; // if sensor data is not valid, abort function; Sensor must
// be read at least one time at system startup
}

if (machineState != kSteam) {
temperature -= brewTempOffset;
}

if (brewDetectionMode == 1) {
calculateTemperatureMovingAverage();
} else if (!movingAverageInitialized) {
Expand All @@ -629,17 +629,16 @@ void refreshTemp() {
temperature = Sensor2.getTemp();
#endif
#endif
if (machineState != kSteam) {
temperature -= brewTempOffset;
}

if (!checkSensor(temperature) && movingAverageInitialized) {
temperature = previousInput;
return; // if sensor data is not valid, abort function; Sensor must
// be read at least one time at system startup
}

if (machineState != kSteam) {
temperature -= brewTempOffset;
}

if (brewDetectionMode == 1) {
calculateTemperatureMovingAverage();
} else if (!movingAverageInitialized) {
Expand Down

0 comments on commit 0273746

Please sign in to comment.