@@ -301,10 +301,31 @@ def __init__(self, config):
301
301
}
302
302
303
303
304
- class ePBRGeneralPump (PBRGeneralPump ):
304
+ class ePBRpump (PBRGeneralPump ):
305
305
def __init__ (self , config ):
306
- super (ePBRGeneralPump , self ).__init__ (config )
306
+ super (ePBRpump , self ).__init__ (config )
307
307
308
- # od should be available somehow
309
- # because is being used for OD bounds
310
- # so we need to use it also for decision to keep on pump
308
+ def stabilize (self , od ):
309
+ if self .is_od_value_too_high (od ):
310
+ self .is_pump_on = True
311
+ if self .is_od_value_too_low (od ):
312
+ self .is_pump_on = False
313
+ if self .is_pump_on :
314
+ self .change_pump_state (True )
315
+
316
+ def change_pump_state (self , state : bool ):
317
+ for try_n in range (5 ):
318
+ command = Command (self .device_id , "8" , [self .pump_id , 1 ], self .task_id )
319
+ self .device .post_command (command , 1 )
320
+ command .await_cmd ()
321
+
322
+ if isinstance (command .response , bool ) and command .response :
323
+ sleep (2 )
324
+
325
+ command = Command (self .device_id , "8" , [self .pump_id , 0 ], self .task_id )
326
+ self .device .post_command (command , 1 )
327
+ command .await_cmd ()
328
+
329
+ if isinstance (command .response , bool ) and command .response :
330
+ return
331
+ raise ConnectionError
0 commit comments