from ctypes import * from collections import OrderedDict from dialin.dg.dialysate_generator import DG from dialin.ui import crc from time import sleep import struct if __name__ == "__main__": # Create an instance of the DG Class dg = DG(log_level='DEBUG') if dg.cmd_log_in_to_dg() == 0: exit(1) sleep(2) cal = dg.calibration f = open("DG_Calibration.log", "w") #print(cal.DG_CALIBRATION_RECORD) status = True #cal.DG_CALIBRATION_RECORD['pressure_sensors']['ppi']['gain'][1] = 34.2 #print(cal.DG_CALIBRATION_RECORD) try: if status: dara = [] cal.get_dg_calibration_data() while True: sleep(0.2) #print(cal.current_message, cal.total_messages, cal.cal_data) if cal.cal_data != 0: f.write(str(cal.cal_data) + '\r') dara.append(cal.cal_data) if cal.current_message == cal.total_messages: f.close() break else: cal.set_dg_calibration_data() print(cal.DG_CALIBRATION_RECORD) except KeyboardInterrupt: f.close()