Index: leahi_dialin/dd/modules/temperature_sensors.py =================================================================== diff -u -recd89ae316cd2afa695dd4e93ac18b6004975efb -rb5aa0da384c5cc177f83d59aa221ae28881cd26a --- leahi_dialin/dd/modules/temperature_sensors.py (.../temperature_sensors.py) (revision ecd89ae316cd2afa695dd4e93ac18b6004975efb) +++ leahi_dialin/dd/modules/temperature_sensors.py (.../temperature_sensors.py) (revision b5aa0da384c5cc177f83d59aa221ae28881cd26a) @@ -27,12 +27,16 @@ @unique class DDTemperaturesNames(DialinEnum): - INLET_HEAT_EXCHANGER = 0 - OUTLET_HEAT_EXCHANGER = 1 - HYDRAULICS_PRIMARY_HEATER = 2 - TRIMMER_HEATER = 3 - BOARD_TEMP = 4 - BARO_TEMP_SENSOR = 5 + D1_TEMP = 0 # Heat exchanger Inlet temperature sensor + X6_TEMP = 1 # Heat exchanger Outlet temperature sensor + D4_TEMP = 2 # Hydraulics primary heater temperature sensor + D50_TEMP = 3 # Trimmer heater temperature sensor + BARO_TEMP = 4 # Barometric temperature sensor + BRD_TEMP = 5 # DD board temperature sensor ( thermistor ) + D17_COND = 6 # Bicarb only conductivity sensor temp + D27_COND = 7 # Acid and Bicarb mix conductivity sensor - 1 temp + D29_COND = 8 # Acid and Bicarb mix conductivity sensor - 2 temp + D43_COND = 9 # Spent dialysate conductivity sensor temp class DDTemperatureSensors(AbstractSubSystem): @@ -45,12 +49,16 @@ self.logger = logger # Dictionary of the temperature sensors self.dd_temperatures_timestamp = 0.0 - self.dd_temperatures = {DDTemperaturesNames.INLET_HEAT_EXCHANGER.name: 0.0, - DDTemperaturesNames.OUTLET_HEAT_EXCHANGER.name: 0.0, - DDTemperaturesNames.HYDRAULICS_PRIMARY_HEATER.name: 0.0, - DDTemperaturesNames.TRIMMER_HEATER.name: 0.0, - DDTemperaturesNames.BOARD_TEMP.name: 0.0, - DDTemperaturesNames.BARO_TEMP_SENSOR.name: 0.0,} + self.dd_temperatures = {DDTemperaturesNames.D1_TEMP.name: 0.0, + DDTemperaturesNames.X6_TEMP.name: 0.0, + DDTemperaturesNames.D4_TEMP.name: 0.0, + DDTemperaturesNames.D50_TEMP.name: 0.0, + DDTemperaturesNames.BARO_TEMP.name: 0.0, + DDTemperaturesNames.BRD_TEMP.name: 0.0, + DDTemperaturesNames.D17_COND.name: 0.0, + DDTemperaturesNames.D27_COND.name: 0.0, + DDTemperaturesNames.D29_COND.name: 0.0, + DDTemperaturesNames.D43_COND.name: 0.0,} if self.can_interface is not None: channel_id = DenaliChannels.dd_sync_broadcast_ch_id @@ -66,26 +74,38 @@ @param message: published temperature sensors data message @returns none """ - self.dd_temperatures[DDTemperaturesNames.INLET_HEAT_EXCHANGER.name] = struct.unpack('f', bytearray( + self.dd_temperatures[DDTemperaturesNames.D1_TEMP.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] - self.dd_temperatures[DDTemperaturesNames.OUTLET_HEAT_EXCHANGER.name] = struct.unpack('f', bytearray( + self.dd_temperatures[DDTemperaturesNames.X6_TEMP.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] - self.dd_temperatures[DDTemperaturesNames.HYDRAULICS_PRIMARY_HEATER.name] = struct.unpack('f', bytearray( + self.dd_temperatures[DDTemperaturesNames.D4_TEMP.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] - self.dd_temperatures[DDTemperaturesNames.TRIMMER_HEATER.name] = struct.unpack('f', bytearray( + self.dd_temperatures[DDTemperaturesNames.D50_TEMP.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4]))[0] - self.dd_temperatures[DDTemperaturesNames.BOARD_TEMP.name] = struct.unpack('f', bytearray( + self.dd_temperatures[DDTemperaturesNames.BARO_TEMP.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_5:MsgFieldPositions.END_POS_FIELD_5]))[0] - self.dd_temperatures[DDTemperaturesNames.BARO_TEMP_SENSOR.name] = struct.unpack('f', bytearray( + self.dd_temperatures[DDTemperaturesNames.BRD_TEMP.name] = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6]))[0] - self.dg_temperatures_timestamp = timestamp + self.dd_temperatures[DDTemperaturesNames.D17_COND.name] = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7]))[0] + self.dd_temperatures[DDTemperaturesNames.D27_COND.name] = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8]))[0] + + self.dd_temperatures[DDTemperaturesNames.D29_COND.name] = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9]))[0] + + self.dd_temperatures[DDTemperaturesNames.D43_COND.name] = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_10:MsgFieldPositions.END_POS_FIELD_10]))[0] + + self.dd_temperatures_timestamp = timestamp + def cmd_temperatures_data_broadcast_interval_override(self, ms: int, reset: int = NO_RESET) -> int: """ Constructs and sends broadcast time interval. @@ -196,10 +216,9 @@ def cmd_baro_sensor_read_counter_override(self, counter: int, reset: int = NO_RESET) -> int: """ - Constructs and sends the temperature value override command + Constructs and sends the barometer sensor read counter override command - @param sensor: unsigned int - sensor ID - @param counter: float - temperature value to override sensor with + @param counter: int - barometer sensor read counter value to override sensor with @param reset: integer - 1 to reset a previous override, 0 to override @return: 1 if successful, zero otherwise @@ -232,10 +251,9 @@ def cmd_baro_sensor_crc_override(self, crc: int, reset: int = NO_RESET) -> int: """ - Constructs and sends the temperature value override command + Constructs and sends the barometer sensor CRC override command - @param sensor: unsigned int - sensor ID - @param counter: float - temperature value to override sensor with + @param crc: int - the crc value to override sensor with @param reset: integer - 1 to reset a previous override, 0 to override @return: 1 if successful, zero otherwise Index: leahi_dialin/dd/modules/valves.py =================================================================== diff -u -rf9dd375900151a5daafe3b687187187645d5f1ab -rb5aa0da384c5cc177f83d59aa221ae28881cd26a --- leahi_dialin/dd/modules/valves.py (.../valves.py) (revision f9dd375900151a5daafe3b687187187645d5f1ab) +++ leahi_dialin/dd/modules/valves.py (.../valves.py) (revision b5aa0da384c5cc177f83d59aa221ae28881cd26a) @@ -39,38 +39,38 @@ @unique class DDValveNames(DialinEnum): - VHO = 0 # Valve Hydraulics Outlet (D14) - VTD = 1 # Valve Thermal Disinfect (D52) - VHB = 2 # Valve Hydraulics Bypass (D8) - VRP = 3 # Valve Rinse Port (D54) - VDR = 4 # Valve Drain (D53) - VDB2 = 5 # Valve DryBcarb Inlet (D65) - VP1 = 6 # Valve Purge 1 (D64) - VPT = 7 # Valve Pressure Test (D31) - VDB1 = 8 # Valve Dialyzer Bypass (D34) - VDI = 9 # Valve Dialyzer Inlet (D35) - VDO = 10 # Valve Dialyzer Outlet (D40) - VP2 = 11 # Valve Dialysate Out Purge 2 (D47) - VHI = 12 # Valve Hydraulics Inlet (D3) - VWI = 13 # Valve Water Inlet (M4) + D14_VHO = 0 # Valve Hydraulics Outlet (D14) + D52_VTD = 1 # Valve Thermal Disinfect (D52) + D8_VHB = 2 # Valve Hydraulics Bypass (D8) + D54_VRP = 3 # Valve Rinse Port (D54) + D53_VDR = 4 # Valve Drain (D53) + D65_VDB2 = 5 # Valve DryBcarb Inlet (D65) + D64_VP1 = 6 # Valve Purge 1 (D64) + D31_VPT = 7 # Valve Pressure Test (D31) + D34_VDB1 = 8 # Valve Dialyzer Bypass (D34) + D35_VDI = 9 # Valve Dialyzer Inlet (D35) + D40_VDO = 10 # Valve Dialyzer Outlet (D40) + D47_VP2 = 11 # Valve Dialysate Out Purge 2 (D47) + D3_VHI = 12 # Valve Hydraulics Inlet (D3) + M4_VWI = 13 # Valve Water Inlet (M4) RSRVD_SPACE1 = 14 # This space has been reserved RSRVD_SPACE2 = 15 # This space has been reserved - BCV1 = 16 # Balancing chamber Valve 1 (D23) - BCV2 = 17 # Balancing chamber Valve 2 (D19) - BCV3 = 18 # Balancing chamber Valve 3 (D25) - BCV7 = 19 # Balancing chamber Valve 7 (D26) - BCV5 = 20 # Balancing chamber Valve 5 (D24) - BCV6 = 21 # Balancing chamber Valve 6 (D20) - BCV4 = 22 # Balancing chamber Valve 4 (D21) - BCV8 = 23 # Balancing chamber Valve 8 (D22) - UFI1 = 24 # Ultrafiltration Valve 1 Inlet (D69) - UFI2 = 25 # Ultrafiltration Valve 2 Inlet (D71) - UFO1 = 26 # Ultrafiltration Valve 1 Outlet (D70) - UFO2 = 27 # Ultrafiltration Valve 2 Outlet (D72) + D23_BCV1 = 16 # Balancing chamber Valve 1 (D23) + D19_BCV2 = 17 # Balancing chamber Valve 2 (D19) + D25_BCV3 = 18 # Balancing chamber Valve 3 (D25) + D26_BCV7 = 19 # Balancing chamber Valve 7 (D26) + D24_BCV5 = 20 # Balancing chamber Valve 5 (D24) + D20_BCV6 = 21 # Balancing chamber Valve 6 (D20) + D21_BCV4 = 22 # Balancing chamber Valve 4 (D21) + D22_BCV8 = 23 # Balancing chamber Valve 8 (D22) + D69_UFI1 = 24 # Ultrafiltration Valve 1 Inlet (D69) + D71_UFI2 = 25 # Ultrafiltration Valve 2 Inlet (D71) + D70_UFO1 = 26 # Ultrafiltration Valve 1 Outlet (D70) + D72_UFO2 = 27 # Ultrafiltration Valve 2 Outlet (D72) class DDValves(AbstractSubSystem): """ - Dialysate Delivery (DG) interface for valve related commands. + Dialysate Delivery (DD) interface for valve related commands. """ @@ -101,36 +101,36 @@ self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_valves_sync) self.valve_states_all = 0x00000000 - self.valve_state_VDR = {"id": DDValveNames.VDR.value, "state": DEENERGIZED} - self.valve_state_VTD = {"id": DDValveNames.VTD.value, "state": DEENERGIZED} - self.valve_state_VHB = {"id": DDValveNames.VHB.value, "state": DEENERGIZED} - self.valve_state_VRP = {"id": DDValveNames.VRP.value, "state": DEENERGIZED} - self.valve_state_VHO = {"id": DDValveNames.VHO.value, "state": DEENERGIZED} - self.valve_state_VDB1 = {"id": DDValveNames.VDB1.value, "state": DEENERGIZED} - self.valve_state_VP1 = {"id": DDValveNames.VP1.value, "state": DEENERGIZED} - self.valve_state_VPT = {"id": DDValveNames.VPT.value, "state": DEENERGIZED} - self.valve_state_VDB2 = {"id": DDValveNames.VDB2.value, "state": DEENERGIZED} - self.valve_state_VDI = {"id": DDValveNames.VDI.value, "state": DEENERGIZED} - self.valve_state_VDO = {"id": DDValveNames.VDO.value, "state": DEENERGIZED} - self.valve_state_VP2 = {"id": DDValveNames.VP2.value, "state": DEENERGIZED} - self.valve_state_VHI = {"id": DDValveNames.VHI.value, "state": DEENERGIZED} - self.valve_state_VWI = {"id": DDValveNames.VWI.value, "state": DEENERGIZED} - self.valve_state_rsvrd1 = {"id": DDValveNames.RSRVD_SPACE1.value, "state": DEENERGIZED} - self.valve_state_rsvrd2 = {"id": DDValveNames.RSRVD_SPACE2.value, "state": DEENERGIZED} + self.d14_vho = {"id": DDValveNames.D14_VHO.value, "state": DEENERGIZED} + self.d52_vtd = {"id": DDValveNames.D52_VTD.value, "state": DEENERGIZED} + self.d8_vhb = {"id": DDValveNames.D8_VHB.value, "state": DEENERGIZED} + self.d54_vrp = {"id": DDValveNames.D54_VRP.value, "state": DEENERGIZED} + self.d53_vdr = {"id": DDValveNames.D53_VDR.value, "state": DEENERGIZED} + self.d65_vdb2 = {"id": DDValveNames.D65_VDB2.value, "state": DEENERGIZED} + self.d64_vp1 = {"id": DDValveNames.D64_VP1.value, "state": DEENERGIZED} + self.d31_vpt = {"id": DDValveNames.D31_VPT.value, "state": DEENERGIZED} + self.d34_vdb1 = {"id": DDValveNames.D34_VDB1.value, "state": DEENERGIZED} + self.d35_vdi = {"id": DDValveNames.D35_VDI.value, "state": DEENERGIZED} + self.d40_vdo = {"id": DDValveNames.D40_VDO.value, "state": DEENERGIZED} + self.d47_vp2 = {"id": DDValveNames.D47_VP2.value, "state": DEENERGIZED} + self.d3_vhi = {"id": DDValveNames.D3_VHI.value, "state": DEENERGIZED} + self.m4_vwi = {"id": DDValveNames.M4_VWI.value, "state": DEENERGIZED} + self.rsvrd1 = {"id": DDValveNames.RSRVD_SPACE1.value, "state": DEENERGIZED} + self.rsvrd2 = {"id": DDValveNames.RSRVD_SPACE2.value, "state": DEENERGIZED} - self.valve_state_BCV1 = {"id": DDValveNames.BCV1.value, "state": DEENERGIZED} - self.valve_state_BCV2 = {"id": DDValveNames.BCV2.value, "state": DEENERGIZED} - self.valve_state_BCV3 = {"id": DDValveNames.BCV3.value, "state": DEENERGIZED} - self.valve_state_BCV7 = {"id": DDValveNames.BCV4.value, "state": DEENERGIZED} - self.valve_state_BCV5 = {"id": DDValveNames.BCV5.value, "state": DEENERGIZED} - self.valve_state_BCV6 = {"id": DDValveNames.BCV6.value, "state": DEENERGIZED} - self.valve_state_BCV4 = {"id": DDValveNames.BCV7.value, "state": DEENERGIZED} - self.valve_state_BCV8 = {"id": DDValveNames.BCV8.value, "state": DEENERGIZED} + self.d23_bcv1 = {"id": DDValveNames.D23_BCV1.value, "state": DEENERGIZED} + self.d19_bcv2 = {"id": DDValveNames.D19_BCV2.value, "state": DEENERGIZED} + self.d25_bcv3 = {"id": DDValveNames.D25_BCV3.value, "state": DEENERGIZED} + self.d26_bcv7 = {"id": DDValveNames.D26_BCV7.value, "state": DEENERGIZED} + self.d24_bcv5 = {"id": DDValveNames.D24_BCV5.value, "state": DEENERGIZED} + self.d20_bcv6 = {"id": DDValveNames.D20_BCV6.value, "state": DEENERGIZED} + self.d21_bcv4 = {"id": DDValveNames.D21_BCV4.value, "state": DEENERGIZED} + self.d22_bcv8 = {"id": DDValveNames.D22_BCV8.value, "state": DEENERGIZED} - self.valve_state_UFI1 = {"id": DDValveNames.BCV1.value, "state": DEENERGIZED} - self.valve_state_UFI2 = {"id": DDValveNames.BCV1.value, "state": DEENERGIZED} - self.valve_state_UFI3 = {"id": DDValveNames.BCV1.value, "state": DEENERGIZED} - self.valve_state_UFI4 = {"id": DDValveNames.BCV1.value, "state": DEENERGIZED} + self.d69_ufi1 = {"id": DDValveNames.D69_UFI1.value, "state": DEENERGIZED} + self.d71_ufi2 = {"id": DDValveNames.D71_UFI2.value, "state": DEENERGIZED} + self.d70_ufo1 = {"id": DDValveNames.D70_UFO1.value, "state": DEENERGIZED} + self.d72_ufo2 = {"id": DDValveNames.D72_UFO2.value, "state": DEENERGIZED} # NOTE: The len function counts the enums with the same number only once. This is not the case in the DG valves @@ -147,34 +147,34 @@ @return: All valve states """ return [ - self.valve_state_VDR.get("state", None), - self.valve_state_VTD.get("state", None), - self.valve_state_VHB.get("state", None), - self.valve_state_VRP.get("state", None), - self.valve_state_VHO.get("state", None), - self.valve_state_VDB1.get("state", None), - self.valve_state_VP1.get("state", None), - self.valve_state_VPT.get("state", None), - self.valve_state_VDB2.get("state", None), - self.valve_state_VDI.get("state", None), - self.valve_state_VDO.get("state", None), - self.valve_state_VP2.get("state", None), - self.valve_state_VHI.get("state", None), - self.valve_state_VWI.get("state", None), - self.valve_state_rsvrd1.get("state", None), - self.valve_state_rsvrd2.get("state", None), - self.valve_state_BCV1.get("state", None), - self.valve_state_BCV2.get("state", None), - self.valve_state_BCV3.get("state", None), - self.valve_state_BCV7.get("state", None), - self.valve_state_BCV5.get("state", None), - self.valve_state_BCV6.get("state", None), - self.valve_state_BCV4.get("state", None), - self.valve_state_BCV8.get("state", None), - self.valve_state_UFI1.get("state", None), - self.valve_state_UFI2.get("state", None), - self.valve_state_UFI3.get("state", None), - self.valve_state_UFI4.get("state", None) + self.d14_vho.get("state", None), + self.d52_vtd.get("state", None), + self.d8_vhb.get("state", None), + self.d54_vrp.get("state", None), + self.d53_vdr.get("state", None), + self.d65_vdb2.get("state", None), + self.d64_vp1.get("state", None), + self.d31_vpt.get("state", None), + self.d34_vdb1.get("state", None), + self.d35_vdi.get("state", None), + self.d40_vdo.get("state", None), + self.d47_vp2.get("state", None), + self.d3_vhi.get("state", None), + self.m4_vwi.get("state", None), + self.rsvrd1.get("state", None), + self.rsvrd2.get("state", None), + self.d23_bcv1.get("state", None), + self.d19_bcv2.get("state", None), + self.d25_bcv3.get("state", None), + self.d26_bcv7.get("state", None), + self.d24_bcv5.get("state", None), + self.d20_bcv6.get("state", None), + self.d21_bcv4.get("state", None), + self.d22_bcv8.get("state", None), + self.d69_ufi1.get("state", None), + self.d71_ufi2.get("state", None), + self.d70_ufo1.get("state", None), + self.d72_ufo2.get("state", None) ] @staticmethod @@ -208,36 +208,36 @@ return DEENERGIZED @publish([ - "dg_valves_states_timestamp", + "dd_valves_states_timestamp", "valve_states_all", - "valve_state_VDR", - "valve_state_VTD", - "valve_state_VHB", - "valve_state_VRP", - "valve_state_VHO", - "valve_state_VDB1", - "valve_state_VP1", - "valve_state_VPT", - "valve_state_VDB2", - "valve_state_VDI", - "valve_state_VDO", - "valve_state_VP2", - "valve_state_VHI", - "valve_state_VWI", - "valve_state_rsvrd1", - "valve_state_rsvrd2", - "valve_state_BCV1", - "valve_state_BCV2", - "valve_state_BCV3", - "valve_state_BCV4", - "valve_state_BCV5", - "valve_state_BCV6", - "valve_state_BCV7", - "valve_state_BCV8", - "valve_state_UFI1", - "valve_state_UFI2", - "valve_state_UFI3", - "valve_state_UFI4", + "d14_vho", + "d52_vtd", + "d8_vhb", + "d54_vrp", + "d53_vdr", + "d65_vdb2", + "d64_vp1", + "d31_vpt", + "d34_vdb1", + "d35_vdi", + "d40_vdo", + "d47_vp2", + "d3_vhi", + "m4_vwi", + "rsvrd1", + "rsvrd2", + "d23_bcv1", + "d19_bcv2", + "d25_bcv3", + "d26_bcv7", + "d24_bcv5", + "d20_bcv6", + "d21_bcv4", + "d22_bcv8", + "d69_ufi1", + "d71_ufi2", + "d70_ufo1", + "d72_ufo2", "valve_states_enum" ]) def _handler_valves_sync(self, message, timestamp=0.0): @@ -253,38 +253,38 @@ vst = struct.unpack('H', bytearray(message['message'][self.START_POS_VALVES_STATES:self.END_POS_VALVES_STATES])) # Extract each valve state from U16 valves states using bit-masking - self.valve_state_VHO["state"] = self._binary_to_valve_state(vst[0] & 1) - self.valve_state_VTD["state"] = self._binary_to_valve_state(vst[0] & 2) - self.valve_state_VHB["state"] = self._binary_to_valve_state(vst[0] & 4) - self.valve_state_VRP["state"] = self._binary_to_valve_state(vst[0] & 8) - self.valve_state_VDR["state"] = self._binary_to_valve_state(vst[0] & 16) - self.valve_state_VDB2["state"] = self._binary_to_valve_state(vst[0] & 32) - self.valve_state_VP1["state"] = self._binary_to_valve_state(vst[0] & 64) - self.valve_state_VPT["state"] = self._binary_to_valve_state(vst[0] & 128) - self.valve_state_VDB1["state"] = self._binary_to_valve_state(vst[0] & 256) - self.valve_state_VDI["state"] = self._binary_to_valve_state(vst[0] & 512) - self.valve_state_VDO["state"] = self._binary_to_valve_state(vst[0] & 1024) - self.valve_state_VP2["state"] = self._binary_to_valve_state(vst[0] & 2048) - self.valve_state_VHI["state"] = self._binary_to_valve_state(vst[0] & 4096) - self.valve_state_VWI["state"] = self._binary_to_valve_state(vst[0] & 8192) - self.valve_state_rsvrd1["state"] = self._binary_to_valve_state(vst[0] & 16384) - self.valve_state_rsvrd2["state"] = self._binary_to_valve_state(vst[0] & 32768) + self.d14_vho["state"] = self._binary_to_valve_state(vst[0] & 1) + self.d52_vtd["state"] = self._binary_to_valve_state(vst[0] & 2) + self.d8_vhb["state"] = self._binary_to_valve_state(vst[0] & 4) + self.d54_vrp["state"] = self._binary_to_valve_state(vst[0] & 8) + self.d53_vdr["state"] = self._binary_to_valve_state(vst[0] & 16) + self.d65_vdb2["state"] = self._binary_to_valve_state(vst[0] & 32) + self.d64_vp1["state"] = self._binary_to_valve_state(vst[0] & 64) + self.d31_vpt["state"] = self._binary_to_valve_state(vst[0] & 128) + self.d34_vdb1["state"] = self._binary_to_valve_state(vst[0] & 256) + self.d35_vdi["state"] = self._binary_to_valve_state(vst[0] & 512) + self.d40_vdo["state"] = self._binary_to_valve_state(vst[0] & 1024) + self.d47_vp2["state"] = self._binary_to_valve_state(vst[0] & 2048) + self.d3_vhi["state"] = self._binary_to_valve_state(vst[0] & 4096) + self.m4_vwi["state"] = self._binary_to_valve_state(vst[0] & 8192) + self.rsvrd1["state"] = self._binary_to_valve_state(vst[0] & 16384) + self.rsvrd2["state"] = self._binary_to_valve_state(vst[0] & 32768) bcv = struct.unpack('B', bytearray(message['message'][self.START_POS_BCV_VALVES_STATES:self.END_POS_BCV_VALVES_STATES])) - self.valve_state_BCV1["state"] = self._binary_to_valve_state(bcv[0] & 1) - self.valve_state_BCV2["state"] = self._binary_to_valve_state(bcv[0] & 2) - self.valve_state_BCV3["state"] = self._binary_to_valve_state(bcv[0] & 4) - self.valve_state_BCV7["state"] = self._binary_to_valve_state(bcv[0] & 8) - self.valve_state_BCV5["state"] = self._binary_to_valve_state(bcv[0] & 16) - self.valve_state_BCV6["state"] = self._binary_to_valve_state(bcv[0] & 32) - self.valve_state_BCV4["state"] = self._binary_to_valve_state(bcv[0] & 64) - self.valve_state_BCV8["state"] = self._binary_to_valve_state(bcv[0] & 128) + self.d23_bcv1["state"] = self._binary_to_valve_state(bcv[0] & 1) + self.d19_bcv2["state"] = self._binary_to_valve_state(bcv[0] & 2) + self.d25_bcv3["state"] = self._binary_to_valve_state(bcv[0] & 4) + self.d26_bcv7["state"] = self._binary_to_valve_state(bcv[0] & 8) + self.d24_bcv5["state"] = self._binary_to_valve_state(bcv[0] & 16) + self.d20_bcv6["state"] = self._binary_to_valve_state(bcv[0] & 32) + self.d21_bcv4["state"] = self._binary_to_valve_state(bcv[0] & 64) + self.d22_bcv8["state"] = self._binary_to_valve_state(bcv[0] & 128) ufi = struct.unpack('B', bytearray(message['message'][self.START_POS_UFI_VALVES_STATES:self.END_POS_UFI_VALVES_STATES])) - self.valve_state_UFI1["state"] = self._binary_to_valve_state(ufi[0] & 1) - self.valve_state_UFI2["state"] = self._binary_to_valve_state(ufi[0] & 2) - self.valve_state_UFI3["state"] = self._binary_to_valve_state(ufi[0] & 4) - self.valve_state_UFI4["state"] = self._binary_to_valve_state(ufi[0] & 8) + self.d69_ufi1["state"] = self._binary_to_valve_state(ufi[0] & 1) + self.d71_ufi2["state"] = self._binary_to_valve_state(ufi[0] & 2) + self.d70_ufo1["state"] = self._binary_to_valve_state(ufi[0] & 4) + self.d72_ufo2["state"] = self._binary_to_valve_state(ufi[0] & 8) start = self.END_POS_UFI_VALVES_STATES end = start + 1 @@ -300,7 +300,7 @@ """ Constructs and sends the valve sensed state override command. Constraints: - Must be logged into DG. + Must be logged into DD. Given valve ID must be one of the valve IDs listed below. @param valve: unsigned int - valve ID @@ -335,7 +335,7 @@ """ Constructs and sends the valve state override command. Constraints: - Must be logged into DG. + Must be logged into DD. Given valve ID must be one of the valve IDs listed below. @param valve: unsigned int - valve ID Index: leahi_dialin/dd/proxies/ro_proxy.py =================================================================== diff -u -rda86f07bb7c8be93da8bbf9fff716f43106d0713 -rb5aa0da384c5cc177f83d59aa221ae28881cd26a --- leahi_dialin/dd/proxies/ro_proxy.py (.../ro_proxy.py) (revision da86f07bb7c8be93da8bbf9fff716f43106d0713) +++ leahi_dialin/dd/proxies/ro_proxy.py (.../ro_proxy.py) (revision b5aa0da384c5cc177f83d59aa221ae28881cd26a) @@ -5,7 +5,7 @@ # 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 buttons.py +# @file ro_proxy.py # # @author (last) Micahel Garthwaite # @date (last) 18-Aug-2023 @@ -29,7 +29,7 @@ def __init__(self, can_interface: DenaliCanMessenger, logger: Logger): """ - HD_Buttons constructor + ROProxy constructor @param can_interface: the Denali CAN interface object """ @@ -42,9 +42,9 @@ def cmd_dd_send_ro_start_stop_request(self, start: bool = 0, ro_rate: float = 0): """ - Constructs and sends a DG command response to the HD. + Constructs and sends a DD command response to the RO. - @param: cmd_id: The DG command ID + @param: cmd_id: The DD command ID @param: rejected: 0 for acceptance, 1 for rejection @param: rejection_code: The rejection reason. @return: none Index: leahi_dialin/dd/proxies/td_proxy.py =================================================================== diff -u -rf9dd375900151a5daafe3b687187187645d5f1ab -rb5aa0da384c5cc177f83d59aa221ae28881cd26a --- leahi_dialin/dd/proxies/td_proxy.py (.../td_proxy.py) (revision f9dd375900151a5daafe3b687187187645d5f1ab) +++ leahi_dialin/dd/proxies/td_proxy.py (.../td_proxy.py) (revision b5aa0da384c5cc177f83d59aa221ae28881cd26a) @@ -5,7 +5,7 @@ # 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 buttons.py +# @file td_proxy.py # # @author (last) Micahel Garthwaite # @date (last) 18-Aug-2023 @@ -29,7 +29,7 @@ def __init__(self, can_interface: DenaliCanMessenger, logger: Logger): """ - HD_Buttons constructor + TDProxy constructor @param can_interface: the Denali CAN interface object """ @@ -60,6 +60,12 @@ "dialysate_delivery_request_bicarb", ]) def _handler_dialysate_delivery_request_response(self, message, timestamp=0.0): + """ + Handles published dialysate delivery request response data messages. + + @param message: published dialysate delivery request response data message + @return: None + """ self.dialysate_delivery_request_start = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] self.dialysate_delivery_request_dial_rate = struct.unpack('f', bytearray(