From 804cb361c1e529ced10a7e3c450dc1090bc1fc0b Mon Sep 17 00:00:00 2001 From: Martijn Date: Wed, 28 Aug 2024 13:32:13 +0200 Subject: [PATCH 1/2] #63 Add stopping to underflow detection --- py_driver/driver.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/py_driver/driver.py b/py_driver/driver.py index e57c41a..64b839c 100644 --- a/py_driver/driver.py +++ b/py_driver/driver.py @@ -274,6 +274,11 @@ def _underflow_check(self): else: if DEBUG: print(f'{TAG}: No underflow detected in watchdog.') + + # Stop checking underflow. + if self.stopped: + break + sleep(UNDERFLOW_CHECK_INTERVAL) def _read_lines(self): From f5583f06caa000021382b863d457ff1a479d0b19 Mon Sep 17 00:00:00 2001 From: Martijn Date: Wed, 28 Aug 2024 13:32:31 +0200 Subject: [PATCH 2/2] #63 Add method description --- py_driver/driver.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/py_driver/driver.py b/py_driver/driver.py index 64b839c..36371f9 100644 --- a/py_driver/driver.py +++ b/py_driver/driver.py @@ -235,6 +235,10 @@ def update_state(self, tube=None, quick=False, initial=False): raise SensorError(f"Failed to retrieve new state, got {state}.") def _underflow_check(self): + """ + Checks whether underflow occurs, i.e., the outflow pump is pumping while water is lower than + lowest allowed level. This check prevents the outflow pump from pumping air. + """ TAG = "UNDERFLOW_CHECK" while True: if not self.ready():