Index: dialin/dg/dg_test_configs.py =================================================================== diff -u -r4a0c6600b52ec965a6625a428de986e7040ae2c9 -r0849ee6900414beac70bc5b2016478dd3c8553b6 --- dialin/dg/dg_test_configs.py (.../dg_test_configs.py) (revision 4a0c6600b52ec965a6625a428de986e7040ae2c9) +++ dialin/dg/dg_test_configs.py (.../dg_test_configs.py) (revision 0849ee6900414beac70bc5b2016478dd3c8553b6) @@ -104,12 +104,15 @@ message_id=MsgIds.MSG_ID_DG_GET_TEST_CONFIGURATION.value) self.logger.debug('Getting DG test configuration record') + # Reset the test configs regardless of whether the message has been acknowledged or not. The reset might be out + # sync and reset the test configuration while the latest data has been received. If the test configuration is + # reset in Dialin but the message was not acknowledged, the user shall send the request again + self._reset_test_configs_record() received_message = self.can_interface.send(message) # If there is content... if received_message is not None: - self._reset_test_configs_record() self.logger.debug("Received FW ACK after requesting DG test configuration record.") # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] Index: dialin/hd/hd_test_configs.py =================================================================== diff -u -rcd99ca8354f5c7910f699b7ac2c1976781b07627 -r0849ee6900414beac70bc5b2016478dd3c8553b6 --- dialin/hd/hd_test_configs.py (.../hd_test_configs.py) (revision cd99ca8354f5c7910f699b7ac2c1976781b07627) +++ dialin/hd/hd_test_configs.py (.../hd_test_configs.py) (revision 0849ee6900414beac70bc5b2016478dd3c8553b6) @@ -90,12 +90,12 @@ message_id=MsgIds.MSG_ID_HD_GET_TEST_CONFIGURATION.value) self.logger.debug('Getting HD test configuration record') + self._reset_test_configs_record() received_message = self.can_interface.send(message) # If there is content... if received_message is not None: - self._reset_test_configs_record() self.logger.debug("Received FW ACK after requesting HD test configuration record.") # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] Index: tests/dg_tests.py =================================================================== diff -u -rbeb336b685d8e152fdbf31c19bfa4bed6b73f05a -r0849ee6900414beac70bc5b2016478dd3c8553b6 --- tests/dg_tests.py (.../dg_tests.py) (revision beb336b685d8e152fdbf31c19bfa4bed6b73f05a) +++ tests/dg_tests.py (.../dg_tests.py) (revision 0849ee6900414beac70bc5b2016478dd3c8553b6) @@ -394,63 +394,6 @@ return info -def run_dg(): - counter = 1 - timer = 0.1 - sleep_time = 1 - run_number = 1 - recirc_delay = 1 - f = open("/home/fw/projects/dialin/tests/run_dg.log", "w") - - dg.hd_proxy.cmd_start_stop_dg() - sleep(1) - - dg.heaters.cmd_start_stop_primary_heater() - sleep(0.1) - - try: - while True: - dg_run = get_dg_run_info() - temperature = get_temperature_sensors_info() - heaters = get_heaters_with_no_temp_info() - load_cell = get_load_cells_info() - drain = get_drain_states_info() - ro = get_ro_info() - dg_rsrvrs = get_dg_reservoirs_info() - fans = get_dg_fans_info() - conc = get_concentrate_pumps_info() - valves = get_dg_valves_states() - - var = str(datetime.now()) + ', ' + dg_run + \ - temperature + heaters + load_cell + drain + ro + dg_rsrvrs + conc + fans + valves + '\r' - - print(var) - f.write(var) - - if DGOperationModes(dg.dg_operation_mode).name == DGOperationModes.DG_OP_MODE_GEN_IDLE.name and \ - dg.dg_operation_sub_mode == 2 and counter == 1: - dg.hd_proxy.cmd_drain(tare_load_cell=True) - counter += 1 - timer = 1 - - elif DGOperationModes(dg.dg_operation_mode).name == DGOperationModes.DG_OP_MODE_GEN_IDLE.name and \ - dg.dg_operation_sub_mode == 2 and counter == 2: - counter += 1 - dg.hd_proxy.cmd_fill() - - elif DGOperationModes(dg.dg_operation_mode).name == DGOperationModes.DG_OP_MODE_GEN_IDLE.name and \ - dg.dg_operation_sub_mode == 2 and counter == 3: - counter = 1 - run_number += 1 - - sleep(sleep_time) - - except KeyboardInterrupt: - dg.hd_proxy.cmd_start_stop_dg(start=False) - f.close() - pass - - def collect_treatment_data(): address = os.path.join(os.getcwd(), "treatment_run.log") f = open(address, "w") @@ -664,28 +607,50 @@ # print(event) +def run_test_configs(): + + counter = 1 + reset_val = 0 + print(hex(dg.test_configs.cmd_get_test_config_status(DGTestConfigOptions.TEST_CONFIG_ENABLE_MIXING_WITH_WATER.value))) + + while True: + if counter == 1: + dg.test_configs.cmd_set_test_config(DGTestConfigOptions.TEST_CONFIG_ENABLE_MIXING_WITH_WATER.value, reset=reset_val) + counter += 1 + if counter > 10: + #hd.test_configs.cmd_request_test_config_status_from_fw() + dg.test_configs.cmd_request_test_config_status_from_fw() + + while True: + #print(hex(hd.test_configs.hd_test_configs[HDTestConfigOptions.TEST_CONFIG_USE_WORN_CARTRIDGE.name])) + print(hex(dg.test_configs.dg_test_configs[DGTestConfigOptions.TEST_CONFIG_ENABLE_MIXING_WITH_WATER.name]), reset_val) + #print((dg.test_configs.dg_test_configs), reset_val) + + if counter > 20: + + if reset_val == 1: + reset_val = 0 + else: + reset_val = 1 + counter = 1 + break + counter += 1 + sleep(0.1) + + sleep(0.1) + + if __name__ == "__main__": dg = DG(log_level='DEBUG') + #dg = DG() dg.cmd_log_in_to_dg() sleep(1) hd = HD(log_level='DEBUG') hd.cmd_log_in_to_hd() sleep(1) - print((hd.test_configs.hd_test_configs)) - #print(hex(dg.test_configs.cmd_get_test_config_status(DGTestConfigOptions.TEST_CONFIG_ENABLE_MIXING_WITH_WATER.value))) + run_test_configs() - #dg.test_configs.cmd_set_test_config(DGTestConfigOptions.TEST_CONFIG_ENABLE_MIXING_WITH_WATER.value, reset=0) - #hd.test_configs.cmd_set_test_config(HDTestConfigOptions.TEST_CONFIG_USE_WORN_CARTRIDGE.value, reset=1) - hd.test_configs.cmd_reset_all_test_configs() - sleep(1) - - hd.test_configs.cmd_request_test_config_status_from_fw() - - while True: - print(hex(hd.test_configs.hd_test_configs[HDTestConfigOptions.TEST_CONFIG_USE_WORN_CARTRIDGE.name])) - sleep(1) - #run_heat_disinfect() #run_flush_mode()