Skip to content

Commit

Permalink
Merge pull request #72 from DEIS-Tools/70-python-overflow-detection-s…
Browse files Browse the repository at this point in the history
…tops-device-while-not-at-minimum-levels

#70 [Python] overflow detection not working
  • Loading branch information
magoorden authored Aug 28, 2024
2 parents d95879d + 39113a6 commit 7baad69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py_driver/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,14 @@ def _underflow_check(self):
self.update_state(quick=True)

# check underflows
if self.state.Tube1_sonar_dist_mm < TUBE_MAX_LEVEL:
if self.state.Tube1_sonar_dist_mm > TUBE_MAX_LEVEL:
# if outflow is active while inflow is stopped, error out
if self.state.Tube1_outflow_duty > 0 and self.state.Tube1_inflow_duty == 0:
self.set_outflow(1, 0)
print(
f'{TAG}: WARN: Low water level detected in tube 1: {self.state.Tube1_sonar_dist_mm}. Stopped outflow')

elif self.state.Tube2_sonar_dist_mm < TUBE_MAX_LEVEL:
elif self.state.Tube2_sonar_dist_mm > TUBE_MAX_LEVEL:
# if outflow is active while inflow is stopped, error out
if self.state.Tube2_outflow_duty > 0 and self.state.Tube2_inflow_duty == 0:
self.set_outflow(2, 0)
Expand Down

0 comments on commit 7baad69

Please sign in to comment.