def __init__(self, port): threading.Thread.__init__(self) self.mks925 = mks925.mks_comm(port) self.serial_no = self.mks925.read_serial() self.mks925.change_unit('MBAR') self.pressure = self.mks925.read_pressure() self.quit = False
def __init__(self): threading.Thread.__init__(self) port = '/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0' self.pirani = mks_pirani.mks_comm(port=port) self.pressure = None self.quit = False self.last_recorded_time = 0 self.last_recorded_value = 0 self.trigged = False self.running = True self.ERROR = None self.socket_avalible = False self.db_logger_avalible = False
def run(self): while not self.quit: self.ttl = 20 for key in ['old', 'ng']: self.pressure[key] = self.gauges[key].read_pressure() time.sleep(0.1) logging.basicConfig(filename="logger.txt", level=logging.ERROR) logging.basicConfig(level=logging.ERROR) ports = ['/dev/serial/by-id/usb-FTDI_USB-RS232_Cable_FTWRZWVS-if00-port0', '/dev/serial/by-id/usb-FTDI_USB-RS232_Cable_FTWXB4EW-if00-port0'] mks_list = {} for i in range(0, 2): _mks = mks_925_pirani.mks_comm(ports[i]) _name = _mks.read_serial() #_name = _name.strip() if _name == '1107638964': mks_list['ng'] = mks_925_pirani.mks_comm(ports[i]) mks_list['ng'].change_unit('MBAR') print('Pirani, ng buffer:' + ports[i] + ', serial:' + _name) elif _name == '1027033634': mks_list['old'] = mks_925_pirani.mks_comm(ports[i]) mks_list['old'].change_unit('MBAR') print('Pirani, old buffer:'+ ports[i] + ', serial:' + _name) else: print('Pirani, Unknown:'+ ports[i] + ', serial:' + _name) print(_mks.read_serial()) if len(mks_list) == 2: