Index: dialin/common/alarm_defs.py =================================================================== diff -u -r8474f8e345f165187d4dde17840575ee4e98a9b4 -r89df6a25e4845ad234c1ffc71fb484b73d125b4c --- dialin/common/alarm_defs.py (.../alarm_defs.py) (revision 8474f8e345f165187d4dde17840575ee4e98a9b4) +++ dialin/common/alarm_defs.py (.../alarm_defs.py) (revision 89df6a25e4845ad234c1ffc71fb484b73d125b4c) @@ -292,4 +292,4 @@ ALARM_ID_UI_POST_FAILURE_SOUND = 269 ALARM_ID_HD_SAFETY_SHUTDOWN_POST_TEST_FAILED = 270 ALARM_ID_DG_SAFETY_SHUTDOWN_POST_TEST_FAILED = 271 - ALARM_ID_HD_FAN_RPM_OUT_OF_RANGE = 272 + ALARM_ID_HD_FAN_RPM_OUT_OF_RANGE = 272 \ No newline at end of file Index: dialin/common/msg_defs.py =================================================================== diff -u -r8474f8e345f165187d4dde17840575ee4e98a9b4 -r89df6a25e4845ad234c1ffc71fb484b73d125b4c --- dialin/common/msg_defs.py (.../msg_defs.py) (revision 8474f8e345f165187d4dde17840575ee4e98a9b4) +++ dialin/common/msg_defs.py (.../msg_defs.py) (revision 89df6a25e4845ad234c1ffc71fb484b73d125b4c) @@ -19,10 +19,21 @@ # Define msg ids that are not yet added to common but are needed in dialin -# @unique -# class MsgIdsDialin(DialinEnum): +@unique +class MsgIdsDialin(DialinEnum): + MSG_DIALIN_ID_HD_SERIAL_NUMBER_RESPONSE = 0X87 + MSG_DIALIN_ID_DG_SERIAL_NUMBER_RESPONSE = 0X88 + MSG_DIALIN_ID_UI_SYSTEM_USAGE_REQUEST = 0x89 + MSG_DIALIN_ID_HD_SYSTEM_USAGE_RESPONSE = 0x8A + MSG_DIALIN_ID_DG_SYSTEM_USAGE_RESPONSE = 0x8C + MSG_DIALIN_ID_HD_FLUID_LEAK_STATE_DETECTOR_OVERRIDE = 0x8047 + MSG_DIALIN_ID_HD_VALVES_POSITION_COUNT_OVERRIDE = 0x8058 + MSG_DIALIN_ID_HD_DISINFECT_STATE = 0x7E + MSG_DIALIN_ID_HD_VERSION_REQUEST = 0x9E + MSG_DIALIN_ID_UI_POST_REPORT_VERSION = 0x9F + ACK_NOT_REQUIRED = [ MsgIds.MSG_ID_ALARM_CONDITION_CLEARED.value ] @@ -37,7 +48,7 @@ REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE = 4 REQUEST_REJECT_REASON_TREATMENT_TOO_CLOSE_TO_FINISHED = 5 REQUEST_REJECT_REASON_TREATMENT_TIME_OUT_OF_RANGE = 6 - REQUEST_REJECT_REASON_TREATMENT_TIME_LESS_THAN_CURRENT = 7 + EQUEST_REJECT_REASON_TREATMENT_TIME_LESS_THAN_CURRENT = 7 REQUEST_REJECT_REASON_BLOOD_FLOW_OUT_OF_RANGE = 8 REQUEST_REJECT_REASON_DIAL_FLOW_OUT_OF_RANGE = 9 REQUEST_REJECT_REASON_DIAL_VOLUME_OUT_OF_RANGE = 10 Index: dialin/common/msg_ids.py =================================================================== diff -u -r4e57fcb909cbabb6f08ab2cffd339e99a2fc2f64 -r89df6a25e4845ad234c1ffc71fb484b73d125b4c --- dialin/common/msg_ids.py (.../msg_ids.py) (revision 4e57fcb909cbabb6f08ab2cffd339e99a2fc2f64) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision 89df6a25e4845ad234c1ffc71fb484b73d125b4c) @@ -5,12 +5,12 @@ # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # -# @file msg_ids.py +# @file msg_ids.py # -# @author (last) Peter Lucia -# @date (last) 15-Jun-2021 -# @author (original) Peter Lucia -# @date (original) 15-Jun-2021 +# @author (last) Quang Nguyen +# @date (last) 30-Aug-2021 +# @author (original) Peter Lucia +# @date (original) 06-Apr-2021 # ############################################################################ from enum import unique @@ -146,7 +146,7 @@ MSG_ID_HD_VOLTAGES_DATA = 0X7B MSG_ID_HD_ALARM_AUDIO_VOLUME_SET_RESPONSE = 0X7C MSG_ID_HD_ALARM_INFORMATION = 0X7D - MSG_ID_HD_STANDBY_STATE = 0X7E + MSG_ID_HD_DISINFECT_STANDBY_DATA = 0X7E MSG_ID_UI_DISINFECT_REQUEST = 0X7F MSG_ID_HD_DISINFECT_RESPONSE = 0X80 MSG_ID_UI_CHEM_DISINFECT_CONFIRM = 0X81 @@ -157,7 +157,7 @@ MSG_ID_DG_VOLTAGES_DATA = 0X86 MSG_ID_DG_CHEM_DISINFECT_DATA = 0X87 MSG_ID_DG_SERIAL_NUMBER = 0X88 - MSG_ID_UI_REQUEST_SYSTEM_USAGE_INFO = 0X89 + MSG_ID_UI_REQUEST_SERVICE_INFO = 0X89 MSG_ID_HD_SERVICE_SCHEDULE_DATA = 0X8A MSG_ID_HD_USAGE_DATA = 0X8B MSG_ID_DG_SERVICE_SCHEDULE_DATA = 0X8C @@ -176,14 +176,16 @@ MSG_ID_HD_SERIAL_NUMBER = 0X99 MSG_ID_HD_SET_STANDBY_DISINFECT_SUB_MODE_REQUEST = 0X9A MSG_ID_HD_SET_STANDBY_DISINFECT_SUB_MODE_RESPONSE = 0X9B - MSG_ID_HD_DISINFECTS_UI_STATE_READINGS = 0X9C - MSG_ID_HD_TEMPERATURES_DATA = 0x9D - MSG_ID_HD_UI_VERSION_INFO_REQUEST = 0x9E - MSG_ID_HD_UI_VERSION_INFO_RESPONSE = 0x9F + MSG_ID_HD_DG_POST_RESULT_REQUEST = 0X9C + MSG_ID_HD_TEMPERATURES_DATA = 0X9D + MSG_ID_HD_UI_VERSION_INFO_REQUEST = 0X9E + MSG_ID_HD_UI_VERSION_INFO_RESPONSE = 0X9F MSG_ID_REQUEST_HD_USAGE_INFO = 0XA0 - MSG_ID_DG_SWITCHES_DATA = 0xA1 - MSG_ID_HD_SWITCHES_DATA = 0xA2 - MSG_ID_HD_FANS_DATA = 0xA3 + MSG_ID_DG_SWITCHES_DATA = 0XA1 + MSG_ID_HD_SWITCHES_DATA = 0XA2 + MSG_ID_HD_FANS_DATA = 0XA3 + MSG_ID_HD_EVENT = 0xA4 + MSG_ID_DG_EVENT = 0xA5 MSG_ID_CAN_ERROR_COUNT = 0X999 MSG_ID_TESTER_LOGIN_REQUEST = 0X8000 MSG_ID_DIAL_OUT_FLOW_SET_PT_OVERRIDE = 0X8001 @@ -272,7 +274,7 @@ MSG_ID_HD_ALARM_AUDIO_CURRENT_LG_OVERRIDE = 0X8055 MSG_ID_HD_ALARM_BACKUP_AUDIO_CURRENT_OVERRIDE = 0X8056 MSG_ID_HD_VALVES_CURRENT_OVERRIDE = 0X8057 - MSG_ID_HD_VALVES_POSITION_COUNT_OVERRIDE = 0x8058 + MSG_ID_HD_VALVES_POSITION_COUNT_OVERRIDE = 0X8058 MSG_ID_HD_SYRINGE_PUMP_STATUS_OVERRIDE = 0X8059 MSG_ID_HD_SYRINGE_PUMP_ENCODER_STATUS_OVERRIDE = 0X805A MSG_ID_HD_SYRINGE_PUMP_ADC_DAC_STATUS_OVERRIDE = 0X805B Index: dialin/dg/dialysate_generator.py =================================================================== diff -u -r9cc3aacaecf53a1b078254a027af1f22a9081afd -r89df6a25e4845ad234c1ffc71fb484b73d125b4c --- dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 9cc3aacaecf53a1b078254a027af1f22a9081afd) +++ dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 89df6a25e4845ad234c1ffc71fb484b73d125b4c) @@ -1,45 +1,51 @@ ########################################################################### # -# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # -# @file dialysate_generator.py +# @file dialysate_generator.py # -# @author (last) Peter Lucia -# @date (last) 10-Nov-2020 -# @author (original) Peter Lucia -# @date (original) 02-Apr-2020 +# @author (last) Quang Nguyen +# @date (last) 30-Aug-2021 +# @author (original) Peter Lucia +# @date (original) 02-Apr-2020 # ############################################################################ + +from enum import unique + from .accelerometer import DGAccelerometer from .alarms import DGAlarms +from .calibration_record import DGCalibrationNVRecord +from .chemical_disinfect import ChemicalDisinfect from .concentrate_pumps import ConcentratePumps from .conductivity_sensors import ConductivitySensors from .constants import RESET, NO_RESET from .drain_pump import DGDrainPump -from .fluid_leak import DGFluidLeak from .fans import Fans +from .fluid_leak import DGFluidLeak +from .flush import FlushMode from .hd_proxy import DGHDProxy +from .heat_disinfect import HeatDisinfect from .heaters import Heaters from .load_cells import DGLoadCells from .pressures import DGPressures from .reservoirs import DGReservoirs from .ro_pump import DGROPump +from .rtc import DGRTC from .samplewater import DGSampleWater +from .scheduled_runs_record import DGScheduledRunsNVRecord +from .service_record import DGServiceNVRecord +from .switches import DGSwitches +from .system_record import DGSystemNVRecord from .temperature_sensors import TemperatureSensors from .thermistors import Thermistors from .uv_reactors import UVReactors -from .calibration_record import DGCalibrationNVRecord -from .system_record import DGSystemNVRecord -from .service_record import DGServiceNVRecord -from .scheduled_runs_record import DGScheduledRunsNVRecord from .valves import DGValves from .voltages import DGVoltages -from ..utils import * -from ..protocols.CAN import (DenaliCanMessenger, DenaliMessage, DenaliChannels) -from ..utils.base import _AbstractSubSystem, _publish, _LogManager, DialinEnum +from .events import DGEvents from ..common.msg_defs import MsgIds, MsgFieldPositions from .flush import FlushMode from .chemical_disinfect import ChemicalDisinfect @@ -48,10 +54,13 @@ from .switches import DGSwitches from enum import unique from .constants import NO_RESET +from ..protocols.CAN import DenaliCanMessenger, DenaliMessage, DenaliChannels +from ..utils import * +from ..utils.base import AbstractSubSystem, publish, LogManager, DialinEnum + @unique class DGOperationModes(DialinEnum): - # DG operation modes DG_OP_MODE_FAULT = 0 DG_OP_MODE_SERVICE = 1 @@ -66,7 +75,7 @@ DG_OP_MODE_CHEMICAL_DISINFECT = 10 -class DG(_AbstractSubSystem): +class DG(AbstractSubSystem): """ Dialysate Generator (DG) Dialin object API. It provides the basic interface to communicate with the DG firmware. @@ -96,14 +105,14 @@ END_POS_FPGA_LAB = START_POS_FPGA_LAB + 1 # DG sub_modes - DG_POST_STATE_START = 0 # Start initialize & POST mode state - DG_POST_STATE_FPGA = 1 # FPGA POST test state - DG_POST_STATE_WATCHDOG = 2 # Watchdog POST test state - DG_POST_STATE_TEMPERATURE_SENSORS = 3 # Temperature Sensors POST state - DG_POST_STATE_HEATERS = 4 # Heaters POST state - DG_POST_STATE_COMPLETED = 5 # POST completed successfully state - DG_POST_STATE_FAILED = 6 # POST failed state - NUM_OF_DG_POST_STATES = 7 # Number of initialize & POST mode states + DG_POST_STATE_START = 0 # Start initialize & POST mode state + DG_POST_STATE_FPGA = 1 # FPGA POST test state + DG_POST_STATE_WATCHDOG = 2 # Watchdog POST test state + DG_POST_STATE_TEMPERATURE_SENSORS = 3 # Temperature Sensors POST state + DG_POST_STATE_HEATERS = 4 # Heaters POST state + DG_POST_STATE_COMPLETED = 5 # POST completed successfully state + DG_POST_STATE_FAILED = 6 # POST failed state + NUM_OF_DG_POST_STATES = 7 # Number of initialize & POST mode states def __init__(self, can_interface="can0", log_level=None): """ @@ -120,7 +129,7 @@ @param can_interface: string with can bus name, e.g. "can0" """ super().__init__() - self._log_manager = _LogManager(log_level=log_level, log_filepath=self.__class__.__name__+".log") + self._log_manager = LogManager(log_level=log_level, log_filepath=self.__class__.__name__ + ".log") self.logger = self._log_manager.logger # Create listener @@ -143,43 +152,41 @@ self.dg_version = None self.fpga_version = None # create properties - self.dg_operation_mode = 0 #self.DG_OP_MODE_INIT_POST + self.dg_operation_mode = 0 # self.DG_OP_MODE_INIT_POST self.dg_operation_sub_mode = 0 self.dg_logged_in = False self.dg_set_logged_in_status(False) # Create command groups self.accel = DGAccelerometer(self.can_interface, self.logger) - self.fluid_leak = DGFluidLeak(self.can_interface, self.logger) self.alarms = DGAlarms(self.can_interface, self.logger) + self.calibration_record = DGCalibrationNVRecord(self.can_interface, self.logger) + self.chemical_disinfect = ChemicalDisinfect(self.can_interface, self.logger) self.concentrate_pumps = ConcentratePumps(self.can_interface, self.logger) self.conductivity_sensors = ConductivitySensors(self.can_interface, self.logger) self.drain_pump = DGDrainPump(self.can_interface, self.logger) self.fans = Fans(self.can_interface, self.logger) + self.fluid_leak = DGFluidLeak(self.can_interface, self.logger) + self.flush = FlushMode(self.can_interface, self.logger) self.hd_proxy = DGHDProxy(self.can_interface, self.logger) + self.heat_disinfect = HeatDisinfect(self.can_interface, self.logger) self.heaters = Heaters(self.can_interface, self.logger) self.load_cells = DGLoadCells(self.can_interface, self.logger) self.pressures = DGPressures(self.can_interface, self.logger) self.reservoirs = DGReservoirs(self.can_interface, self.logger) self.ro_pump = DGROPump(self.can_interface, self.logger) + self.rtc = DGRTC(self.can_interface, self.logger) self.samplewater = DGSampleWater(self.can_interface, self.logger) + self.scheduled_runs_record = DGScheduledRunsNVRecord(self.can_interface, self.logger) + self.service_record = DGServiceNVRecord(self.can_interface, self.logger) + self.switches = DGSwitches(self.can_interface, self.logger) + self.system_record = DGSystemNVRecord(self.can_interface, self.logger) self.temperature_sensors = TemperatureSensors(self.can_interface, self.logger) - self.conductivity_sensors = ConductivitySensors(self.can_interface, self.logger) - self.concentrate_pumps = ConcentratePumps(self.can_interface, self.logger) - self.alarms = DGAlarms(self.can_interface, self.logger) - self.heat_disinfect = HeatDisinfect(self.can_interface, self.logger) self.thermistors = Thermistors(self.can_interface, self.logger) self.uv_reactors = UVReactors(self.can_interface, self.logger) - self.calibration_record = DGCalibrationNVRecord(self.can_interface, self.logger) - self.system_record = DGSystemNVRecord(self.can_interface, self.logger) - self.service_record = DGServiceNVRecord(self.can_interface, self.logger) - self.scheduled_runs_record = DGScheduledRunsNVRecord(self.can_interface, self.logger) self.valves = DGValves(self.can_interface, self.logger) self.voltages = DGVoltages(self.can_interface, self.logger) - self.flush = FlushMode(self.can_interface, self.logger) - self.chemical_disinfect = ChemicalDisinfect(self.can_interface, self.logger) - self.rtc = DGRTC(self.can_interface, self.logger) - self.switches = DGSwitches(self.can_interface, self.logger) + self.events = DGEvents(self.can_interface, self.logger) def get_version(self): """ @@ -221,16 +228,16 @@ """ return self.dg_logged_in - @_publish(["dg_logged_in"]) - def dg_set_logged_in_status(self, logged_in:bool=False): + @publish(["dg_logged_in"]) + def dg_set_logged_in_status(self, logged_in: bool = False): """ Callback for DG logged in status change. @param logged_in boolean logged in status for DG @return: none """ self.dg_logged_in = logged_in - @_publish(["dg_version", "fpga_version"]) + @publish(["dg_version", "fpga_version"]) def _handler_dg_version(self, message): """ Handler for response from DG regarding its version. @@ -265,7 +272,7 @@ self.fpga_version = f"ID: {fpga_id[0]} v{fpga_major[0]}.{fpga_minor[0]}.{fpga_lab[0]}" self.logger.debug(f"DG FPGA VERSION: {self.fpga_version}") - @_publish(["dg_operation_mode", "dg_operation_sub_mode"]) + @publish(["dg_operation_mode", "dg_operation_sub_mode"]) def _handler_dg_op_mode_sync(self, message): """ Handles published DG operation mode messages. Current DG operation mode Index: dialin/dg/ro_pump.py =================================================================== diff -u -rf8d379027a25b5497de67aabfb1e11b5e4fd6cbc -r89df6a25e4845ad234c1ffc71fb484b73d125b4c --- dialin/dg/ro_pump.py (.../ro_pump.py) (revision f8d379027a25b5497de67aabfb1e11b5e4fd6cbc) +++ dialin/dg/ro_pump.py (.../ro_pump.py) (revision 89df6a25e4845ad234c1ffc71fb484b73d125b4c) @@ -1,29 +1,30 @@ ########################################################################### # -# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # -# @file ro_pump.py +# @file ro_pump.py # -# @author (last) Peter Lucia -# @date (last) 10-Nov-2020 -# @author (original) Sean -# @date (original) 14-Apr-2020 +# @author (last) Quang Nguyen +# @date (last) 05-Aug-2021 +# @author (original) Sean +# @date (original) 14-Apr-2020 # ############################################################################ import struct -from ..utils.conversions import integer_to_bytearray, float_to_bytearray -from ..utils.checks import check_broadcast_interval_override_ms -from ..common.msg_defs import MsgIds, MsgFieldPositions -from .constants import RESET, NO_RESET -from ..protocols.CAN import (DenaliMessage, DenaliChannels) -from ..utils.base import _AbstractSubSystem, _publish, DialinEnum -from logging import Logger from enum import unique +from logging import Logger +from .constants import RESET, NO_RESET +from ..common.msg_defs import MsgIds, MsgFieldPositions +from ..protocols.CAN import DenaliMessage, DenaliChannels +from ..utils.base import AbstractSubSystem, publish, DialinEnum +from ..utils.checks import check_broadcast_interval_override_ms +from ..utils.conversions import integer_to_bytearray, float_to_bytearray + @unique class ROPumpStates(DialinEnum): RO_PUMP_OFF_STATE = 0 @@ -33,12 +34,13 @@ RO_PUMP_OPEN_LOOP_STATE = 4 -class DGROPump(_AbstractSubSystem): +class DGROPump(AbstractSubSystem): """ DGROPump Dialysate Generator (DG) Dialin API sub-class for RO pump related commands. """ + def __init__(self, can_interface, logger: Logger): """ DGROPump constructor @@ -60,6 +62,8 @@ self.ro_pump_state = 0.0 self.target_flow_lpm = 0.0 + self.temporary_flow_value = 0.0 + def get_target_pressure(self): """ Gets the target pressure @@ -92,7 +96,7 @@ """ return self.ro_pump_state - @_publish(["target_pressure_psi", "measured_flow_rate_lpm", "pwm_duty_cycle_pct", "ro_pump_state"]) + @publish(["target_pressure_psi", "measured_flow_rate_lpm", "pwm_duty_cycle_pct", "ro_pump_state"]) def _handler_ro_pump_sync(self, message): """ Handles published ro pump data messages. RO pump data are captured @@ -113,6 +117,10 @@ tgt_flow = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_5:MsgFieldPositions.END_POS_FIELD_5]))[0] + temp_current_flow = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6]))[0] + self.temporary_flow_value = temp_current_flow + self.target_pressure_psi = tgt_pres self.measured_flow_rate_lpm = flow self.pwm_duty_cycle_pct = pwm @@ -269,4 +277,3 @@ else: self.logger.debug("Timeout!!!!") return False - Index: dialin/protocols/CAN.py =================================================================== diff -u -r8474f8e345f165187d4dde17840575ee4e98a9b4 -r89df6a25e4845ad234c1ffc71fb484b73d125b4c --- dialin/protocols/CAN.py (.../CAN.py) (revision 8474f8e345f165187d4dde17840575ee4e98a9b4) +++ dialin/protocols/CAN.py (.../CAN.py) (revision 89df6a25e4845ad234c1ffc71fb484b73d125b4c) @@ -22,6 +22,7 @@ from can.interfaces import socketcan import math from time import sleep +from datetime import datetime import sys from logging import Logger import struct @@ -780,6 +781,7 @@ @return: None """ print( + datetime.now().time(), " " # can id f"{(complete_dialin_message['channel_id']):0{3}X}" " " # head tag Index: dialin/ui/hd_simulator.py =================================================================== diff -u -r8474f8e345f165187d4dde17840575ee4e98a9b4 -r89df6a25e4845ad234c1ffc71fb484b73d125b4c --- dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 8474f8e345f165187d4dde17840575ee4e98a9b4) +++ dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 89df6a25e4845ad234c1ffc71fb484b73d125b4c) @@ -54,6 +54,7 @@ super().__init__() HDSimulator.instance_count = HDSimulator.instance_count + 1 + self.checked_in = False self._log_manager = LogManager(log_level=log_level, log_filepath=self.__class__.__name__ + ".log") self.logger = self._log_manager.logger self.console_out = console_out @@ -68,6 +69,9 @@ channel_id = DenaliChannels.ui_to_hd_ch_id if auto_response: self.can_interface.register_receiving_publication_function(channel_id, + MsgIds.MSG_ID_UI_CHECK_IN.value, + self._handler_ui_first_check_in) + self.can_interface.register_receiving_publication_function(channel_id, MsgIds.MSG_ID_UI_INITIATE_TREATMENT_REQUEST.value, self._handler_ui_initiate_treatment) self.can_interface.register_receiving_publication_function(channel_id, @@ -304,6 +308,23 @@ self.cmd_send_uf_treatment_response(1, 0, uf_volume) + def _handler_ui_first_check_in(self, message)->None: + """ + Handler function to first check in to start the post + @param message: the check-in message + @return: None + """ + if self.checked_in: + return + + print("_handler_ui_first_check_in") + for i in range(20): + self.cmd_send_hd_post(i, True, False) + sleep(0.1) + self.cmd_send_hd_post(0, True, True) + self.cmd_send_hd_operation_mode(3, 0) + self.checked_in = True + def _handler_ui_initiate_treatment(self, message): """ Handler function to start a treatment @@ -1233,27 +1254,28 @@ self.can_interface.send(message, 0) - def cmd_send_treatment_rinseback_data(self, target: float, current: float, rate: int, - timeout_total: int, timeout_count_down: int) -> None: + def cmd_send_treatment_rinseback_data(self, vTarget, vCurrent, vRate, vTimeoutTotal, vTimeoutCountDown, vSafetyVolume): """ the rinseback state change Response message method | MSG | CAN ID | Box | Type | Ack | Src | Dst | Description | #1:(F32) | #2:(F32) | #3:(U32) | #4:(U32) | #5:(U32) | |:----:|:------:|:---:|:------:|:---:|:---:|:---:|:-----------: |:--: |:--: |:--: |:--: |:--: | |0x5600| 0x020 | 6 | 1Hz | N | HD | UI | Rinseback progress data | \ref Data::mTarget | \ref Data::mCurrent | \ref Data::mRate | \ref Data::mTimeoutTotal | \ref Data::mTimeoutCountDown | - @param target: (float) the target volume in mL - @param current: (float) the current volume in mL - @param rate: (int) the current flow rate in mL/min - @param timeout_total: (int) Total Timeout - @param timeout_count_down: (int) Current Timeout count down - @return: None + :param vTarget : (float) the target volume in mL + :param vCurrent : (float) the current volume in mL + :param vRate : (uint ) the current flow rate in mL/min + :param vTimeoutTotal : (uint ) Total Timeout + :param vTimeoutCountDown: (uint ) Current Timeout count down + :param vSafetyVolume : (float) Safety Volume + :return: None """ - payload = float_to_bytearray(target) - payload += float_to_bytearray(current) - payload += integer_to_bytearray(rate) - payload += integer_to_bytearray(timeout_total) - payload += integer_to_bytearray(timeout_count_down) + payload = float_to_bytearray(vTarget) + payload += float_to_bytearray(vCurrent) + payload += integer_to_bytearray(vRate) + payload += integer_to_bytearray(vTimeoutTotal) + payload += integer_to_bytearray(vTimeoutCountDown) + payload += float_to_bytearray(vSafetyVolume) message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_to_ui_ch_id, message_id=MsgIds.MSG_ID_HD_RINSEBACK_PROGRESS.value, Index: tests/unit_tests/test_ui_proxy.py =================================================================== diff -u -r1c49c6b02faa4e6a8bbcd85343ecb0a6d60343ae -r89df6a25e4845ad234c1ffc71fb484b73d125b4c --- tests/unit_tests/test_ui_proxy.py (.../test_ui_proxy.py) (revision 1c49c6b02faa4e6a8bbcd85343ecb0a6d60343ae) +++ tests/unit_tests/test_ui_proxy.py (.../test_ui_proxy.py) (revision 89df6a25e4845ad234c1ffc71fb484b73d125b4c) @@ -1,16 +1,16 @@ ########################################################################### # -# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # -# @file test_imports.py +# @file test_ui_proxy.py # -# @author (last) Peter Lucia -# @date (last) 20-Nov-2020 -# @author (original) Peter Lucia -# @date (original) 11-Aug-2020 +# @author (last) Peter Lucia +# @date (last) 24-May-2021 +# @author (original) Peter Lucia +# @date (original) 16-Dec-2020 # ############################################################################ import unittest