Index: leahi_dialin/td/modules/events.py =================================================================== diff -u -r54763223059d1f2d862f6443e0f98a851fdf9f85 -r20c821bd230fc7689a0275a2918981669ff5cc19 --- leahi_dialin/td/modules/events.py (.../events.py) (revision 54763223059d1f2d862f6443e0f98a851fdf9f85) +++ leahi_dialin/td/modules/events.py (.../events.py) (revision 20c821bd230fc7689a0275a2918981669ff5cc19) @@ -19,7 +19,7 @@ from datetime import datetime from time import time -from leahi_dialin.common.td_defs import td_enum_repository +from leahi_dialin.common import td_enum_repository from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions from leahi_dialin.protocols.CAN import DenaliChannels from leahi_dialin.utils.base import AbstractSubSystem, publish @@ -38,10 +38,6 @@ super().__init__() self.can_interface = can_interface self.logger = logger - self.td_events_timestamp = 0.0 - self.td_event_op_mode = 0 - self.td_event_sub_mode = 0 - self.td_event_op_mode_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.td_sync_broadcast_ch_id @@ -53,9 +49,10 @@ self.can_interface.register_receiving_publication_function(channel_id, self.msg_id_td_op_mode_data, self._handler_td_op_mode_sync) - # Define the dictionaries - self._td_event_dictionary = dict() - self._td_event_data_type = dict() + self.td_events_timestamp = 0.0 #: The timestamp of the last Event message + self.td_event_op_mode = 0 #: The new Operation Mode value + self.td_event_sub_mode = 0 #: The new Operation Sub-Mode value + self.td_event_op_mode_timestamp = 0.0 #: The timestamp of the last Operation Mode change message # Dictionary of the mode as key and the sub mode states enum class as the value self._td_op_mode_2_sub_mode = {td_enum_repository.TDOpModes.MODE_FAUL.name: td_enum_repository.TDFaultStates, @@ -67,6 +64,10 @@ td_enum_repository.TDOpModes.MODE_POST.name: td_enum_repository.TDPostTreatmentStates, td_enum_repository.TDOpModes.MODE_NLEG.name: td_enum_repository.TDNotLegalStates} + # Define the dictionaries + self._td_event_dictionary = dict() + self._td_event_data_type = dict() + # Loop through the list of the TD events enums and initial the event dictionary. Each event is a key in the # dictionary and the value is a list. for event in td_enum_repository.TDEventList: