Commit e48ed38fd6f398deaa884e8068402badd088bcbe

Authored by Christopher Stone
1 parent 8cff766a
Exists in master

Transfered to storing full path for *nix serial devices, to avoid code repetition

robots/little_john/telemetry/code/monitor/graph_plotter_rewrite.py
... ... @@ -39,7 +39,7 @@ else:
39 39 for dev in alldevs:
40 40 for pattern in devpatterns:
41 41 if pattern in dev:
42   - targetdevs.append(dev)
  42 + targetdevs.append("/dev/" + dev)
43 43 os='Other' #may be useful
44 44  
45 45  
... ... @@ -51,7 +51,7 @@ if len(targetdevs) == 0:
51 51 elif len(targetdevs) > 1:
52 52 print("Found multiple serial devices: ")
53 53 for i, dev in enumerate(targetdevs):
54   - print(" " + str(i) + ": /dev/" + dev)
  54 + print(" " + str(i) + ": " + dev)
55 55 while True:
56 56 try:
57 57 selection = int(input("Please enter your selection (as a digit):\n > "))
... ... @@ -66,11 +66,10 @@ else:
66 66 print("Only found one likely serial device: " + targetdevs[0])
67 67 selection = 0
68 68 else:
69   - print("Only found one likely serial device: /dev/" + dev)
70   -if os=='Windows':
71   - serialport=targetdevs[selection]
72   -else:
73   - serialport = "/dev/" + targetdevs[selection]
  69 + print("Only found one likely serial device: " + dev)
  70 +
  71 +serialport=targetdevs[selection]
  72 +
74 73  
75 74 try:
76 75 datafeed = serial.Serial(
... ...