Commit 8707b747e497dc1efe40626e1e0800b9f51a0f62

Authored by Christopher Stone
1 parent 43b81d53
Exists in master

Minor changes resulting from attempt to make code work on uni PCs, including cha…

…nges to error reporting to use logging better, and broadening an exception, as the type specifically suggested doesn't seem to exist. (This should probably be fixed more carefully at some point). Code does now work on uni PCs, at least up to failure to find a serial port, which is handled correctly.
robots/little_john/telemetry/code/monitor/graph_plotter_rewrite.py
... ... @@ -27,7 +27,7 @@ logging.info("Logging system active")
27 27  
28 28 datafeed = selectserial()
29 29  
30   -if datafeed == 'Sorry, no serial devices found.' or None:
  30 +if datafeed == None:
31 31 logging.critical("Failed to open serial port")
32 32 sys.exit()
33 33  
... ...
robots/little_john/telemetry/code/monitor/serialselect.py
... ... @@ -19,7 +19,8 @@ def selectserial():
19 19 s = serial.Serial(port)
20 20 s.close()
21 21 targetdevs.append(port)
22   - except (OSError, serial.SerialException):
  22 + # Temporarily broadened exception in attempt to make this work on uni PCs
  23 + except: # (OSError, serial.SerialException):
23 24 pass
24 25 os='Windows' #may be useful
25 26 else:
... ... @@ -32,7 +33,8 @@ def selectserial():
32 33 os='Other' #may be useful
33 34  
34 35 if len(targetdevs) == 0:
35   - return "Sorry, no serial devices found."
  36 + logging.info("No serial device found.")
  37 + return None
36 38 elif len(targetdevs) > 1:
37 39 logging.info("Found multiple serial devices: ")
38 40 for i, dev in enumerate(targetdevs):
... ...