Index: leahi_dialin/td/modules/blood_flow.py =================================================================== diff -u -r7c8e829c563547ee50c517f1d6b84cb800b72027 -rd27c40205e18118f4689f62463a266da1f91dba6 --- leahi_dialin/td/modules/blood_flow.py (.../blood_flow.py) (revision 7c8e829c563547ee50c517f1d6b84cb800b72027) +++ leahi_dialin/td/modules/blood_flow.py (.../blood_flow.py) (revision d27c40205e18118f4689f62463a266da1f91dba6) @@ -19,7 +19,7 @@ from .constants import PUMP_CONTROL_MODE_CLOSED_LOOP, PUMP_CONTROL_MODE_OPEN_LOOP from .constants import RESET, NO_RESET from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions -from leahi_dialin.common.td_defs import TDBloodFlowMotorAttributes +from leahi_dialin.common.td_defs import td_enum_repository from leahi_dialin.protocols.CAN import DenaliMessage, DenaliChannels from leahi_dialin.utils.base import AbstractSubSystem, publish from leahi_dialin.utils.checks import check_broadcast_interval_override_ms @@ -46,15 +46,15 @@ self._handler_blood_flow_sync) self.td_blood_flow_timestamp = 0.0 self.h4_motor = { - TDBloodFlowMotorAttributes.SET_BLOOD_FLOW_RATE.name: 0, - TDBloodFlowMotorAttributes.MEASURED_BLOOD_FLOW_RATE.name: 0.0, - TDBloodFlowMotorAttributes.MEASURED_BLOOD_PUMP_ROTOR_SPEED.name: 0.0, - TDBloodFlowMotorAttributes.MEASURED_BLOOD_PUMP_SPEED.name: 0.0, - TDBloodFlowMotorAttributes.MEASURED_BLOOD_PUMP_TORQUE : 0.0, - TDBloodFlowMotorAttributes.SET_RPM.name: 0.0, - TDBloodFlowMotorAttributes.ROTOR_COUNT.name: 0, - TDBloodFlowMotorAttributes.PRES_BLOOD_FLOW_RATE.name: 0, - TDBloodFlowMotorAttributes.ROTOR_HALL_STATE.name: 0, + td_enum_repository.TDBloodFlowMotorAttributes.SET_BLOOD_FLOW_RATE.name: 0, + td_enum_repository.TDBloodFlowMotorAttributes.MEASURED_BLOOD_FLOW_RATE.name: 0.0, + td_enum_repository.TDBloodFlowMotorAttributes.MEASURED_BLOOD_PUMP_ROTOR_SPEED.name: 0.0, + td_enum_repository.TDBloodFlowMotorAttributes.MEASURED_BLOOD_PUMP_SPEED.name: 0.0, + td_enum_repository.TDBloodFlowMotorAttributes.MEASURED_BLOOD_PUMP_TORQUE : 0.0, + td_enum_repository.TDBloodFlowMotorAttributes.SET_RPM.name: 0.0, + td_enum_repository.TDBloodFlowMotorAttributes.ROTOR_COUNT.name: 0, + td_enum_repository.TDBloodFlowMotorAttributes.PRES_BLOOD_FLOW_RATE.name: 0, + td_enum_repository.TDBloodFlowMotorAttributes.ROTOR_HALL_STATE.name: 0, } @publish(["msg_id_td_blood_pump_data", "h4_motor", "td_blood_flow_timestamp"]) @@ -67,23 +67,23 @@ @return: none """ - self.h4_motor[TDBloodFlowMotorAttributes.SET_BLOOD_FLOW_RATE.name] = struct.unpack('i', bytearray( + self.h4_motor[td_enum_repository.TDBloodFlowMotorAttributes.SET_BLOOD_FLOW_RATE.name] = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] - self.h4_motor[TDBloodFlowMotorAttributes.MEASURED_BLOOD_FLOW_RATE.name] = struct.unpack('f', bytearray( + self.h4_motor[td_enum_repository.TDBloodFlowMotorAttributes.MEASURED_BLOOD_FLOW_RATE.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] - self.h4_motor[TDBloodFlowMotorAttributes.MEASURED_BLOOD_PUMP_ROTOR_SPEED.name] = struct.unpack('f', bytearray( + self.h4_motor[td_enum_repository.TDBloodFlowMotorAttributes.MEASURED_BLOOD_PUMP_ROTOR_SPEED.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] - self.h4_motor[TDBloodFlowMotorAttributes.MEASURED_BLOOD_PUMP_SPEED.name] = struct.unpack('f', bytearray( + self.h4_motor[td_enum_repository.TDBloodFlowMotorAttributes.MEASURED_BLOOD_PUMP_SPEED.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4]))[0] - self.h4_motor[TDBloodFlowMotorAttributes.MEASURED_BLOOD_PUMP_TORQUE.name] = struct.unpack('f', bytearray( + self.h4_motor[td_enum_repository.TDBloodFlowMotorAttributes.MEASURED_BLOOD_PUMP_TORQUE.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_5:MsgFieldPositions.END_POS_FIELD_5]))[0] - self.h4_motor[TDBloodFlowMotorAttributes.SET_RPM.name] = struct.unpack('f', bytearray( + self.h4_motor[td_enum_repository.TDBloodFlowMotorAttributes.SET_RPM.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6]))[0] - self.h4_motor[TDBloodFlowMotorAttributes.ROTOR_COUNT.name] = struct.unpack('I', bytearray( + self.h4_motor[td_enum_repository.TDBloodFlowMotorAttributes.ROTOR_COUNT.name] = struct.unpack('I', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7]))[0] - self.h4_motor[TDBloodFlowMotorAttributes.PRES_BLOOD_FLOW_RATE.name] = struct.unpack('I', bytearray( + self.h4_motor[td_enum_repository.TDBloodFlowMotorAttributes.PRES_BLOOD_FLOW_RATE.name] = struct.unpack('I', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8]))[0] - self.h4_motor[TDBloodFlowMotorAttributes.ROTOR_HALL_STATE.name] = struct.unpack('I', bytearray( + self.h4_motor[td_enum_repository.TDBloodFlowMotorAttributes.ROTOR_HALL_STATE.name] = struct.unpack('I', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9]))[0] self.td_blood_flow_timestamp = timestamp