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)