Index: leahi_dialin/ui/dd_messaging.py =================================================================== diff -u -r29ea9a036d8c311257581ac1ffb8a390df6f3ec8 -r1f2bf6d939eb4033dbedb7d7005494cc12fccbc6 --- leahi_dialin/ui/dd_messaging.py (.../dd_messaging.py) (revision 29ea9a036d8c311257581ac1ffb8a390df6f3ec8) +++ leahi_dialin/ui/dd_messaging.py (.../dd_messaging.py) (revision 1f2bf6d939eb4033dbedb7d7005494cc12fccbc6) @@ -24,7 +24,7 @@ def info(a1, a2): pass - self.can_interface = CAN.DenaliCanMessenger(can_interface=self.can_Channel, logger=fakeLogger() ) + self.can_interface = CAN.CanMessenger(can_interface=self.can_Channel, logger=fakeLogger() ) self.can_interface.start() if self.can_interface is not None: @@ -52,8 +52,8 @@ payload += conversions.float_to_bytearray(D43 ) payload += conversions.float_to_bytearray(D74 ) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DD_CONDUCTIVITY_DATA.value, payload=payload) @@ -93,8 +93,8 @@ payload += conversions.float_to_bytearray (D51_spend_pressure ) payload += conversions.unsigned_integer_to_bytearray(is_dial_good ) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DD_GEN_DIALYSATE_MODE_DATA.value, payload=payload) @@ -129,8 +129,8 @@ payload += conversions.unsigned_byte_to_bytearray (fpga_lab ) payload += conversions.unsigned_integer_to_bytearray(compatibility_rev) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DD_VERSION_RESPONSE.value, payload=payload) @@ -146,8 +146,8 @@ # TODO: replace with proper payload and message ID once message is defined payload = bytes(serial, 'ascii') + b'\x00' - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DD_SERIAL_RESPONSE.value, payload=payload) @@ -162,14 +162,13 @@ d6Level (int ): floater switch low, medium and high status d63Level (int ): bicarb level low or high status d46Level (int ): Spent dialysate air separation chamber level low or high status - """ payload = conversions.unsigned_integer_to_bytearray(d6Level ) payload += conversions.unsigned_integer_to_bytearray(d63Level ) payload += conversions.unsigned_integer_to_bytearray(d46Level ) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DD_LEVEL_DATA.value, payload=payload) @@ -206,7 +205,6 @@ d51PresTemp (float): Spent Dialysate temperature d18PresTemp (float): Fresh Dialysate temperature d41PresTemp (float): Transmembrane temperature - """ payload = conversions.float_to_bytearray(m1Pressure ) payload += conversions.float_to_bytearray(m3Pressure ) @@ -223,8 +221,8 @@ payload += conversions.float_to_bytearray(d18PresTemp ) payload += conversions.float_to_bytearray(d41PresTemp ) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DD_PRESSURES_DATA.value, payload=payload) @@ -263,7 +261,6 @@ d50AvgTemp (float) : D50 moving average temperature value d28AvgTemp (float) : D28 moving average temperature value d30AvgTemp (float) : D30 moving average temperature value - """ payload = conversions.float_to_bytearray(d1Temp ) payload += conversions.float_to_bytearray(x6Temp ) @@ -281,8 +278,8 @@ payload += conversions.float_to_bytearray(d28AvgTemp ) payload += conversions.float_to_bytearray(d30AvgTemp ) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DD_TEMPERATURE_DATA.value, payload=payload) @@ -325,7 +322,6 @@ dbg7 (optional) (float) : D50 moving average temperature value dbg8 (optional) (float) : D28 moving average temperature value dbg9 (optional) (float) : D30 moving average temperature value - """ payload = conversions.float_to_bytearray (d5_HeaterDC ) payload += conversions.float_to_bytearray (d45_HeaterDC ) @@ -345,8 +341,8 @@ payload += conversions.float_to_bytearray (dbg8 ) payload += conversions.float_to_bytearray (dbg9 ) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DD_HEATERS_DATA.value, payload=payload) @@ -405,7 +401,6 @@ d76PumpMeasuredRevCount (int ) : Concentrate pump D76_Pump measured revolution cou d76PumpState (int ) : Concentrate pump D76_Pump current state d76PumpPulseUS (float) : Concentrate pump D76_Pump pulse in microseconds - """ payload = conversions.float_to_bytearray (d11PumpCurrentSetSpeed ) payload += conversions.float_to_bytearray (d11PumpMeasuredSpeed ) @@ -433,8 +428,8 @@ payload += conversions.unsigned_integer_to_bytearray(d76PumpState ) payload += conversions.float_to_bytearray (d76PumpPulseUS ) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DD_CONCENTRATE_PUMP_DATA.value, payload=payload) @@ -484,7 +479,6 @@ d48PumpDirErrCnt (int ) : Dialysate pump D10_Pump park fault status d12PumpMeasuredDir (int ) : Dialysate pump D76_Pump target speed d48PumpMeasuredDir (int ) : Dialysate pump D76_Pump current set speed - """ payload = conversions.float_to_bytearray (d12PumpTargetRPM ) payload += conversions.float_to_bytearray (d48PumpTargetRPM ) @@ -507,8 +501,8 @@ payload += conversions.unsigned_integer_to_bytearray(d12PumpMeasuredDir ) payload += conversions.unsigned_integer_to_bytearray(d48PumpMeasuredDir ) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DIALYSATE_PUMPS_DATA.value, payload=payload) @@ -519,12 +513,11 @@ Broadcasts the current DD Level Sensor data (Msg ID: 0x60, 96) Args: blood_leak (int ): Blood Leak status - """ payload = conversions.unsigned_integer_to_bytearray(blood_leak ) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DD_BLOOD_LEAK_DATA.value, payload=payload) @@ -540,8 +533,8 @@ payload = conversions.integer_to_bytearray(1 if vRejectionReason == 0 else 0) payload += conversions.integer_to_bytearray(vRejectionReason) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DD_DATE_AND_TIME_RESPONSE.value, payload=payload) self.can_interface.send(message, 0) @@ -559,53 +552,77 @@ D40_VALV : bool, D47_VALV : bool, D3_VALV : bool, - M4_VALV : bool, + D80_VALV : bool, + D81_VALV : bool, RSRVD_SPACE1 : bool, - RSRVD_SPACE2 : bool, D23_VALV : bool, D19_VALV : bool, D25_VALV : bool, - D26_VALV : bool, + D21_VALV : bool, D24_VALV : bool, D20_VALV : bool, - D21_VALV : bool, + D26_VALV : bool, D22_VALV : bool, - D69_VALV : bool, - D71_VALV : bool, - D70_VALV : bool, - D72_VALV : bool, + D79_PMP_VALV : bool, + SPARE1_VALV : bool, + SPARE2_VALV : bool, + SPARE3_VALV : bool, + SPARE4_VALV : bool, + SPARE5_VALV : bool, + SPARE6_VALV : bool, + SPARE7_VALV : bool, + M4_VALV : bool, + M12_VALV : bool, + P11_VALV : bool, + P33_VALV : bool, + P34_VALV : bool, + P37_VALV : bool, + P39_VALV : bool, + P6_VALV : bool, valvesensedState: list): """ Broadcasts the current DD Valve data (Msg ID: 0x1B, 27) Args: - D14_VALV (bool ): Valve Hydraulics Outlet (D14) - D52_VALV (bool ): Valve Thermal Disinfect (D52) - D8_VALV (bool ): Valve Hydraulics Bypass (D8) - D54_VALV (bool ): Valve Rinse Port (D54) - D53_VALV (bool ): Valve Drain (D53) - D34_VALV (bool ): Valve Dialyzer Bypass (D34) - D64_VALV (bool ): Valve Purge 1 (D64) - D31_VALV (bool ): Valve Pressure Test (D31) - D65_VALV (bool ): Valve DryBcarb Inlet (D65) - D35_VALV (bool ): Valve Dialyzer Inlet (D35) - D40_VALV (bool ): Valve Dialyzer Outlet (D40) - D47_VALV (bool ): Valve Dialysate Out Purge 2 (D47) - D3_VALV (bool ): Valve Hydraulics Inlet (D3) - M4_VALV (bool ): Valve Water Inlet (M4) - RSRVD_SPACE1 (bool ): This space has been reserved - RSRVD_SPACE2 (bool ): This space has been reserved - D23_VALV (bool ): Balancing chamber Valve 1 (D23) - D19_VALV (bool ): Balancing chamber Valve 2 (D19) - D25_VALV (bool ): Balancing chamber Valve 3 (D25) - D26_VALV (bool ): Balancing chamber Valve 7 (D26) - D24_VALV (bool ): Balancing chamber Valve 5 (D24) - D20_VALV (bool ): Balancing chamber Valve 6 (D20) - D21_VALV (bool ): Balancing chamber Valve 4 (D21) - D22_VALV (bool ): Balancing chamber Valve 8 (D22) - D69_VALV (bool ): Ultrafiltration Valve 1 Inlet (D69) - D71_VALV (bool ): Ultrafiltration Valve 2 Inlet (D71) - D70_VALV (bool ): Ultrafiltration Valve 1 Outlet (D70) - D72_VALV (bool ): Ultrafiltration Valve 2 Outlet (D72) + D14_VALV (bool ): Valve Hydraulics Outlet (D14) + D52_VALV (bool ): Valve Thermal Disinfect (D52) + D8_VALV (bool ): Valve Hydraulics Bypass (D8) + D54_VALV (bool ): Valve Rinse Port (D54) + D53_VALV (bool ): Valve Drain (D53) + D34_VALV (bool ): Valve Dialyzer Bypass (D34) + D64_VALV (bool ): Valve Purge 1 (D64) + D31_VALV (bool ): Valve Pressure Test (D31) + D65_VALV (bool ): Valve DryBcarb Inlet (D65) + D35_VALV (bool ): Valve Dialyzer Inlet (D35) + D40_VALV (bool ): Valve Dialyzer Outlet (D40) + D47_VALV (bool ): Valve Dialysate Out Purge 2 (D47) + D3_VALV (bool ): Valve Hydraulics Inlet (D3) + D80_VALV (bool ): Valve Dry Bicarb (D80) + D81_VALV (bool ): Valve De-scaler (D81) + RSRVD_SPACE1 (bool ): This space has been reserved + D23_VALV (bool ): Balancing chamber Valve 1 (D23) + D19_VALV (bool ): Balancing chamber Valve 2 (D19) + D25_VALV (bool ): Balancing chamber Valve 3 (D25) + D21_VALV (bool ): Balancing chamber Valve 4 (D21) + D24_VALV (bool ): Balancing chamber Valve 5 (D24) + D20_VALV (bool ): Balancing chamber Valve 6 (D20) + D26_VALV (bool ): Balancing chamber Valve 7 (D26) + D22_VALV (bool ): Balancing chamber Valve 8 (D22) + D79_PMP_VALV (bool ): D79 pump mapped to spare valve 0 + SPARE1_VALV (bool ): Spare Valve 1 + SPARE2_VALV (bool ): Spare Valve 2 + SPARE3_VALV (bool ): Spare Valve 3 + SPARE4_VALV (bool ): Spare Valve 4 + SPARE5_VALV (bool ): Spare Valve 5 + SPARE6_VALV (bool ): Spare Valve 6 + SPARE7_VALV (bool ): Spare Valve 7 + M4_VALV (bool ): First IO valve (M4) + M12_VALV (bool ): Last IO valve IO valve (M12) + P11_VALV (bool ): First FP Valve (P11) + P33_VALV (bool ): Valve (P33) + P34_VALV (bool ): Valve (P34) + P37_VALV (bool ): Valve (P37) + P39_VALV (bool ): Valve (P39) + P6_VALV (bool ): Last FP Valve (P6) valvesensedState[28] (list[int] ): Sense state of valves """ hydraulic_valves = (D14_VALV << 0 )|\ @@ -621,37 +638,47 @@ (D40_VALV << 10)|\ (D47_VALV << 11)|\ (D3_VALV << 12)|\ - (M4_VALV << 13)|\ - (RSRVD_SPACE1 << 14)|\ - (RSRVD_SPACE2 << 15) + (D80_VALV << 13)|\ + (D81_VALV << 14)|\ + (RSRVD_SPACE1 << 15) - balancing_chamber_valves = (D23_VALV << 0 ) | \ - (D19_VALV << 1 )|\ - (D25_VALV << 2 )|\ - (D26_VALV << 3 )|\ - (D24_VALV << 4 )|\ - (D20_VALV << 5 )|\ - (D21_VALV << 6 )|\ - (D22_VALV << 7 ) + balancing_chamber_valves = (D23_VALV << 0 )| \ + (D19_VALV << 1 )|\ + (D25_VALV << 2 )|\ + (D21_VALV << 3 )|\ + (D24_VALV << 4 )|\ + (D20_VALV << 5 )|\ + (D26_VALV << 6 )|\ + (D22_VALV << 7 ) - # final 4 bits are reserved and left as 0 - ultrafiltration_valves = (D69_VALV << 0 )|\ - (D71_VALV << 1 )|\ - (D70_VALV << 2 )|\ - (D72_VALV << 3 )|\ - (0 << 4 )|\ - (0 << 5 )|\ - (0 << 6 )|\ - (0 << 7 ) + spare_valves = (D79_PMP_VALV << 0 )|\ + (SPARE1_VALV << 1 )|\ + (SPARE2_VALV << 2 )|\ + (SPARE3_VALV << 3 )|\ + (SPARE4_VALV << 4 )|\ + (SPARE5_VALV << 5 )|\ + (SPARE6_VALV << 6 )|\ + (SPARE7_VALV << 7 ) + ioFP_valves = (M4_VALV << 0 )|\ + (M12_VALV << 1 )|\ + (P11_VALV << 2 )|\ + (P33_VALV << 3 )|\ + (P34_VALV << 4 )|\ + (P37_VALV << 5 )|\ + (P39_VALV << 6 )|\ + (P6_VALV << 7 ) + + payload = conversions.unsigned_short_to_bytearray(hydraulic_valves ) payload += conversions.unsigned_byte_to_bytearray (balancing_chamber_valves ) - payload += conversions.unsigned_byte_to_bytearray (ultrafiltration_valves ) + payload += conversions.unsigned_byte_to_bytearray (spare_valves ) + payload += conversions.unsigned_byte_to_bytearray (ioFP_valves ) for i in range(len(valvesensedState)): payload += conversions.unsigned_byte_to_bytearray(valvesensedState[i]) - message = CAN.DenaliMessage.build_message( - channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id, + message = CAN.CanMessage.build_message( + channel_id=CAN.CanChannels.dd_sync_broadcast_ch_id, message_id=msg_ids.MsgIds.MSG_ID_DD_VALVES_STATES_DATA.value, payload=payload)