Index: leahi_dialin/ro/modules/boost_pump.py =================================================================== diff -u -rbfb64f60f01b65c3acbead5608acba277bab7d0e -rdfbb4f080638b65d9836b22bd5c76d46d53abba5 --- leahi_dialin/ro/modules/boost_pump.py (.../boost_pump.py) (revision bfb64f60f01b65c3acbead5608acba277bab7d0e) +++ leahi_dialin/ro/modules/boost_pump.py (.../boost_pump.py) (revision dfbb4f080638b65d9836b22bd5c76d46d53abba5) @@ -28,13 +28,13 @@ @unique class ROPumpNames(DialinEnum): - PUMP_RO = 0 - PUMP_BOOSTER = 1 + P12_PUMP_RO = 0 + P40_PUMP_BOOSTER = 1 class ROPumps(AbstractSubSystem): """ - TReverse Osmosis (RO) Dialin API sub-class for blood-flow related commands. + Dialin API sub-class for RO pump related commands. """ def __init__(self, can_interface, logger: Logger): @@ -51,25 +51,25 @@ self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_boost_pump_sync) self.ro_pump_timestamp = 0.0 - self.ro_pump_state = 0 - self.ro_pump_duty_cycle = 0.0 - self.ro_pump_fb_duty_cycle = 0.0 - self.ro_pump_speed = 0.0 - self.boost_pump_state = 0 - self.boost_pump_duty_cycle = 0.0 - self.boost_pump_fb_duty_cycle = 0.0 - self.boost_pump_speed = 0.0 + self.p12_ro_pump_state = 0 + self.p12_ro_pump_duty_cycle = 0.0 + self.p12_ro_pump_fb_duty_cycle = 0.0 + self.p12_ro_pump_speed = 0.0 + self.p40_boost_pump_state = 0 + self.p40_boost_pump_duty_cycle = 0.0 + self.p40_boost_pump_fb_duty_cycle = 0.0 + self.p40_boost_pump_speed = 0.0 - @publish(["ro_pump_timestamp", "ro_pump_state", "ro_pump_duty_cycle", "ro_pump_fb_duty_cycle", - "ro_pump_speed", "boost_pump_state", "boost_pump_duty_cycle", - "boost_pump_fb_duty_cycle", "boost_pump_speed"]) + @publish(["ro_pump_timestamp", "p12_ro_pump_state", "p12_ro_pump_duty_cycle", "p12_ro_pump_fb_duty_cycle", + "p12_ro_pump_speed", "p40_boost_pump_state", "p40_boost_pump_duty_cycle", + "p40_boost_pump_fb_duty_cycle", "p40_boost_pump_speed"]) def _handler_boost_pump_sync(self, message, timestamp=0.0): """ - Handles published blood flow data messages. Blood flow data are captured + Handles published RO pump data messages. RO pump data is captured for reference. - @param message: published blood flow data message + @param message: published RO pump data message @return: none """ @@ -91,14 +91,14 @@ message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8])) self.ro_pump_timestamp = timestamp - self.ro_pump_state = rps[0] - self.ro_pump_duty_cycle = rpdc[0] - self.ro_pump_fb_duty_cycle = rpfbdc[0] - self.ro_pump_speed = rprpm[0] - self.boost_pump_state = bps[0] - self.boost_pump_duty_cycle = bpdc[0] - self.boost_pump_fb_duty_cycle = bpfbdc[0] - self.boost_pump_speed = bprpm[0] + self.p12_ro_pump_state = rps[0] + self.p12_ro_pump_duty_cycle = rpdc[0] + self.p12_ro_pump_fb_duty_cycle = rpfbdc[0] + self.p12_ro_pump_speed = rprpm[0] + self.p40_boost_pump_state = bps[0] + self.p40_boost_pump_duty_cycle = bpdc[0] + self.p40_boost_pump_fb_duty_cycle = bpfbdc[0] + self.p40_boost_pump_speed = bprpm[0] @@ -127,7 +127,6 @@ # If there is content... if received_message is not None: - # self.logger.debug(received_message) if reset == RESET: str_res = "reset back to normal" else: @@ -160,15 +159,15 @@ message_id=MsgIds.MSG_ID_RO_BOOST_PUMP_SET_PWM_REQUEST.value, payload=payload) - self.logger.debug("override measured boost pump speed") + self.logger.debug("setting pump {} to pwm count {}".format(pump,pwm)) # Send message received_message = self.can_interface.send(message) # If there is content... if received_message is not None: - self.logger.debug("pwm overridden to " + str(pwm)) + self.logger.debug("pwm set to " + str(pwm)) # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: @@ -177,7 +176,7 @@ def cmd_boost_pump_read_pwm_override(self, pump: int, pwm: float, reset: int = NO_RESET) -> int: """ - Constructs and sends the read pwm override \n + Constructs and sends the read pwm override for the RO pumps \n command. Constraints: Must be logged into RO. @@ -196,14 +195,13 @@ message_id=MsgIds.MSG_ID_RO_BOOST_PUMP_READ_PWM_OVERRIDE_REQUEST.value, payload=payload) - self.logger.debug("override measured blood pump rotor speed") + self.logger.debug("override read pwm for pump".format(pump)) # Send message received_message = self.can_interface.send(message) # If there is content... if received_message is not None: - # self.logger.debug(received_message) if reset == RESET: str_res = "reset back to normal" else: @@ -218,7 +216,7 @@ def cmd_boost_pump_broadcast_interval_override(self, ms: int, reset: int = NO_RESET) -> int: """ - Constructs and sends the measured blood flow broadcast interval override command + Constructs and sends the RO pump broadcast interval override command Constraints: Must be logged into RO. Given interval must be non-zero and a multiple of the RO general task interval (50 ms). @@ -239,7 +237,7 @@ message_id=MsgIds.MSG_ID_RO_BOOST_PUMPS_PUBLISH_INTERVAL_OVERRIDE_REQUEST.value, payload=payload) - self.logger.debug("override boost pump broadcast interval") + self.logger.debug("override RO pump broadcast interval") # Send message received_message = self.can_interface.send(message)