Index: leahi_dialin/td/modules/blood_flow.py =================================================================== diff -u -r52aa7af16b98730ba59fc2577dbe8f73b5959775 -r43fec7787f9a4115d19deeb5cbc1d7bbf23134fe --- leahi_dialin/td/modules/blood_flow.py (.../blood_flow.py) (revision 52aa7af16b98730ba59fc2577dbe8f73b5959775) +++ leahi_dialin/td/modules/blood_flow.py (.../blood_flow.py) (revision 43fec7787f9a4115d19deeb5cbc1d7bbf23134fe) @@ -41,8 +41,8 @@ if self.can_interface is not None: channel_id = DenaliChannels.td_sync_broadcast_ch_id - msg_id = MsgIds.MSG_ID_TD_BLOOD_PUMP_DATA.value - self.can_interface.register_receiving_publication_function(channel_id, msg_id, + self.msg_id_td_blood_pump_data = MsgIds.MSG_ID_TD_BLOOD_PUMP_DATA.value + self.can_interface.register_receiving_publication_function(channel_id, self.msg_id_td_blood_pump_data, self._handler_blood_flow_sync) self.td_blood_flow_timestamp = 0.0 self.h4_motor = { @@ -57,7 +57,7 @@ TDBloodFlowMotorAttributes.ROTOR_HALL_STATE.name: 0 } - @publish(["td_blood_flow_timestamp", "h4_motor"]) + @publish(["msg_id_td_blood_pump_data", "h4_motor", "td_blood_flow_timestamp"]) def _handler_blood_flow_sync(self, message, timestamp=0.0): """ Handles published blood flow data messages. Blood flow data are captured @@ -383,6 +383,30 @@ self.logger.debug("Timeout!!!!") return False + def cmd_hard_stop_blood_pump(self) -> int: + """ + Constructs and sends hard stop 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_HARD_STOP_BLOOD_PUMP.value) + + self.logger.debug("Hard stopping 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 + def cmd_blood_flow_alpha_y_intercept_override(self, intercept: float, reset: int = NO_RESET) -> int: """ Constructs and sends the blood flow alpha y intercept override.