Index: dialin/dg/events.py =================================================================== diff -u -re3ad27490f27a84efa4d2a79ce730165ccdfd2e2 -rff9ca2cc07737e0bae9d05d97a88838de5863f3e --- dialin/dg/events.py (.../events.py) (revision e3ad27490f27a84efa4d2a79ce730165ccdfd2e2) +++ dialin/dg/events.py (.../events.py) (revision ff9ca2cc07737e0bae9d05d97a88838de5863f3e) @@ -28,6 +28,7 @@ msg_id = MsgIds.MSG_ID_DG_EVENT.value self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_events_sync) + self._signal_new_op_mode_data = False # Define the dictionaries self._dg_event_dictionary = dict() self._dg_event_data_type = dict() @@ -113,7 +114,7 @@ """ Handles published events message - @param message: published DG events data message + @param message: published DG events data message @returns none """ event_id = struct.unpack('i', bytearray( @@ -142,8 +143,11 @@ if event_state_name == DGEventList.DG_EVENT_OP_MODE_CHANGE.name: event_data_1 = DGOpModes(event_data_1).name event_data_2 = DGOpModes(event_data_2).name + self._signal_new_op_mode_data = True # Check if the event state name is sub mode change. elif event_state_name == DGEventList.DG_EVENT_SUB_MODE_CHANGE.name: + self._signal_new_op_mode_data = False + # Get the length of the list of the sub mode list event_list_len = len(self._dg_event_dictionary[DGEventList.DG_EVENT_OP_MODE_CHANGE.name]) # Get the last tuple of the sub mode @@ -166,7 +170,8 @@ # i.e. last = (timestamp, event type, prev, current) and one before = (timestamp, event type, prev, current) # If the prev and current match respectively, it means the current operation mode has not changed so the # operation mode states can be converted from the current sub mode enum class - if last_current == prev_current and last_previous == prev_previous: + #if last_current == prev_current and last_previous == prev_previous: + if self._signal_new_op_mode_data is False: event_data_1 = current_sub_mode_enum_class(event_data_1).name event_data_2 = current_sub_mode_enum_class(event_data_2).name Index: tests/dg_heat_and_chemical_disinfect_test.py =================================================================== diff -u -rad9f74cb039beea1bea1f8eb744870acd28650b4 -rff9ca2cc07737e0bae9d05d97a88838de5863f3e --- tests/dg_heat_and_chemical_disinfect_test.py (.../dg_heat_and_chemical_disinfect_test.py) (revision ad9f74cb039beea1bea1f8eb744870acd28650b4) +++ tests/dg_heat_and_chemical_disinfect_test.py (.../dg_heat_and_chemical_disinfect_test.py) (revision ff9ca2cc07737e0bae9d05d97a88838de5863f3e) @@ -427,7 +427,7 @@ try: while True: - hd_run = get_dg_run_info() + hd_run = get_hd_run_info() dg_run = get_dg_run_info() drain = get_drain_states_info() load_cell = get_load_cells_info() @@ -437,7 +437,8 @@ heaters = get_heaters_info() dg_fans = get_dg_fans_info() - var = str(datetime.now) + hd_run + dg_run + load_cell + drain + ro + temp + heaters + dg_fans + valves + '\r' + var = str(datetime.now()) + ', ' + hd_run + dg_run + load_cell + drain + ro + temp + heaters + dg_fans + \ + valves + '\r' print(var) f.write(var)