Loading pysqm/main.py +3 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,9 @@ else: print(('ERROR. Unknown device type '+str(config._device_type))) exit(0) if mydevice.addr == None: print('ERROR: no device found for reading data') exit(1) def loop(): ''' Loading pysqm/read.py +39 −24 Original line number Diff line number Diff line Loading @@ -468,6 +468,7 @@ class SQMLE(SQM): except: print('Trying auto device address ...') self.addr = self.search() if self.addr!=None: print(('Found address %s ... ' %str(self.addr))) self.port = 10001 self.start_connection() Loading Loading @@ -667,14 +668,20 @@ class SQMLU(SQM): print(('Trying fixed device address %s ... ' %str(config._device_addr))) self.addr = config._device_addr self.bauds = 115200 try: self.start_connection() except OSError: print('device ', config._device_addr, ' does not exist') raise except: print('Trying auto device address ...') self.addr = self.search() if self.addr != None: print(('Found address %s ... ' %str(self.addr))) if self.addr != None: self.bauds = 115200 self.start_connection() # Clearing buffer print(('Clearing buffer ... |'), end=' ') buffer_data = self.read_buffer() Loading @@ -700,26 +707,34 @@ class SQMLU(SQM): os_in_use = sys.platform if os_in_use == 'linux2': print('Detected Linux2 platform') ports = ports_unix elif os_in_use == 'linux': print('Detected Linux platform') ports = ports_unix elif os_in_use == 'win32': print('Detected Windows platform') ports = ports_win else: print('No supported platform detected -> ', os_in_use) used_port = None for port in ports: try: os.stat(port) except OSError: print('port ', port,' does not exist') continue conn_test = serial.Serial(port, 115200, timeout=1) conn_test.write('ix'.encode) if conn_test.readline()[0] == 'i': used_port = port break try: assert(used_port!=None) except: if (used_port==None): print('ERR. Device not found!') raise else: return(used_port) def start_connection(self): Loading Loading
pysqm/main.py +3 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,9 @@ else: print(('ERROR. Unknown device type '+str(config._device_type))) exit(0) if mydevice.addr == None: print('ERROR: no device found for reading data') exit(1) def loop(): ''' Loading
pysqm/read.py +39 −24 Original line number Diff line number Diff line Loading @@ -468,6 +468,7 @@ class SQMLE(SQM): except: print('Trying auto device address ...') self.addr = self.search() if self.addr!=None: print(('Found address %s ... ' %str(self.addr))) self.port = 10001 self.start_connection() Loading Loading @@ -667,14 +668,20 @@ class SQMLU(SQM): print(('Trying fixed device address %s ... ' %str(config._device_addr))) self.addr = config._device_addr self.bauds = 115200 try: self.start_connection() except OSError: print('device ', config._device_addr, ' does not exist') raise except: print('Trying auto device address ...') self.addr = self.search() if self.addr != None: print(('Found address %s ... ' %str(self.addr))) if self.addr != None: self.bauds = 115200 self.start_connection() # Clearing buffer print(('Clearing buffer ... |'), end=' ') buffer_data = self.read_buffer() Loading @@ -700,26 +707,34 @@ class SQMLU(SQM): os_in_use = sys.platform if os_in_use == 'linux2': print('Detected Linux2 platform') ports = ports_unix elif os_in_use == 'linux': print('Detected Linux platform') ports = ports_unix elif os_in_use == 'win32': print('Detected Windows platform') ports = ports_win else: print('No supported platform detected -> ', os_in_use) used_port = None for port in ports: try: os.stat(port) except OSError: print('port ', port,' does not exist') continue conn_test = serial.Serial(port, 115200, timeout=1) conn_test.write('ix'.encode) if conn_test.readline()[0] == 'i': used_port = port break try: assert(used_port!=None) except: if (used_port==None): print('ERR. Device not found!') raise else: return(used_port) def start_connection(self): Loading