Index: dialin/dg/events.py =================================================================== diff -u -rd155e227e226d875054c35dd83eb612158c8fd7e -re979b3b8161d4232a93fd7c995e1aaeb690c1c6c --- dialin/dg/events.py (.../events.py) (revision d155e227e226d875054c35dd83eb612158c8fd7e) +++ dialin/dg/events.py (.../events.py) (revision e979b3b8161d4232a93fd7c995e1aaeb690c1c6c) @@ -138,7 +138,7 @@ # Convert the event ID to enum event_state_name = DGEventList(event_id).name - #print(event_data_1, event_data_2) + #print(event_state_name, event_data_1, event_data_2) # Check if the event state name is operation mode change. If it is, get the name of the operation modes # from the op modes enum class @@ -183,18 +183,17 @@ event_data_2 = current_sub_mode_enum_class(event_data_2).name elif current_op_mode_timestamp > current_sub_mode_timestamp: - # If the previous and current of the last two tuples do not match, then an operation modes transition - # has occurred and and the previous state is converted from the previous class and the current op mode + # If the previous and current of the last two tuples do not match, then an operation mode transition + # has occurred and the previous state is converted from the previous class and the current op mode # is converted from current operation states enum class. # i.e last = (timestamp, event type, 3, 8) and one before = (timestamp, event type, 8, 3) # previous and current do not match so in the last type (timestamp, event type, 8, 3) the prev state # should be from op mode 8 and the current state should be from op mode 3 - previous_sub_mode = current_sub_tuple[len(current_sub_tuple) - 2] - previous_sub_mode_enum_class = self._dg_op_mode_2_sub_mode[previous_sub_mode] + previous_op_mode = last_op_tuple[len(last_op_tuple) - 2] + previous_sub_mode_enum_class = self._dg_op_mode_2_sub_mode[previous_op_mode] event_data_1 = previous_sub_mode_enum_class(event_data_1).name event_data_2 = current_sub_mode_enum_class(event_data_2).name else: - #print(event_data_1, event_data_2) if event_data_2 != 0: event_data_1 = current_sub_mode_enum_class(event_data_1).name @@ -210,3 +209,6 @@ # Update event dictionary self._dg_event_dictionary[event_state_name].append(event_tuple) + + +# What is wrong with the events in develop? Index: dialin/dg/hd_proxy.py =================================================================== diff -u -ra901fe931c08daea69337c1f44135637a764ce7a -re979b3b8161d4232a93fd7c995e1aaeb690c1c6c --- dialin/dg/hd_proxy.py (.../hd_proxy.py) (revision a901fe931c08daea69337c1f44135637a764ce7a) +++ dialin/dg/hd_proxy.py (.../hd_proxy.py) (revision e979b3b8161d4232a93fd7c995e1aaeb690c1c6c) @@ -105,21 +105,23 @@ self.logger.debug("Timeout!!!!") return False - def cmd_drain(self, volume: int = 0, tare_load_cell: bool = False) -> int: + def cmd_drain(self, volume: int = 0, tare_load_cell: bool = False, rinse_concentrate_lines: bool = False ) -> int: """ Constructs and sends the drain command. Constraints: DG must be in re-circulate mode. Given drain to volume must be between 0 and 1950 mL. @param volume: unsigned int - volume (in mL) to drain the inactive reservoir to. - @param tare_load_cell: bool - flag indicates to tare loadcell. + @param tare_load_cell: bool - flag indicates to tare load cell. + @param rinse_concentrate_lines: bool - flag indicates to whether rinse the concentrate lines or not @return: 1 if successful, zero otherwise """ vol = integer_to_bytearray(volume) tare = integer_to_bytearray(tare_load_cell) - payload = vol + tare + rinse = integer_to_bytearray(rinse_concentrate_lines) + payload = vol + tare + rinse message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_DRAIN_CMD.value, Index: tests/dg_heat_and_chemical_disinfect_test.py =================================================================== diff -u -rff9ca2cc07737e0bae9d05d97a88838de5863f3e -re979b3b8161d4232a93fd7c995e1aaeb690c1c6c --- tests/dg_heat_and_chemical_disinfect_test.py (.../dg_heat_and_chemical_disinfect_test.py) (revision ff9ca2cc07737e0bae9d05d97a88838de5863f3e) +++ tests/dg_heat_and_chemical_disinfect_test.py (.../dg_heat_and_chemical_disinfect_test.py) (revision e979b3b8161d4232a93fd7c995e1aaeb690c1c6c) @@ -549,18 +549,18 @@ hd.cmd_log_in_to_hd() sleep(1) - # run_heat_disinfect() + #run_heat_disinfect() # run_chemical_disinfect() - # run_dg() + run_dg() # run_ro_pump_duty_cycles() # cmd_set_disinfect_ui_screen() # cmd_test_heaters() - collect_treatment_data() + #collect_treatment_data() Index: tests/test_flush.py =================================================================== diff -u -rd430e49fa1d7a0f4ff1dfe24733fecded6d5ee70 -re979b3b8161d4232a93fd7c995e1aaeb690c1c6c --- tests/test_flush.py (.../test_flush.py) (revision d430e49fa1d7a0f4ff1dfe24733fecded6d5ee70) +++ tests/test_flush.py (.../test_flush.py) (revision e979b3b8161d4232a93fd7c995e1aaeb690c1c6c) @@ -106,7 +106,7 @@ f = open("/home/fw/projects/dialin/tests/flush_mode.log", "w") #dg.hd_proxy.cmd_start_stop_dg_flush() dg.cmd_dg_software_reset_request() - #sleep(0.1) + try: while True: flush = get_flush_mode_info() @@ -125,17 +125,25 @@ # If the mode came back to standby or standby solo if dg.dg_operation_mode == 3 or dg.dg_operation_mode == 4: - dg.hd_proxy.cmd_start_stop_dg_flush() + + if complete_counter == 1: + dg.hd_proxy.cmd_start_stop_dg_flush() # Write a few more complete states to make sure the complete state items are recorded - #if complete_counter == 3: - # f.close() - # break + if complete_counter == 3: + f.close() + events = dg.events.get_dg_events(2, 60) + for event in events: + print(event) + break complete_counter += 1 except KeyboardInterrupt: dg.hd_proxy.cmd_start_stop_dg_flush(start=False) f.close() + events = dg.events.get_dg_events(2, 50) + for event in events: + print(event) if __name__ == "__main__":