You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
print(INFO_MSG,'ANSI colors not used',BASH_TIPS['DEFAULT'])
804
804
805
805
ifargs.port=="DEFAULT":
806
-
try:
807
-
ifargs.Board=="goE":
808
-
list_port_info=list(serial.tools.list_ports.grep("0403")) #Take the second one
809
-
print(INFO_MSG,"COM Port Auto Detected, Selected ",list_port_info[1].device,BASH_TIPS['DEFAULT'])
810
-
_port=list_port_info[1].device
811
-
else:
812
-
list_port_info=list(serial.tools.list_ports.grep(VID_LIST_FOR_AUTO_LOOKUP)) #Take the first one within the list
813
-
_port=list_port_info[0].device
814
-
exceptStopIteration:
815
-
print(ERROR_MSG,"No vaild COM Port found in Auto Detect, Check Your Connection or Specify One by"+BASH_TIPS['GREEN']+'`--port/-p`',BASH_TIPS['DEFAULT'])
816
-
sys.exit(1)
806
+
ifargs.Board=="goE":
807
+
list_port_info=list(serial.tools.list_ports.grep("0403")) #Take the second one
808
+
if(len(list_port_info)==0):
809
+
print(ERROR_MSG,"No vaild COM Port found in Auto Detect, Check Your Connection or Specify One by"+BASH_TIPS['GREEN']+'`--port/-p`',BASH_TIPS['DEFAULT'])
810
+
sys.exit(1)
811
+
list_port_info.sort()
812
+
print(INFO_MSG,"COM Port Auto Detected, Selected ",list_port_info[1].device,BASH_TIPS['DEFAULT'])
813
+
_port=list_port_info[1].device
814
+
else:
815
+
try:
816
+
list_port_info=next(serial.tools.list_ports.grep(VID_LIST_FOR_AUTO_LOOKUP)) #Take the first one within the list
817
+
_port=list_port_info.device
818
+
exceptStopIteration:
819
+
print(ERROR_MSG,"No vaild COM Port found in Auto Detect, Check Your Connection or Specify One by"+BASH_TIPS['GREEN']+'`--port/-p`',BASH_TIPS['DEFAULT'])
820
+
sys.exit(1)
817
821
else:
818
822
_port=args.port
819
823
print(INFO_MSG,"COM Port Selected Manually: ",_port,BASH_TIPS['DEFAULT'])
0 commit comments