Index: HemodialysisDevice.py =================================================================== diff -u -rb83f5ec66b645fac0d11fe649035512cf8b0d8e5 -r7da3ea9575c7a0ae9a03ea934ce907f4eccbc2aa --- HemodialysisDevice.py (.../HemodialysisDevice.py) (revision b83f5ec66b645fac0d11fe649035512cf8b0d8e5) +++ HemodialysisDevice.py (.../HemodialysisDevice.py) (revision 7da3ea9575c7a0ae9a03ea934ce907f4eccbc2aa) @@ -48,7 +48,7 @@ self._Basics = HD.HD__Basics(self) self.Alarms = HD.HD_Alarms(self) self.Buttons = HD.HD_Buttons(self) - self.BloodFlow = HD.HD_BloodFlow(self) + self.BloodFlow = HD.HD_BloodFlow(self, self.can_interface) self.Watchdog = HD.HD_Watchdog(self) # Create constants self.NO_RESET = 0 @@ -458,8 +458,20 @@ """ - def __init__(self, outer_instance): + def __init__(self, outer_instance, can_interface=None): self.outer_instance = outer_instance + + if can_interface is not None: + channel_id = 0x40 + msg_id = 0x5 + can_interface.registerSyncFunction( channel_id, msg_id, self.BloodFlowSyncFunction) + + self.TargetBloodFlowRate = 0 + self.MeasuredBloodFlowRate = 0.0 + self.MeasuredBloodPumpMCSpeed = 0.0 + self.MeasuredBloodPumpCurrent = 0.0 + + """ HD_BloodFlow constructor @@ -468,7 +480,11 @@ \returns HD_BloodFlow object. """ + def BloodFlowSyncFunction(self, message): + self.TargetBloodFlowRate = int.from_bytes(bytearray(message[4:8]),byteorder='little') + + def BloodFlowSetPointOverride(self, reset, flow): """ Constructs and sends the blood flow set point override command