Index: leahi_dialin/fp/modules/events.py =================================================================== diff -u -rc5bfcf84ed942ca5841bf9de155aa0f495b4d28d -r20c821bd230fc7689a0275a2918981669ff5cc19 --- leahi_dialin/fp/modules/events.py (.../events.py) (revision c5bfcf84ed942ca5841bf9de155aa0f495b4d28d) +++ leahi_dialin/fp/modules/events.py (.../events.py) (revision 20c821bd230fc7689a0275a2918981669ff5cc19) @@ -19,7 +19,7 @@ from datetime import datetime from time import time -from leahi_dialin.common.fp_defs import fp_enum_repository +from leahi_dialin.common import fp_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 @@ -39,10 +39,6 @@ super().__init__() self.can_interface = can_interface self.logger = logger - self.fp_events_timestamp = 0.0 - self.fp_event_op_mode = 0 - self.fp_event_sub_mode = 0 - self.fp_event_op_mode_timestamp = 0.0 if self.can_interface is not None: channel_id = DenaliChannels.fp_sync_broadcast_ch_id @@ -54,9 +50,10 @@ self.can_interface.register_receiving_publication_function(channel_id, self.msg_id_fp_op_mode_data, self._handler_fp_op_mode_sync) - # Define the dictionaries - self._fp_event_dictionary = dict() - self._fp_event_data_type = dict() + self.fp_events_timestamp = 0.0 #: The timestamp of the last Event message + self.fp_event_op_mode = 0 #: The new Operation Mode value + self.fp_event_sub_mode = 0 #: The new Operation Sub-Mode value + self.fp_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._fp_op_mode_2_sub_mode = {fp_enum_repository.FPOpModes.MODE_FAUL.name: fp_enum_repository.FPFaultStates, @@ -69,6 +66,10 @@ fp_enum_repository.FPOpModes.MODE_DEGP.name: fp_enum_repository.FPGenPermeateDefStates, fp_enum_repository.FPOpModes.MODE_NLEG.name: fp_enum_repository.FPNotLegalStates} + # Define the dictionaries + self._fp_event_dictionary = dict() + self._fp_event_data_type = dict() + # Loop through the list of the FP events enums and initial the event dictionary. Each event is a key in the # dictionary and the value is a list. for event in fp_enum_repository.FPEventList: