Added 4 new images for opening and closing out valve while barrell is either full or not full... also tried to add additional constraints for pump handling in means of that the pump should not be pumping if the out valve is open or opening
This commit is contained in:
@@ -27,7 +27,7 @@ function reactToSensorData(nextSensorReading) {
|
||||
console.log("reacting to sensor");
|
||||
var controllerId = nextSensorReading.controllerId;
|
||||
var state = stateOrDefault(controllerId).state;
|
||||
var shouldStartPumping = (parseInt(nextSensorReading.tankFull) === 0 && (!state.in_valve || state.in_valve === 'closed'));
|
||||
var shouldStartPumping = (!state.in_valve || state.in_valve === 'closed') && ((parseInt(nextSensorReading.tankFull) === 0) && (state.out_valve === 'closed' || state.out_valve === 'closing'));
|
||||
|
||||
if (shouldStartPumping) {
|
||||
ControllerState.update({
|
||||
@@ -40,7 +40,7 @@ function reactToSensorData(nextSensorReading) {
|
||||
}
|
||||
});
|
||||
}
|
||||
var shouldStopPumping = parseInt(nextSensorReading.tankFull) === 1 && (state.in_valve === 'open' || state.in_valve === 'opening');
|
||||
var shouldStopPumping = (state.in_valve === 'open' || state.in_valve === 'opening') && (parseInt(nextSensorReading.tankFull) === 1 || state.out_valve === 'open' || state.out_valve === 'opening');
|
||||
|
||||
if (shouldStopPumping) {
|
||||
ControllerState.update({
|
||||
@@ -91,7 +91,7 @@ function stateOrDefault(id) {
|
||||
},
|
||||
time: new Date(),
|
||||
config: {
|
||||
draining_period_amount: 5,
|
||||
draining_period_amount: 60,
|
||||
draining_period_unit: 'minutes'
|
||||
},
|
||||
set_by: 'server'
|
||||
|
||||
Reference in New Issue
Block a user