Index: leahi_dialin/fp/filtration_purification.py =================================================================== diff -u -r9bfb4b489a4608541017c05660e111d8ef6b8b5f -rbd5420b3540747a01b3d4d6dd40146eab527e0d1 --- leahi_dialin/fp/filtration_purification.py (.../filtration_purification.py) (revision 9bfb4b489a4608541017c05660e111d8ef6b8b5f) +++ leahi_dialin/fp/filtration_purification.py (.../filtration_purification.py) (revision bd5420b3540747a01b3d4d6dd40146eab527e0d1) @@ -95,14 +95,13 @@ self._handler_fp_defeatured_response) # create properties - self.fp_defeaturized = False + self.fp_defeatured = False self.fp_defeatured_timestamp = 0.0 self.fp_op_mode_timestamp = 0.0 self.fp_debug_events_timestamp = 0.0 self.fp_version_response_timestamp = 0.0 self.fp_operation_mode = fp_enum_repository.FPOpModes.MODE_INIT.value self.fp_operation_sub_mode = 0 - self.fp_defeatured = None self.fp_logged_in = False self.fp_set_logged_in_status(False) self.fp_version = None @@ -224,7 +223,7 @@ self.fp_op_mode_timestamp = timestamp - @publish(["msg_id_fp_def_status_response", "is_fp_defeatured"]) + @publish(["msg_id_fp_def_status_response", "fp_defeatured"]) def _handler_fp_defeatured_response(self, message, timestamp = 0.0): """ Handler for response from FP regarding its defeatured status. Index: leahi_dialin/fp/proxies/dd_proxy.py =================================================================== diff -u -ra291930ba38e329e2b373f6d2b2a7564a6b7a09a -rbd5420b3540747a01b3d4d6dd40146eab527e0d1 --- leahi_dialin/fp/proxies/dd_proxy.py (.../dd_proxy.py) (revision a291930ba38e329e2b373f6d2b2a7564a6b7a09a) +++ leahi_dialin/fp/proxies/dd_proxy.py (.../dd_proxy.py) (revision bd5420b3540747a01b3d4d6dd40146eab527e0d1) @@ -17,6 +17,8 @@ from logging import Logger from leahi_dialin.common.msg_defs import MsgIds +from leahi_dialin.common.fp_defs import fp_enum_repository +from leahi_dialin.common.test_config_defs import DDFPTestConfigOptions from leahi_dialin.protocols.CAN import DenaliMessage, DenaliCanMessenger, DenaliChannels from leahi_dialin.utils.base import AbstractSubSystem from leahi_dialin.utils.conversions import integer_to_bytearray, float_to_bytearray @@ -27,13 +29,14 @@ Filtration Purification (FP) Dialin API sub-class for DD proxy ( injection ) related commands. """ - def __init__(self, can_interface: DenaliCanMessenger, logger: Logger): + def __init__(self, can_interface: DenaliCanMessenger, logger: Logger, fp): """ ROProxy constructor @param can_interface: the Denali CAN interface object """ super().__init__() + self._fp = fp self.can_interface = can_interface self.logger = logger @@ -60,3 +63,44 @@ self.logger.debug("Sending DD start stop request to FP.") self.can_interface.send(message, 0) + + + def cmd_dd_send_fp_to_pre_gen(self) -> int: + """ + Constructs and sends a set operation mode request command via internal CAN bus. + Constraints: + Must be logged into FP. + Transition from current to requested op mode must be legal. + NOTE: for POST the FP device shall be in Standby Mode + + @param op_mode: ID of operation mode to transition to + + @return: 1 if successful, zero otherwise + """ + + if not self._fp.fp_defeatured: + self._fp.cmd_fp_set_operation_mode(4) + else: + self._fp.cmd_fp_set_operation_mode(6) + + + def cmd_dd_send_fp_to_gen_permeate(self) -> int: + """ + Constructs and sends a set operation mode request command via internal CAN bus. + Constraints: + Must be logged into FP. + Transition from current to requested op mode must be legal. + NOTE: for POST the FP device shall be in Standby Mode + + @param op_mode: ID of operation mode to transition to + + @return: 1 if successful, zero otherwise + """ + + # Disable flush + self._fp.test_configs.cmd_set_test_config(DDFPTestConfigOptions.TEST_CONFIG_FP_SKIP_PRE_GEN_FLUSH.value, 1) + + if not self._fp.fp_defeatured: + self._fp.cmd_fp_set_operation_mode(5) + else: + self._fp.cmd_fp_set_operation_mode(7)