Index: dialin/hd/blood_flow.py =================================================================== diff -u -rbb27421af996ff0333c514d27d9c0b13155bce77 -r8ef896637a8d369cc07668e0ecc64d0754ae1b66 --- dialin/hd/blood_flow.py (.../blood_flow.py) (revision bb27421af996ff0333c514d27d9c0b13155bce77) +++ dialin/hd/blood_flow.py (.../blood_flow.py) (revision 8ef896637a8d369cc07668e0ecc64d0754ae1b66) @@ -53,6 +53,7 @@ self.pwm_duty_cycle_pct = 0.0 self.rotor_count = 0 self.pres_blood_flow_rate = 0 + self.rotor_hall_state = 0 def get_target_blood_flow_rate(self): """ @@ -126,9 +127,17 @@ """ return self.pres_blood_flow_rate + def get_blood_pump_rotor_hall_state(self): + """ + Gets the blood pump rotor hall sensor state. + + @return: the current blood pump rotor hall sensor state (1=home, 0=not home) + """ + return self.rotor_hall_state + @publish(["hd_blood_flow_timestamp", "target_blood_flow_rate", "measured_blood_flow_rate", "measured_blood_pump_rotor_speed", "measured_blood_pump_speed", "measured_blood_pump_mc_speed", "measured_blood_pump_mc_current", - "pwm_duty_cycle_pct", "rotor_count", "pres_blood_flow_rate"]) + "pwm_duty_cycle_pct", "rotor_count", "pres_blood_flow_rate", "rotor_hall_state"]) def _handler_blood_flow_sync(self, message, timestamp=0.0): """ Handles published blood flow data messages. Blood flow data are captured @@ -156,6 +165,8 @@ message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8])) pres = struct.unpack('I', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9])) + hal = struct.unpack('I', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_10:MsgFieldPositions.END_POS_FIELD_10])) self.target_blood_flow_rate = tgt[0] self.measured_blood_flow_rate = flow[0] @@ -166,6 +177,7 @@ self.pwm_duty_cycle_pct = pwm[0] self.rotor_count = rot[0] self.pres_blood_flow_rate = pres[0] + self.rotor_hall_state = hal[0] self.hd_blood_flow_timestamp = timestamp def cmd_blood_flow_set_point_override(self, flow: int, mode: int = PUMP_CONTROL_MODE_CLOSED_LOOP, Index: dialin/hd/dialysate_inlet_flow.py =================================================================== diff -u -rbb27421af996ff0333c514d27d9c0b13155bce77 -r8ef896637a8d369cc07668e0ecc64d0754ae1b66 --- dialin/hd/dialysate_inlet_flow.py (.../dialysate_inlet_flow.py) (revision bb27421af996ff0333c514d27d9c0b13155bce77) +++ dialin/hd/dialysate_inlet_flow.py (.../dialysate_inlet_flow.py) (revision 8ef896637a8d369cc07668e0ecc64d0754ae1b66) @@ -56,6 +56,7 @@ self.rotor_count = 0 self.pres_dialysate_flow_rate = 0 self.hd_dial_inlet_flow_timestamp = 0.0 + self.rotor_hall_state = 0 def get_target_dialysate_inlet_flow_rate(self): """ @@ -129,6 +130,14 @@ """ return self.pres_dialysate_flow_rate + def get_dial_inlet_pump_rotor_hall_state(self): + """ + Gets the dialysate inlet pump rotor hall sensor state. + + @return: the current dialysate inlet pump rotor hall sensor state (1=home, 0=not home) + """ + return self.rotor_hall_state + @publish([ "hd_dial_inlet_flow_timestamp", "target_dialysate_inlet_flow_rate", @@ -137,7 +146,10 @@ "measured_dialysate_inlet_pump_speed", "measured_dialysate_inlet_pump_mc_speed", "measured_dialysate_inlet_pump_mc_current", - "pwm_duty_cycle_pct", "rotor_count", "pres_dialysate_flow_rate" + "pwm_duty_cycle_pct", + "rotor_count", + "pres_dialysate_flow_rate", + "rotor_hall_state" ]) def _handler_dialysate_inlet_flow_sync(self, message, timestamp=0.0): """ @@ -166,6 +178,8 @@ message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8])) pres = struct.unpack('I', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9])) + hal = struct.unpack('I', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_10:MsgFieldPositions.END_POS_FIELD_10])) self.target_dialysate_inlet_flow_rate = tgt[0] self.measured_dialysate_inlet_flow_rate = flow[0] @@ -176,6 +190,7 @@ self.pwm_duty_cycle_pct = pwm[0] self.rotor_count = rot[0] self.pres_dialysate_flow_rate = pres[0] + self.rotor_hall_state = hal[0] self.hd_dial_inlet_flow_timestamp = timestamp def cmd_dialysate_inlet_flow_set_point_override(self, Index: dialin/hd/dialysate_outlet_flow.py =================================================================== diff -u -rbb27421af996ff0333c514d27d9c0b13155bce77 -r8ef896637a8d369cc07668e0ecc64d0754ae1b66 --- dialin/hd/dialysate_outlet_flow.py (.../dialysate_outlet_flow.py) (revision bb27421af996ff0333c514d27d9c0b13155bce77) +++ dialin/hd/dialysate_outlet_flow.py (.../dialysate_outlet_flow.py) (revision 8ef896637a8d369cc07668e0ecc64d0754ae1b66) @@ -52,6 +52,7 @@ self.measured_dialysate_outlet_pump_mc_current = 0.0 self.pwm_duty_cycle_pct = 0.0 self.hd_dial_outlet_flow_timestamp = 0.0 + self.rotor_hall_state = 0 def get_reference_dialysate_outlet_uf_volume(self): """ @@ -107,6 +108,14 @@ """ return self.pwm_duty_cycle_pct + def get_dial_outlet_pump_rotor_hall_state(self): + """ + Gets the dialysate outlet pump rotor hall sensor state. + + @return: the current dialysate outlet pump rotor hall sensor state (1=home, 0=not home) + """ + return self.rotor_hall_state + @publish([ "hd_dial_outlet_flow_timestamp", "reference_dialysate_outlet_uf_volume", @@ -115,7 +124,8 @@ "measured_dialysate_outlet_pump_speed", "measured_dialysate_outlet_pump_mc_speed", "measured_dialysate_outlet_pump_mc_current", - "pwm_duty_cycle_pct" + "pwm_duty_cycle_pct", + "rotor_hall_state" ]) def _handler_dialysate_outlet_flow_sync(self, message, timestamp=0.0): """ @@ -140,6 +150,8 @@ message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6])) pwm = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7])) + hal = struct.unpack('I', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8])) self.reference_dialysate_outlet_uf_volume = refvol[0] self.measured_dialysate_outlet_uf_volume = measvol[0] @@ -148,6 +160,7 @@ self.measured_dialysate_outlet_pump_mc_speed = mcspeed[0] self.measured_dialysate_outlet_pump_mc_current = mccurr[0] self.pwm_duty_cycle_pct = pwm[0] + self.rotor_hall_state = hal[0] self.hd_dial_outlet_flow_timestamp = timestamp def cmd_dialysate_outlet_flow_set_point_override(self,