Index: dialin/common/msg_defs.py =================================================================== diff -u -r79b47911f0ea424cd8dc10c1e1f150b84d4dfa54 -r7d528c2109af39ed65e9dd3d61162de89ad22d96 --- dialin/common/msg_defs.py (.../msg_defs.py) (revision 79b47911f0ea424cd8dc10c1e1f150b84d4dfa54) +++ dialin/common/msg_defs.py (.../msg_defs.py) (revision 7d528c2109af39ed65e9dd3d61162de89ad22d96) @@ -58,6 +58,7 @@ REQUEST_REJECT_REASON_SALINE_BOLUS_NOT_IN_PROGRESS = 22 NUM_OF_REQUEST_REJECT_REASONS = 23 + class MsgFieldPositions: # Generic response msg field byte positions (where 32-bit data fields are used) START_POS_FIELD_1 = 6 # Hardcoded for now to avoid cyclic import issue. See protocols.CAN.DenaliMessage class Index: dialin/common/msg_ids.py =================================================================== diff -u -r3bf31442dfb7d31dac639a2c28e43055a354b236 -r7d528c2109af39ed65e9dd3d61162de89ad22d96 --- dialin/common/msg_ids.py (.../msg_ids.py) (revision 3bf31442dfb7d31dac639a2c28e43055a354b236) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision 7d528c2109af39ed65e9dd3d61162de89ad22d96) @@ -289,4 +289,3 @@ MSG_ID_HD_DEBUG_EVENT = 0XFFF1 MSG_ID_DG_DEBUG_EVENT = 0XFFF2 MSG_ID_ACK_MESSAGE_THAT_REQUIRES_ACK = 0XFFFF - #TODO complete as needed \ No newline at end of file Index: dialin/dg/flush.py =================================================================== diff -u -r3bf31442dfb7d31dac639a2c28e43055a354b236 -r7d528c2109af39ed65e9dd3d61162de89ad22d96 --- dialin/dg/flush.py (.../flush.py) (revision 3bf31442dfb7d31dac639a2c28e43055a354b236) +++ dialin/dg/flush.py (.../flush.py) (revision 7d528c2109af39ed65e9dd3d61162de89ad22d96) @@ -18,7 +18,7 @@ DG_FLUSH_STATE_FLUSH_CONCENTRATE_STRAWS = 5 DG_FLUSH_STATE_FLUSH_R1_TO_R2 = 6 DG_FLUSH_STATE_FLUSH_R2_AND_DRAIN_R1 = 7 - DG_FLUSH_STATE_FLUSH_DRAIN_LINE = 8 + DG_FLUSH_STATE_FLUSH_CIRCULATION_DRAIN_LINE = 8 DG_FLUSH_STATE_FLUSH_CIRCULATION = 9 DG_FLUSH_STATE_FLUSH_WITH_FRESH_WATER = 10 DG_FLUSH_STATE_CANCEL_BASIC_PATH = 11 @@ -42,7 +42,7 @@ self.flush_state = 0 self.overall_elapsed_time = 0 self.state_elapsed_time = 0 - self.flush_drain_line_volume = 0.0 + self.flush_drain_line_volume_l = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -63,11 +63,11 @@ message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] state_elapsed_time = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] - drain_line_volume = struct.unpack('i', bytearray( + drain_line_volume = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4]))[0] self.flush_state = FlushStates(state).name self.overall_elapsed_time = int(elapsed_time / 1000) self.state_elapsed_time = int(state_elapsed_time / 1000) - self.flush_drain_line_volume = drain_line_volume + self.flush_drain_line_volume_l = drain_line_volume Index: dialin/dg/hd_proxy.py =================================================================== diff -u -r4c697fe5369d52d81d550a06c820c412d0377a17 -r7d528c2109af39ed65e9dd3d61162de89ad22d96 --- dialin/dg/hd_proxy.py (.../hd_proxy.py) (revision 4c697fe5369d52d81d550a06c820c412d0377a17) +++ dialin/dg/hd_proxy.py (.../hd_proxy.py) (revision 7d528c2109af39ed65e9dd3d61162de89ad22d96) @@ -74,7 +74,7 @@ self.logger.debug("Timeout!!!!") return False - def cmd_fill(self, volume=1500, start=1): + def cmd_fill(self, volume:int=1500, start:int=1) -> int: """ Constructs and sends the fill command. Constraints: @@ -105,7 +105,7 @@ self.logger.debug("Timeout!!!!") return False - def cmd_drain(self, volume=200, tareLoadCell=False): + def cmd_drain(self, volume:int=200, tareLoadCell:bool=False) -> int: """ Constructs and sends the drain command. Constraints: @@ -138,7 +138,7 @@ self.logger.debug("Timeout!!!!") return False - def cmd_start_stop_dg(self, start=True): + def cmd_start_stop_dg(self, start:bool=True) -> int: """ Constructs and sends the start/stop DG command Constraints: @@ -174,7 +174,7 @@ self.logger.debug("Timeout!!!!") return False - def cmd_start_stop_trimmer_heater(self, start=True): + def cmd_start_stop_trimmer_heater(self, start:bool=True) -> int: """ Constructs and sends the start/stop DG trimmer heater command @@ -221,7 +221,7 @@ self.logger.debug("Stopping heat disinfection process") self.can_interface.send(message, 0) - def cmd_sample_water(self, cmd): + def cmd_sample_water(self, cmd:int) -> None: """ Constructs and sends sample water command @@ -235,7 +235,7 @@ self.logger.debug("Sending sample water command") self.can_interface.send(message, 0) - def cmd_start_stop_heat_disinfect(self, start=True): + def cmd_start_stop_heat_disinfect(self, start:bool=True) -> int: """ Constructs and sends the start/stop DG heat disinfect command @@ -266,7 +266,7 @@ self.logger.debug("Timeout!!!!") return False - def cmd_start_stop_dg_flush(self, start=True): + def cmd_start_stop_dg_flush(self, start:bool=True) -> int: """ Constructs and sends the start/stop DG flush command Index: tests/test_flush.py =================================================================== diff -u -r3bf31442dfb7d31dac639a2c28e43055a354b236 -r7d528c2109af39ed65e9dd3d61162de89ad22d96 --- tests/test_flush.py (.../test_flush.py) (revision 3bf31442dfb7d31dac639a2c28e43055a354b236) +++ tests/test_flush.py (.../test_flush.py) (revision 7d528c2109af39ed65e9dd3d61162de89ad22d96) @@ -8,8 +8,9 @@ def get_flush_mode_info(): - info = ('State, {}, Overall_elapsed_time, {}, State_elapsed_time, {}, ' - .format(dg.flush.flush_state, dg.flush.overall_elapsed_time, dg.flush.state_elapsed_time)) + info = ('State, {}, Overall_elapsed_time, {}, State_elapsed_time, {}, Drain_vol, {:5.3f}, ' + .format(dg.flush.flush_state, dg.flush.overall_elapsed_time, dg.flush.state_elapsed_time, + dg.flush.flush_drain_line_volume)) return info @@ -81,12 +82,14 @@ # If it is the first call, stop heat disinfect if complete_counter == 1: dg.hd_proxy.cmd_start_stop_dg_flush(start=False) - pass + # Write a few more complete states to make sure the complete state items are recorded elif complete_counter == 3: f.close() break + complete_counter += 1 + except KeyboardInterrupt: dg.hd_proxy.cmd_start_stop_dg_flush(start=False) f.close()