Index: leahi_dialin/td/modules/blood_flow.py =================================================================== diff -u -rdf2b51a17a2ccdaf3587f631de7623fa7fcae624 -reb02c56e88faeeda46ed62b1c0ec841dca0b9aba --- leahi_dialin/td/modules/blood_flow.py (.../blood_flow.py) (revision df2b51a17a2ccdaf3587f631de7623fa7fcae624) +++ leahi_dialin/td/modules/blood_flow.py (.../blood_flow.py) (revision eb02c56e88faeeda46ed62b1c0ec841dca0b9aba) @@ -55,7 +55,7 @@ self.h4_rotor_hall_state = 0 - @publish(["td_blood_flow_timestamp", "h4_set_blood_flow_rate", "h4_measured_blood_flow_rate", "h4_measured_blood_pump_rotor_speed", + @publish(["td_blood_flow_timestamp", "set_blood_flow_rate", "h4_measured_blood_flow_rate", "h4_measured_blood_pump_rotor_speed", "h4_measured_blood_pump_speed", "h4_measured_blood_pump_motor_current", "h4_set_rpm", "h4_rotor_count", "h4_pres_blood_flow_rate", "h4_rotor_hall_state"]) def _handler_blood_flow_sync(self, message, timestamp=0.0): @@ -67,25 +67,34 @@ @return: none """ - self.h4_set_blood_flow_rate = struct.unpack('i', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] - self.h4_measured_blood_flow_rate = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] - self.h4_measured_blood_pump_rotor_speed = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] - self.h4_measured_blood_pump_speed = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4]))[0] - self.h4_measured_blood_pump_motor_current = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_5:MsgFieldPositions.END_POS_FIELD_5]))[0] - self.h4_set_rpm = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6]))[0] - self.h4_rotor_count = struct.unpack('I', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7]))[0] - self.h4_pres_blood_flow_rate = struct.unpack('I', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8]))[0] - self.h4_rotor_hall_state = struct.unpack('I', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9]))[0] + tgt = struct.unpack('i', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1])) + flow = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2])) + rotor = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3])) + speed = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4])) + mccurr = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_5:MsgFieldPositions.END_POS_FIELD_5])) + rpm = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6])) + rot = struct.unpack('I', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7])) + pres = struct.unpack('I', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8])) + hal = struct.unpack('I', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9])) + self.h4_set_blood_flow_rate = tgt[0] + self.h4_measured_blood_flow_rate = flow[0] + self.h4_measured_blood_pump_rotor_speed = rotor[0] + self.h4_measured_blood_pump_speed = speed[0] + self.h4_measured_blood_pump_motor_current = mccurr[0] + self.h4_set_rpm = rpm[0] + self.h4_rotor_count = rot[0] + self.h4_pres_blood_flow_rate = pres[0] + self.h4_rotor_hall_state = hal[0] self.td_blood_flow_timestamp = timestamp def cmd_blood_flow_set_flow_rate_request(self, flow: int, mode: int = PUMP_CONTROL_MODE_CLOSED_LOOP) -> int: @@ -357,28 +366,3 @@ else: self.logger.debug("Timeout!!!!") return False - - def cmd_home_blood_pump(self) -> int: - """ - Constructs and sends home blood pump command. - Constraints: - Must be logged into TD. - - @return: 1 if successful, zero otherwise - """ - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_td_ch_id, - message_id=MsgIds.MSG_ID_TD_HOME_BLOOD_PUMP_REQUEST.value) - - self.logger.debug("homing blood pump") - - # Send message - received_message = self.can_interface.send(message) - - # If there is content... - if received_message is not None: - # response payload is OK or not OK - return True - else: - self.logger.debug("Timeout!!!!") - return False