File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -74,20 +74,27 @@ def get_height(self) -> int:
7474
7575 def openSerial (self ):
7676 if self .com_port == 'AUTO' :
77- lcd_com_port = self .auto_detect_com_port ()
78- if not lcd_com_port :
77+ self . com_port = self .auto_detect_com_port ()
78+ if not self . com_port :
7979 logger .error (
8080 "Cannot find COM port automatically, please run Configuration again and select COM port manually" )
8181 try :
8282 sys .exit (0 )
8383 except :
8484 os ._exit (0 )
85- logger . debug ( f"Auto detected COM port: { lcd_com_port } " )
86- self . lcd_serial = serial . Serial ( lcd_com_port , 115200 , timeout = 1 , rtscts = 1 )
85+ else :
86+ logger . debug ( f"Auto detected COM port: { self . com_port } " )
8787 else :
88- lcd_com_port = self .com_port
89- logger .debug (f"Static COM port: { lcd_com_port } " )
90- self .lcd_serial = serial .Serial (lcd_com_port , 115200 , timeout = 1 , rtscts = 1 )
88+ logger .debug (f"Static COM port: { self .com_port } " )
89+
90+ try :
91+ self .lcd_serial = serial .Serial (self .com_port , 115200 , timeout = 1 , rtscts = 1 )
92+ except Exception as e :
93+ logger .error (f"Cannot open COM port { self .com_port } : { e } " )
94+ try :
95+ sys .exit (0 )
96+ except :
97+ os ._exit (0 )
9198
9299 def closeSerial (self ):
93100 try :
You can’t perform that action at this time.
0 commit comments