Index: dialin/common/msg_ids.py =================================================================== diff -u -r09cbb74248e9fb44ea81b9a2131d81e96e4a9d8d -rb70eb3eb8264ba114ee8ddb968c697ac7da5b4e9 --- dialin/common/msg_ids.py (.../msg_ids.py) (revision 09cbb74248e9fb44ea81b9a2131d81e96e4a9d8d) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision b70eb3eb8264ba114ee8ddb968c697ac7da5b4e9) @@ -7,8 +7,8 @@ # # @file msg_ids.py # -# @author (last) Dara Navaei -# @date (last) 10-Nov-2021 +# @author (last) Sean Nash +# @date (last) 12-Nov-2021 # @author (original) Peter Lucia # @date (original) 06-Apr-2021 # @@ -189,6 +189,7 @@ MSG_ID_DG_DIALYSATE_FLOW_METER_DATA = 0xA6 MSG_ID_DG_ALARM_INFO = 0xA7 MSG_ID_CAN_ERROR_COUNT = 0X999 + MSG_ID_TESTER_LOGIN_REQUEST = 0X8000 MSG_ID_DIAL_OUT_FLOW_SET_PT_OVERRIDE = 0X8001 MSG_ID_OFF_BUTTON_STATE_OVERRIDE = 0X8002 @@ -309,6 +310,7 @@ MSG_ID_HD_BLOCK_MESSAGE_TRANSMISSION = 0x8076 MSG_ID_HD_SYRINGE_PUMP_FORCE_SENSOR_DAC_CALIBRATE = 0x8077 MSG_ID_HD_STOP_RTC_CLOCK = 0x8078 + MSG_ID_DG_TESTER_LOGIN_REQUEST = 0XA000 MSG_ID_DG_ALARM_STATE_OVERRIDE = 0XA001 MSG_ID_DG_WATCHDOG_TASK_CHECKIN_OVERRIDE = 0XA002 @@ -374,11 +376,11 @@ MSG_ID_DG_FLUSH_PUBLISH_INTERVAL_OVERRIDE = 0XA041 MSG_ID_FILTER_FLUSH_TIME_PERIOD_OVERRIDE = 0XA042 MSG_ID_DG_FANS_RPM_OVERRIDE = 0XA043 - MSG_ID_DIALYSATE_FLOW_SEND_INTERVAL_OVERRIDE = 0xA044 + MSG_ID_DIALYSATE_FLOW_SEND_INTERVAL_OVERRIDE = 0XA044 MSG_ID_DG_STOP_RTC_CLOCK = 0XA045 MSG_ID_DG_DRAIN_PUMP_MEASURED_RPM_OVERRIDE = 0XA046 MSG_ID_DG_SUPER_CLEAR_ALARMS_CMD = 0XA047 - MSG_ID_DG_ALARM_INFO_SEND_INTERVAL_OVERRIDE = 0xA048 + MSG_ID_DG_ALARM_INFO_SEND_INTERVAL_OVERRIDE = 0XA048 MSG_ID_HD_DEBUG_EVENT = 0XFFF1 MSG_ID_DG_DEBUG_EVENT = 0XFFF2 Index: dialin/dg/dialysate_generator.py =================================================================== diff -u -r09cbb74248e9fb44ea81b9a2131d81e96e4a9d8d -rb70eb3eb8264ba114ee8ddb968c697ac7da5b4e9 --- dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 09cbb74248e9fb44ea81b9a2131d81e96e4a9d8d) +++ dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision b70eb3eb8264ba114ee8ddb968c697ac7da5b4e9) @@ -7,8 +7,8 @@ # # @file dialysate_generator.py # -# @author (last) Dara Navaei -# @date (last) 29-Oct-2021 +# @author (last) Sean Nash +# @date (last) 12-Nov-2021 # @author (original) Peter Lucia # @date (original) 02-Apr-2020 # Index: dialin/dg/events.py =================================================================== diff -u -r236a8c3d344355c862eb758e06f6a5008e88ba8c -rb70eb3eb8264ba114ee8ddb968c697ac7da5b4e9 --- dialin/dg/events.py (.../events.py) (revision 236a8c3d344355c862eb758e06f6a5008e88ba8c) +++ dialin/dg/events.py (.../events.py) (revision b70eb3eb8264ba114ee8ddb968c697ac7da5b4e9) @@ -8,7 +8,7 @@ # @file events.py # # @author (last) Dara Navaei -# @date (last) 01-Nov-2021 +# @date (last) 12-Nov-2021 # @author (original) Dara Navaei # @date (original) 12-Oct-2021 # @@ -156,8 +156,6 @@ # Convert the event ID to enum event_state_name = DGEventList(event_id).name - #print(event_state_name, event_data_1, event_data_2) - # Check if the event state name is operation mode change. If it is, get the name of the operation modes # from the op modes enum class if event_state_name == DGEventList.DG_EVENT_OP_MODE_CHANGE.name: Index: dialin/dg/ro_pump.py =================================================================== diff -u -r09cbb74248e9fb44ea81b9a2131d81e96e4a9d8d -rb70eb3eb8264ba114ee8ddb968c697ac7da5b4e9 --- dialin/dg/ro_pump.py (.../ro_pump.py) (revision 09cbb74248e9fb44ea81b9a2131d81e96e4a9d8d) +++ dialin/dg/ro_pump.py (.../ro_pump.py) (revision b70eb3eb8264ba114ee8ddb968c697ac7da5b4e9) @@ -59,7 +59,7 @@ self.target_pressure_psi = 0.0 self.measured_flow_rate_lpm = 0.0 self.pwm_duty_cycle_pct = 0.0 - self.ro_pump_state = 0.0 + self.ro_pump_state = 0 self.target_flow_lpm = 0.0 self.feedback_duty_cycle_pct = 0.0 @@ -106,25 +106,20 @@ @return: None """ - tgt_pres = struct.unpack('f', bytearray( + self.target_pressure_psi = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_1:MsgFieldPositions.END_POS_FIELD_1]))[0] - flow = struct.unpack('f', bytearray( + self.measured_flow_rate_lpm = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_2:MsgFieldPositions.END_POS_FIELD_2]))[0] - pwm = struct.unpack('f', bytearray( + self.pwm_duty_cycle_pct = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_3:MsgFieldPositions.END_POS_FIELD_3]))[0] ro_state = struct.unpack('i', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_4:MsgFieldPositions.END_POS_FIELD_4]))[0] - tgt_flow = struct.unpack('f', bytearray( + self.target_flow_lpm = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_5:MsgFieldPositions.END_POS_FIELD_5]))[0] - feedback_dc = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7]))[0] + self.feedback_duty_cycle_pct = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6]))[0] - self.target_pressure_psi = tgt_pres - self.measured_flow_rate_lpm = flow - self.pwm_duty_cycle_pct = pwm - self.ro_pump_state = ROPumpStates(ro_state).name if ROPumpStates.has_value(ro_state) else 'State Unknown' - self.target_flow_lpm = tgt_flow - self.feedback_duty_cycle_pct = feedback_dc + self.ro_pump_state = ROPumpStates(ro_state).name def cmd_ro_pump_duty_cycle_pct(self, duty: float) -> int: """ Index: tests/dg_heat_and_chemical_disinfect_test.py =================================================================== diff -u -r09cbb74248e9fb44ea81b9a2131d81e96e4a9d8d -rb70eb3eb8264ba114ee8ddb968c697ac7da5b4e9 --- tests/dg_heat_and_chemical_disinfect_test.py (.../dg_heat_and_chemical_disinfect_test.py) (revision 09cbb74248e9fb44ea81b9a2131d81e96e4a9d8d) +++ tests/dg_heat_and_chemical_disinfect_test.py (.../dg_heat_and_chemical_disinfect_test.py) (revision b70eb3eb8264ba114ee8ddb968c697ac7da5b4e9) @@ -8,7 +8,7 @@ # @file dg_heat_and_chemical_disinfect_test.py # # @author (last) Dara Navaei -# @date (last) 04-Nov-2021 +# @date (last) 12-Nov-2021 # @author (original) Dara Navaei # @date (original) 02-May-2021 # @@ -28,6 +28,7 @@ from dialin.hd.temperatures import HDTemperaturesNames from dialin.common.hd_defs import HDOpModes, HDOpSubModes from dialin.common.dg_defs import DGEventList +from dialin.common.hd_defs import HDEventList from time import sleep from datetime import datetime import sys @@ -70,8 +71,10 @@ def get_hd_run_info(): - info = ('HD_op_mode, {}, HD_sub_mode, {}, '.format(HDOpModes(hd.hd_operation_mode).name, - hd.hd_operation_sub_mode)) + info = ('HD_op_mode, {}, HD_sub_mode, {}, Op, {}, Sub, {}, '.format(HDOpModes(hd.hd_operation_mode).name, + hd.hd_operation_sub_mode, + hd.hd_events.get_hd_events(HDEventList(1).value), + hd.hd_events.get_hd_events(HDEventList(2).value))) return info @@ -426,6 +429,8 @@ def collect_treatment_data(): f = open("/home/fw/projects/dialin/tests/treatment_run.log", "w") + #dg.cmd_dg_software_reset_request() + try: while True: hd_run = get_hd_run_info() @@ -449,6 +454,22 @@ f.close() +def collect_hd_treatment(): + f = open("/home/fw/projects/dialin/tests/treatment_run_hd.log", "w") + + hd.cmd_hd_software_reset_request() + + try: + while True: + + sleep(1) + except KeyboardInterrupt: + events = hd.hd_events.get_hd_events(2, 0) + for event in events: + print(event) + f.close() + + def run_heat_disinfect(): complete_counter = 1 f = open("/home/fw/projects/dialin/tests/Heat_disinfect.log", "w") @@ -554,7 +575,7 @@ # run_chemical_disinfect() - #run_dg() + run_dg() # run_ro_pump_duty_cycles() @@ -564,32 +585,11 @@ # cmd_test_heaters() - # collect_treatment_data() + #collect_treatment_data() + #collect_hd_treatment() - print(dg.rtc.get_rtc_epoch()) - sleep(0.1) - #dg.rtc.cmd_stop_rtc() - dg.rtc.cmd_set_rtc_time_and_date(45, 27, 17, 4, 11, 2021) - """ - sleep(6) - - print(dg.rtc.get_rtc_epoch()) - - sleep(1) - - dg.rtc.cmd_set_rtc_time_and_date(22, 18, 17, 4, 11, 2021) - - while True: - print(dg.rtc.get_rtc_epoch()) - sleep(1) - """ - - - - -