Index: leahi_dialin/dd/modules/events.py =================================================================== diff -u -rc5bfcf84ed942ca5841bf9de155aa0f495b4d28d -r20c821bd230fc7689a0275a2918981669ff5cc19 --- leahi_dialin/dd/modules/events.py (.../events.py) (revision c5bfcf84ed942ca5841bf9de155aa0f495b4d28d) +++ leahi_dialin/dd/modules/events.py (.../events.py) (revision 20c821bd230fc7689a0275a2918981669ff5cc19) @@ -19,7 +19,7 @@ from datetime import datetime from time import time -from leahi_dialin.common.dd_defs import dd_enum_repository +from leahi_dialin.common import dd_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 @@ -41,10 +41,6 @@ super().__init__() self.can_interface = can_interface self.logger = logger - self.dd_events_timestamp = 0.0 - self.dd_event_op_mode = 0 - self.dd_event_sub_mode = 0 - self.dd_event_op_mode_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.dd_sync_broadcast_ch_id @@ -56,9 +52,10 @@ self.can_interface.register_receiving_publication_function(channel_id, self.msg_id_dd_op_mode_data, self._handler_dd_op_mode_sync) - # Define the dictionaries - self._dd_event_dictionary = dict() - self._dd_event_data_type = dict() + self.dd_events_timestamp = 0.0 #: The timestamp of the last Event message + self.dd_event_op_mode = 0 #: The new Operation Mode value + self.dd_event_sub_mode = 0 #: The new Operation Sub-Mode value + self.dd_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._dd_op_mode_2_sub_mode = {dd_enum_repository.DDOpModes.MODE_FAUL.name: dd_enum_repository.DDFaultStates, @@ -73,6 +70,10 @@ dd_enum_repository.DDOpModes.MODE_ROPS.name: dd_enum_repository.DDROPermeateStates, dd_enum_repository.DDOpModes.MODE_NLEG.name: dd_enum_repository.DDNotLegalStates} + # Define the dictionaries + self._dd_event_dictionary = dict() + self._dd_event_data_type = dict() + # Loop through the list of the DD events enums and initial the event dictionary. Each event is a key in the # dictionary and the value is a list. for event in dd_enum_repository.DDEventList: