Index: leahi_dialin/fp/modules/fp_test_configs.py =================================================================== diff -u -rec8a2600b9e8cf6fe7e02c200a1c24221ca86863 -r894abd4d8e62d20ba65ca78e443ffb5ea00c07ea --- leahi_dialin/fp/modules/fp_test_configs.py (.../fp_test_configs.py) (revision ec8a2600b9e8cf6fe7e02c200a1c24221ca86863) +++ leahi_dialin/fp/modules/fp_test_configs.py (.../fp_test_configs.py) (revision 894abd4d8e62d20ba65ca78e443ffb5ea00c07ea) @@ -16,8 +16,10 @@ from logging import Logger +from leahi_dialin.common.constants import NO_RESET +from leahi_dialin.common.global_vars import GlobalVariables from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions -from leahi_dialin.common.test_config_defs import FPTestConfigOptions +from leahi_dialin.common.test_config_defs import DDFPTestConfigOptions from leahi_dialin.protocols.CAN import DenaliMessage, DenaliChannels from .constants import NO_RESET from leahi_dialin.utils.conversions import integer_to_bytearray, bytearray_to_integer @@ -57,9 +59,30 @@ @param config: (int) Test config to set @return: the status of a test config """ - return self.fp_test_configs[FPTestConfigOptions(config).name] + return self.fp_test_configs[DDFPTestConfigOptions(config).name] + @publish(['msg_id_fp_send_test_config', 'fp_test_configs', 'fp_test_configs_response_timestamp']) + def _handler_fp_test_config_sync(self, message, timestamp=0.0): + """ + Handles published test configuration status messages. + + @param message: published FP test configurations message + @return: None + """ + payload = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + + for config in DDFPTestConfigOptions.__members__: + config_value, index = bytearray_to_integer(payload, index, False) + if 'NUM_OF_TEST_CONFIGS' not in config: + self.fp_test_configs[config] = config_value + if DDFPTestConfigOptions.TEST_CONFIG_ENABLE_BETA_1_9_HW.name in config: + GlobalVariables().NEXT_GEN_HW = config_value == 1 + + self.fp_test_configs_response_timestamp = timestamp + + def cmd_set_test_config(self, config: int, reset: int = NO_RESET): """ Constructs and sends the FP test config @@ -79,9 +102,9 @@ payload=payload) if reset == NO_RESET: - self.logger.debug("Setting {}".format(FPTestConfigOptions(config).name)) + self.logger.debug("Setting {}".format(DDFPTestConfigOptions(config).name)) else: - self.logger.debug("Resetting {}".format(FPTestConfigOptions(config).name)) + self.logger.debug("Resetting {}".format(DDFPTestConfigOptions(config).name)) # Send message received_message = self.can_interface.send(message) @@ -146,31 +169,13 @@ self.logger.debug("Timeout!!!!") return False - @publish(['msg_id_fp_send_test_config', 'fp_test_configs', 'fp_test_configs_response_timestamp']) - def _handler_fp_test_config_sync(self, message, timestamp=0.0): - """ - Handles published test configuration status messages. - - @param message: published FP test configurations message - @return: None - """ - payload = message['message'] - index = MsgFieldPositions.START_POS_FIELD_1 - - for config in FPTestConfigOptions.__members__: - if 'NUM_OF_TEST_CONFIGS' not in config: - config_value, index = bytearray_to_integer(payload, index, False) - self.fp_test_configs[config] = config_value - - self.fp_test_configs_response_timestamp = timestamp - def _reset_test_configs_record(self): """ Resets the test configuration dictionary @return: None """ - for config in FPTestConfigOptions.__members__: + for config in DDFPTestConfigOptions.__members__: # Loop through the list of the test configuration and set the values to 0xFFFFFFFF if 'NUM_OF_TEST_CONFIGS' not in config: - self.fp_test_configs[config] = 0xFFFFFFFF \ No newline at end of file + self.fp_test_configs[config] = 0xFFFFFFFF