Index: leahi_dialin/dd/modules/dd_test_configs.py =================================================================== diff -u -r20c821bd230fc7689a0275a2918981669ff5cc19 -re45b20cdc5d4c5dcff8cef530b173ca94cb2e422 --- leahi_dialin/dd/modules/dd_test_configs.py (.../dd_test_configs.py) (revision 20c821bd230fc7689a0275a2918981669ff5cc19) +++ leahi_dialin/dd/modules/dd_test_configs.py (.../dd_test_configs.py) (revision e45b20cdc5d4c5dcff8cef530b173ca94cb2e422) @@ -8,43 +8,45 @@ # @file dd_test_configs.py # # @author (last) Zoltan Miskolci -# @date (last) 07-Jan-2026 +# @date (last) 04-May-2026 # @author (original) Jonny Paguio # @date (original) 20-Aug-2025 # ############################################################################ +# Module imports from logging import Logger +# Project imports from leahi_dialin.common.constants import NO_RESET -from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions +from leahi_dialin.common.msg_defs import MsgFieldPositions +from leahi_dialin.common.msg_ids import MsgIds from leahi_dialin.common.override_templates import cmd_generic_override from leahi_dialin.common.test_config_defs import DDFPTestConfigOptions -from leahi_dialin.protocols.CAN import DenaliChannels -from leahi_dialin.utils.base import AbstractSubSystem, publish +from leahi_dialin.protocols.CAN import CanMessenger, CanChannels +from leahi_dialin.utils.abstract_classes import AbstractSubSystem +from leahi_dialin.utils.base import publish from leahi_dialin.utils.conversions import integer_to_bytearray, bytearray_to_integer - class DDTestConfig(AbstractSubSystem): """ Dialysate Delivery (DD) Dialin API sub-class for setting and getting the test configurations. """ - def __init__(self, can_interface, logger: Logger): + def __init__(self, can_interface: CanMessenger, logger: Logger): """ - @param can_interface: Denali CAN Messenger object + @param can_interface: Can Messenger object """ super().__init__() self.can_interface = can_interface self.logger = logger if self.can_interface is not None: - channel_id = DenaliChannels.dd_to_dialin_ch_id - self.msg_id_dd_send_test_config = MsgIds.MSG_ID_DD_SEND_TEST_CONFIGURATION.value - self.can_interface.register_receiving_publication_function(channel_id, self.msg_id_dd_send_test_config, - self._handler_dd_test_config_sync) + self.can_interface.register_receiving_publication_function(channel_id = CanChannels.dd_to_dialin_ch_id, + message_id = MsgIds.MSG_ID_DD_SEND_TEST_CONFIGURATION.value, + function = self._handler_dd_test_config_sync) self.dd_test_configs_response_timestamp = 0.0 #: The timestamp of the latest message self.dd_test_configs = dict() #: The Test Config data in dictionary format @@ -90,14 +92,20 @@ @param reset: (int) 1 to reset a previous override, 0 to override @return: 1 if successful, zero otherwise """ + if reset == NO_RESET and \ + config in [DDFPTestConfigOptions.TEST_CONFIG_FP_ENABLE_DEFEATURE, DDFPTestConfigOptions.TEST_CONFIG_FP_ENABLE_BOOST_PUMP] and \ + (self.dd_test_configs[DDFPTestConfigOptions.TEST_CONFIG_FP_ENABLE_DEFEATURE] == 1 or self.dd_test_configs[DDFPTestConfigOptions.TEST_CONFIG_FP_ENABLE_BOOST_PUMP] == 1): + self.logger.info('Boost pump and defeatured test configs are mutually exclusive, can\'t activate them while on of them is active') + return 0 + reset_value = integer_to_bytearray(reset) c = integer_to_bytearray(config) payload = reset_value + c response = cmd_generic_override( payload = payload, reset = reset, - channel_id = DenaliChannels.dialin_to_dd_ch_id, + channel_id = CanChannels.dialin_to_dd_ch_id, msg_id = MsgIds.MSG_ID_DD_SET_TEST_CONFIGURATION, entity_name = f'DD {DDFPTestConfigOptions(config).name} Test Config', override_text = 'Active', @@ -120,7 +128,7 @@ return cmd_generic_override( payload = None, reset = NO_RESET, - channel_id = DenaliChannels.dialin_to_dd_ch_id, + channel_id = CanChannels.dialin_to_dd_ch_id, msg_id = MsgIds.MSG_ID_DD_GET_TEST_CONFIGURATION, entity_name = f'Get DD Test Configuration Record', override_text = 'Active', @@ -139,7 +147,7 @@ response = cmd_generic_override( payload = None, reset = NO_RESET, - channel_id = DenaliChannels.dialin_to_dd_ch_id, + channel_id = CanChannels.dialin_to_dd_ch_id, msg_id = MsgIds.MSG_ID_DD_RESET_ALL_TEST_CONFIGURATIONS, entity_name = f'Reset all DD & FP Test Configurations', override_text = 'Active',