Index: dialin/common/msg_ids.py =================================================================== diff -u -r8ac75cccb937866cb13c49a97e91bb9e1060a9d8 -r1b04b37b3a327b145b150477f567e26a26c60e4e --- dialin/common/msg_ids.py (.../msg_ids.py) (revision 8ac75cccb937866cb13c49a97e91bb9e1060a9d8) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision 1b04b37b3a327b145b150477f567e26a26c60e4e) @@ -485,6 +485,7 @@ MSG_ID_DG_SET_LOAD_CELLS_TARE_VALUES = 0xA06C MSG_ID_DG_SEND_LOAD_CELLS_TARE_VALUES_TO_DIALIN = 0xA06D MSG_ID_DG_SET_COND_SENSOR_CAL_TABLE = 0xA06E + MSG_ID_DG_SIGNAL_RECOVER_FROM_FAULT_MODE = 0xA06F MSG_ID_HD_DEBUG_EVENT = 0xFFF1 MSG_ID_DG_DEBUG_EVENT = 0xFFF2 Index: dialin/common/test_config_defs.py =================================================================== diff -u -r8ac75cccb937866cb13c49a97e91bb9e1060a9d8 -r1b04b37b3a327b145b150477f567e26a26c60e4e --- dialin/common/test_config_defs.py (.../test_config_defs.py) (revision 8ac75cccb937866cb13c49a97e91bb9e1060a9d8) +++ dialin/common/test_config_defs.py (.../test_config_defs.py) (revision 1b04b37b3a327b145b150477f567e26a26c60e4e) @@ -20,17 +20,19 @@ @unique class DGTestConfigOptions(DialinEnum): - TEST_CONFIG_MIX_WITH_WATER = 0 # Test configuration mix with water. - TEST_CONFIG_DISABLE_INLET_WATER_TEMP_CHECK = 1 # Test configuration disable inlet water temperature check - NUM_OF_TEST_CONFIGS = 2 # Number of test configuration. + TEST_CONFIG_MIX_WITH_WATER = 0 # Test config mix with water. + TEST_CONFIG_DISABLE_INLET_WATER_TEMP_CHECK = 1 # Test config disable inlet water temperature check + TEST_CONFIG_RECOVER_TREATMENT = 2 # Test config recover treatment + NUM_OF_TEST_CONFIGS = 3 # Number of test configuration. @unique class HDTestConfigOptions(DialinEnum): - TEST_CONFIG_USE_WET_CARTRIDGE = 0 # Test configuration use wet cartridge. - TEST_CONFIG_USE_WORN_CARTRIDGE = 1 # Test configuration use worn cartridge. - TEST_CONFIG_EXPEDITE_PRE_TREATMENT = 2 # Test configuration expedite pre-treatment. - TEST_CONFIG_SKIP_BLOOD_PRIME = 3 # Test configuration skip blood prime. - TEST_CONFIG_SKIP_DISINFECT_AND_SERVICE_TX_BLOCKERS = 4 # Test configuration skip disinfect and service treatment blockers. - TEST_CONFIG_DISABLE_WET_SELFTEST_DISPLACEMENT_CHECK = 5 # Test configuration disable wet self test displacement check. - NUM_OF_TEST_CONFIGS = 6 # Number of test configurations + TEST_CONFIG_USE_WET_CARTRIDGE = 0 # Test config use wet cartridge. + TEST_CONFIG_USE_WORN_CARTRIDGE = 1 # Test config use worn cartridge. + TEST_CONFIG_EXPEDITE_PRE_TREATMENT = 2 # Test config expedite pre-treatment. + TEST_CONFIG_SKIP_BLOOD_PRIME = 3 # Test config skip blood prime. + TEST_CONFIG_SKIP_DISINFECT_AND_SERVICE_TX_BLOCKERS = 4 # Test config skip disinfect and service treatment blockers. + TEST_CONFIG_DISABLE_WET_SELFTEST_DISPLACEMENT_CHECK = 5 # Test config disable wet self test displacement check. + TEST_CONFIG_RECOVER_TREATMENT = 6 # Test config recover treatment + NUM_OF_TEST_CONFIGS = 7 # Number of test configurations Index: dialin/dg/calibration_record.py =================================================================== diff -u -r17a693f5ae18221ddf9be4f7e1d8bfd2116bb649 -r1b04b37b3a327b145b150477f567e26a26c60e4e --- dialin/dg/calibration_record.py (.../calibration_record.py) (revision 17a693f5ae18221ddf9be4f7e1d8bfd2116bb649) +++ dialin/dg/calibration_record.py (.../calibration_record.py) (revision 1b04b37b3a327b145b150477f567e26a26c60e4e) @@ -50,8 +50,8 @@ _DEFAULT_TIME_VALUE = 0 _DEFAULT_CRC_VALUE = 0 _DEFAULT_FLUSH_LINES_VOLUME = 0.01 - _DEFAULT_ULTRAFILTER_TAU_C_PER_MIN = -4.565 - _DEFAULT_RESERVOIR_TAU_C_PER_MIN = -0.512 + _DEFAULT_ULTRAFILTER_TAU_C_PER_MIN = -1.0 + _DEFAULT_RESERVOIR_TAU_C_PER_MIN = -0.25 _DEFAULT_ULTRAFILTER_VOLUME_ML = 700 # Maximum allowed bytes that are allowed to be written to EEPROM in firmware Index: dialin/dg/dg_test_configs.py =================================================================== diff -u -r6ff50b4ae97f1d8071f1d8fdafae60f6fd704b9d -r1b04b37b3a327b145b150477f567e26a26c60e4e --- dialin/dg/dg_test_configs.py (.../dg_test_configs.py) (revision 6ff50b4ae97f1d8071f1d8fdafae60f6fd704b9d) +++ dialin/dg/dg_test_configs.py (.../dg_test_configs.py) (revision 1b04b37b3a327b145b150477f567e26a26c60e4e) @@ -58,6 +58,31 @@ """ return self.dg_test_configs[DGTestConfigOptions(config).name] + def cmd_set_recover_from_mode_fault_signal(self): + """ + Constructs and sends the DG test config the signal to recover from mode fault + Constraints: + Must be logged into DG. + + @return: 1 if successful, zero otherwise + """ + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, + message_id=MsgIds.MSG_ID_DG_SIGNAL_RECOVER_FROM_FAULT_MODE.value) + + self.logger.debug("Setting signal to recover from mode fault") + + # Send message + received_message = self.can_interface.send(message) + + # If there is no content... + if received_message is not None: + # response payload is OK or not OK + return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] + else: + self.logger.debug("Timeout!!!!") + return False + def cmd_set_test_config(self, config: int, reset: int = NO_RESET): """ Constructs and sends the DG test config Index: tests/dg_nvm_scripts.py =================================================================== diff -u -r6ff50b4ae97f1d8071f1d8fdafae60f6fd704b9d -r1b04b37b3a327b145b150477f567e26a26c60e4e --- tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision 6ff50b4ae97f1d8071f1d8fdafae60f6fd704b9d) +++ tests/dg_nvm_scripts.py (.../dg_nvm_scripts.py) (revision 1b04b37b3a327b145b150477f567e26a26c60e4e) @@ -49,12 +49,12 @@ # It creates a folder called DG_NV_Records in the destination that is called # If no address is provided, the default location is one folder above the dialin folder wherever it is installed # in you computer. - #dg.calibration_record.cmd_get_dg_calibration_record_report() + dg.calibration_record.cmd_get_dg_calibration_record_report() # Use cmd_set_dg_calibration_excel_to_fw() set the changes back to firmware # This function requires an address for the excel report. Use the absolute address of your excel report like the # example below - dg.calibration_record.cmd_set_dg_calibration_excel_to_fw('/home/fw/projects/DG_NV_Records/2023-02-01-DG-Record.xlsx') + #dg.calibration_record.cmd_set_dg_calibration_excel_to_fw('/home/fw/projects/DG_NV_Records/2023-05-19-DG-Record.xlsx') # For resetting the calibration record to benign values, use the function below #dg.calibration_record.cmd_reset_dg_calibration_record() @@ -112,9 +112,9 @@ if dg.cmd_log_in_to_dg(): - run_sw_configs_commands() + #run_sw_configs_commands() - #run_calibration_commands() + run_calibration_commands() #run_system_commands() Index: tests/dg_tests.py =================================================================== diff -u -r8ac75cccb937866cb13c49a97e91bb9e1060a9d8 -r1b04b37b3a327b145b150477f567e26a26c60e4e --- tests/dg_tests.py (.../dg_tests.py) (revision 8ac75cccb937866cb13c49a97e91bb9e1060a9d8) +++ tests/dg_tests.py (.../dg_tests.py) (revision 1b04b37b3a327b145b150477f567e26a26c60e4e) @@ -675,7 +675,7 @@ # cmd_set_disinfect_ui_screen() - #collect_treatment_data() + collect_treatment_data() #collect_hd_treatment() Index: tests/tx_test_config_tests.py =================================================================== diff -u -r8ac75cccb937866cb13c49a97e91bb9e1060a9d8 -r1b04b37b3a327b145b150477f567e26a26c60e4e --- tests/tx_test_config_tests.py (.../tx_test_config_tests.py) (revision 8ac75cccb937866cb13c49a97e91bb9e1060a9d8) +++ tests/tx_test_config_tests.py (.../tx_test_config_tests.py) (revision 1b04b37b3a327b145b150477f567e26a26c60e4e) @@ -53,6 +53,7 @@ from dialin.hd.pretreatment import PreTreatmentRsrvrState from dialin.common.dg_defs import DGFlushStates, DGHeatDisinfectActiveCoolStates from dialin.common.test_config_defs import DGTestConfigOptions, HDTestConfigOptions +from dialin.common.dg_defs import DGOpModes from time import sleep from datetime import datetime import sys @@ -71,6 +72,90 @@ return state_counter, delay_counter +def recover_treatment(): + + sleep_time = 0.1 + counter = 1 + delay_counter = 0 + target_delay = 1 + + while True: + if counter == 1: + if delay_counter == 0: + # Received the load cells tare values from DG. Reset both stacks + dg.cmd_dg_software_reset_request() + hd.cmd_hd_software_reset_request() + + counter, delay_counter = check_status(delay_counter, sleep_time, target_delay, counter) + + elif counter == 2 and dg.dg_operation_mode == DGOpModes.DG_MODE_STAN.value: + if delay_counter == 0: + # After reset log in again + dg.cmd_log_in_to_dg() + + counter, delay_counter = check_status(delay_counter, sleep_time, target_delay, counter) + + elif counter == 3 and hd.hd_operation_mode == 3: + if delay_counter == 0: + hd.cmd_log_in_to_hd() + + counter, delay_counter = check_status(delay_counter, sleep_time, target_delay, counter) + + elif counter == 4: + if delay_counter == 0: + # Set the operation mode is pre-treatment before commanding the start DG + hd.cmd_hd_set_operation_mode(HDOpModes.MODE_TPAR.value) + + counter, delay_counter = check_status(delay_counter, sleep_time, 0, counter) + + elif counter == 5 and hd.hd_operation_mode == HDOpModes.MODE_TPAR.value: + if delay_counter == 0: + # Start DG cannot be when HD is in standby + dg.hd_proxy.cmd_start_stop_dg() + + counter, delay_counter = check_status(delay_counter, sleep_time, 0, counter) + + elif counter == 6 and dg.dg_operation_mode == DGOpModes.DG_MODE_GENE.value and dg.dg_operation_sub_mode == 1: + if delay_counter == 0: + # This section is for testing only to make sure we always have fluid in the reservoir. This part is not + # needed in the actual test procedure + dg.hd_proxy.cmd_fill(1600) + + counter, delay_counter = check_status(delay_counter, sleep_time, target_delay, counter) + + elif counter == 7 and dg.dg_operation_mode == DGOpModes.DG_MODE_GENE.value and dg.dg_operation_sub_mode == 1: + if delay_counter == 0: + hd.test_configs.cmd_set_test_config(DGTestConfigOptions.TEST_CONFIG_RECOVER_TREATMENT.value) + + counter, delay_counter = check_status(delay_counter, sleep_time, target_delay, counter) + + elif counter == 8 and dg.dg_operation_mode == DGOpModes.DG_MODE_GENE.value and dg.dg_operation_sub_mode == 1: + if delay_counter == 0: + dg.hd_proxy.cmd_drain() + + counter, delay_counter = check_status(delay_counter, sleep_time, target_delay, counter) + + elif counter == 9 and dg.dg_operation_mode == DGOpModes.DG_MODE_DRAI.value and dg.dg_operation_sub_mode == 1: + if delay_counter == 0: + dg.alarms.cmd_alarm_state_override(AlarmList.ALARM_ID_DG_BARO_PRESSURE_OUT_OF_RANGE.value, 1) + + counter, delay_counter = check_status(delay_counter, sleep_time, 0, counter) + + elif counter == 10 and dg.dg_operation_mode == DGOpModes.DG_MODE_FAUL.value and dg.dg_operation_sub_mode == 2: + if delay_counter == 0: + dg.alarms.cmd_alarm_state_override(AlarmList.ALARM_ID_DG_BARO_PRESSURE_OUT_OF_RANGE.value, 1, RESET=1) + + counter, delay_counter = check_status(delay_counter, sleep_time, target_delay, counter) + + elif counter == 11 and dg.dg_operation_mode == DGOpModes.DG_MODE_FAUL.value and dg.dg_operation_sub_mode == 2: + if delay_counter == 0: + dg.test_configs.cmd_set_recover_from_mode_fault_signal() + + counter, delay_counter = check_status(delay_counter, sleep_time, target_delay, counter) + + sleep(sleep_time) + + def expedite_pretreatment(): sleep_time = 0.1 @@ -201,4 +286,6 @@ hd.cmd_log_in_to_hd() sleep(1) - expedite_pretreatment() + #expedite_pretreatment() + + recover_treatment()