Index: dialin/common/msg_ids.py =================================================================== diff -u -rbb27421af996ff0333c514d27d9c0b13155bce77 -r5d46528dea60d95e18caada03ff8e328b52bbb38 --- dialin/common/msg_ids.py (.../msg_ids.py) (revision bb27421af996ff0333c514d27d9c0b13155bce77) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision 5d46528dea60d95e18caada03ff8e328b52bbb38) @@ -208,15 +208,15 @@ MSG_ID_HD_REQUEST_DG_SERVICE_RECORD = 0xB9 MSG_ID_HD_REQUEST_UI_CONFIRMATION = 0xBA MSG_ID_UI_CONFIRMATION_RESULT = 0xBB - MSG_ID_REQUEST_CPLD_STATUS = 0xBC + MSG_ID_DG_SET_RO_ONLY_MODE = 0xBC MSG_ID_DG_CPLD_STATUS = 0xBD MSG_ID_HD_BATTERY_MANAGEMENT_DATA = 0xBE MSG_ID_HD_BATTERY_STATUS_DATA = 0xBF MSG_ID_DG_CHEM_DISINFECT_FLUSH_DATA = 0xC0 MSG_ID_DG_CHEM_DISINFECT_FLUSH_TIME_DATA = 0xC1 MSG_ID_DG_START_STOP_CHEM_DISINFECT_FLUSH = 0xC2 - MSG_ID_UI_CHEM_DISINFECT_FLUSH_CONFIRM = 0xC3 - MSG_ID_HD_CHEM_DISINFECT_FLUSH_CONFIRM_RESPONSE = 0xC4 + MSG_ID_DG_RO_ONLY_MODE_STATUS_REQUEST = 0xC3 + MSG_ID_DG_RO_ONLY_MODE_STATUS_RESPONSE = 0xC4 MSG_ID_DG_HEAT_DISINFECT_ACTIVE_COOL_DATA = 0xC5 MSG_ID_DG_START_STOP_HEAT_DISINFECT_ACTIVE_COOL = 0xC6 MSG_ID_HD_AIR_PUMP_DATA = 0xC7 Index: dialin/dg/dialysate_fill.py =================================================================== diff -u -r9bc00e997e91dab8b404aa877b02ae3d4100d417 -r5d46528dea60d95e18caada03ff8e328b52bbb38 --- dialin/dg/dialysate_fill.py (.../dialysate_fill.py) (revision 9bc00e997e91dab8b404aa877b02ae3d4100d417) +++ dialin/dg/dialysate_fill.py (.../dialysate_fill.py) (revision 5d46528dea60d95e18caada03ff8e328b52bbb38) @@ -55,6 +55,7 @@ self.used_bicarb = 0.0 self.total_volume = 0.0 self.dg_fill_mode_timestamp = 0.0 + self.ro_only_mode_status = 0 if self.can_interface is not None: channel_id = DenaliChannels.dg_sync_broadcast_ch_id @@ -74,7 +75,8 @@ return [self.avg_acid, self.avg_bicarb, self.first_fill, self.pctDiffConduct, self.used_acid, self.used_bicarb, self.total_volume] - @publish(["dg_fill_mode_timestamp","avg_acid", "avg_bicarb", "first_fill", "pctDiffConduct", "used_acid", "used_bicarb", "total_volume"]) + @publish(["dg_fill_mode_timestamp","avg_acid", "avg_bicarb", "first_fill", "pctDiffConduct", "used_acid", + "used_bicarb", "total_volume", "ro_only_mode_status"]) def _handler_fill_mode_monitor_sync(self, message, timestamp=0.0): """ Handles published dialysate fill mode data' data messages. Dialysate fill data are captured @@ -98,6 +100,8 @@ self.total_volume = struct.unpack(' int: """ Index: dialin/hd/ui_proxy.py =================================================================== diff -u -r9bc00e997e91dab8b404aa877b02ae3d4100d417 -r5d46528dea60d95e18caada03ff8e328b52bbb38 --- dialin/hd/ui_proxy.py (.../ui_proxy.py) (revision 9bc00e997e91dab8b404aa877b02ae3d4100d417) +++ dialin/hd/ui_proxy.py (.../ui_proxy.py) (revision 5d46528dea60d95e18caada03ff8e328b52bbb38) @@ -1721,7 +1721,35 @@ self.logger.debug("Setting DG service time.") self.can_interface.send(message, 0) - @publish(["hd_disinfection_standby_timestamp","disinfects_hd_submode", "disinfects_dg_mode"]) + def cmd_set_ro_only_mode_status(self, status: int) -> int: + """ + Constructs and sends a message to DG to set the status of the RO only mode: + 1 = Enable RO only mode + 0 = Disable RO only mode and be normal mode + + @param status: (int) RO only mode status (1=enable, 0=disable) + @return: 1 if successful, zero otherwise + """ + st = integer_to_bytearray(status) + payload = st + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, + message_id=MsgIds.MSG_ID_DG_SET_RO_ONLY_MODE.value, + payload=payload) + + self.logger.debug("Setting RO only mode to: {}".format(status)) + + received_message = self.can_interface.send(message) + + # If there is 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 + + @publish(["hd_disinfection_standby_timestamp", "disinfects_hd_submode", "disinfects_dg_mode"]) def _handler_disinfects_data_publish(self, message: dict, timestamp=0.0) -> None: """ Handles published disinfect mode and submode that is published to UI Index: dialin/hd/usage_info_record.py =================================================================== diff -u -racd09d02879e8add4cf7f694f5db8e423a76c341 -r5d46528dea60d95e18caada03ff8e328b52bbb38 --- dialin/hd/usage_info_record.py (.../usage_info_record.py) (revision acd09d02879e8add4cf7f694f5db8e423a76c341) +++ dialin/hd/usage_info_record.py (.../usage_info_record.py) (revision 5d46528dea60d95e18caada03ff8e328b52bbb38) @@ -85,7 +85,7 @@ # If there is content... if received_message is not None: - self.logger.debug("Received FW ACK after requesting DG software configuration record.") + self.logger.debug("Received FW ACK after requesting HD usage information record.") # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: @@ -152,18 +152,20 @@ # Get the data only and not specs of it (i.e current message number) self._usage_info_data = message['message'][MsgFieldPositions.START_POS_FIELD_1:end_of_data_index] - + print(self.hd_usage_info_record, self._current_message, self._total_messages) # Continue getting calibration_record records until the all the calibration_record messages are received. # Concatenate the calibration_record records to each other if self._current_message <= self._total_messages: self._raw_usage_info_record += (message['message'][MsgFieldPositions.START_POS_FIELD_1 + self._RECORD_SPECS_BYTES:end_of_data_index]) + print(self.hd_usage_info_record) if self._current_message == self._total_messages: # Done with receiving the messages self._is_getting_usage_info_in_progress = False # If all the messages have been received, call another function to process the raw data self._utilities.process_received_record_from_fw(self.hd_usage_info_record, self._raw_usage_info_record) self._handler_received_complete_hd_usage_info_record() + print(self.hd_usage_info_record) @publish(["hd_usage_info_record"]) def _handler_received_complete_hd_usage_info_record(self): @@ -323,12 +325,13 @@ @return: none """ - # Request the DG usage record and set and observer class to callback when the calibration record is read - # back - self._cmd_request_hd_usage_info_record() observer = NVUtilsObserver("hd_usage_info_record") # Attach the observer to the list self.attach(observer) + + # Request the DG usage record and set and observer class to callback when the calibration record is read + # back + self._cmd_request_hd_usage_info_record() while not observer.received: sleep(0.1) self._utilities.write_excel_record_to_fw_record(self.hd_usage_info_record, report_address, Index: tests/dg_tests.py =================================================================== diff -u -rbb27421af996ff0333c514d27d9c0b13155bce77 -r5d46528dea60d95e18caada03ff8e328b52bbb38 --- tests/dg_tests.py (.../dg_tests.py) (revision bb27421af996ff0333c514d27d9c0b13155bce77) +++ tests/dg_tests.py (.../dg_tests.py) (revision 5d46528dea60d95e18caada03ff8e328b52bbb38) @@ -663,7 +663,7 @@ hd.cmd_log_in_to_hd() sleep(1) - run_heat_disinfect() + #run_heat_disinfect() #run_flush_mode() @@ -697,4 +697,10 @@ #hd.cmd_hd_software_reset_request() + hd.ui.cmd_set_ro_only_mode_status(1) + while True: + print(dg.dialysate_fill.ro_only_mode_status) + sleep(1) + + Index: tests/hd_nvm_scripts.py =================================================================== diff -u -rbb27421af996ff0333c514d27d9c0b13155bce77 -r5d46528dea60d95e18caada03ff8e328b52bbb38 --- tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision bb27421af996ff0333c514d27d9c0b13155bce77) +++ tests/hd_nvm_scripts.py (.../hd_nvm_scripts.py) (revision 5d46528dea60d95e18caada03ff8e328b52bbb38) @@ -50,12 +50,12 @@ # It creates a folder called HD_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 your computer. - hd.calibration_record.cmd_get_hd_calibration_record_report() + #hd.calibration_record.cmd_get_hd_calibration_record_report() # Use cmd_set_hd_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 - #hd.calibration_record.cmd_set_hd_calibration_excel_to_fw('/home/fw/projects/HD_NV_Records/2022-08-13-HD-Record.xlsx') + hd.calibration_record.cmd_set_hd_calibration_excel_to_fw('/home/fw/projects/HD_NV_Records/2023-03-27-HD-Record.xlsx') # For resetting the calibration record to benign values, use the function below #hd.calibration_record.cmd_reset_hd_calibration_record() @@ -114,14 +114,14 @@ if hd.cmd_log_in_to_hd(): # Comment this function if not needed - run_sw_configs_commands() + #run_sw_configs_commands() # Comment this function if not needed - #run_calibration_commands() + # run_calibration_commands() #run_system_commands() - #run_usage_info_commands() + run_usage_info_commands() #run_service_commands() Index: tests/test_nelson_labs_disinfect.py =================================================================== diff -u -rbb27421af996ff0333c514d27d9c0b13155bce77 -r5d46528dea60d95e18caada03ff8e328b52bbb38 --- tests/test_nelson_labs_disinfect.py (.../test_nelson_labs_disinfect.py) (revision bb27421af996ff0333c514d27d9c0b13155bce77) +++ tests/test_nelson_labs_disinfect.py (.../test_nelson_labs_disinfect.py) (revision 5d46528dea60d95e18caada03ff8e328b52bbb38) @@ -247,13 +247,14 @@ f.write(var) sleep(1) - if call_numer > 3: - # Wait for a couple of seconds and them exit this loop if we are no longer in any of the disinfec modes - if dg.dg_operation_mode is not DGOperationModes.DG_OP_MODE_DISINFECT.value and \ - dg.dg_operation_mode is not DGOperationModes.DG_OP_MODE_CHEMICAL_DISINFECT.value: + # Wait for a couple of seconds and then exit this loop if we are no longer in any of the disinfect modes + if dg.dg_operation_mode is not DGOperationModes.DG_OP_MODE_DISINFECT.value and \ + dg.dg_operation_mode is not DGOperationModes.DG_OP_MODE_CHEMICAL_DISINFECT.value: + call_numer += 1 + + if call_numer > 3: f.close() exit() - call_numer += 1 except KeyboardInterrupt: dg.hd_proxy.cmd_start_stop_dg_heat_disinfect(start=False)