Commit fef2ac1d3d2bf9c50d2e627a2494fa688da37d3e
1 parent
41e2a564
Exists in
master
Simplified error reporting paths, reduced number of popups
Showing
2 changed files
with
6 additions
and
11 deletions
Show diff stats
robots/little_john/telemetry/code/monitor/graph_plotter_rewrite.py
| ... | ... | @@ -26,14 +26,8 @@ logging.info("Logging system active") |
| 26 | 26 | |
| 27 | 27 | datafeed = selectserial() |
| 28 | 28 | |
| 29 | -if type(datafeed) is str: | |
| 30 | - message = "Failed to open serial port: " + datafeed | |
| 31 | - easygui.msgbox(message, "Fatal error") | |
| 32 | - logging.critical(message) | |
| 33 | - sys.exit() | |
| 34 | -elif datafeed == None: | |
| 35 | - message = "Failed to open serial port for unknown reason!" | |
| 36 | - easygui.msgbox(message, "Fatal error") | |
| 29 | +if datafeed == None: | |
| 30 | + message = "Failed to open serial port" | |
| 37 | 31 | logging.critical(message) |
| 38 | 32 | sys.exit() |
| 39 | 33 | ... | ... |
robots/little_john/telemetry/code/monitor/serialselect.py
| ... | ... | @@ -40,12 +40,12 @@ def selectserial(): |
| 40 | 40 | title = "Found multiple serial ports!" |
| 41 | 41 | serialport = easygui.choicebox(message, title, targetdevs) |
| 42 | 42 | if serialport == None: |
| 43 | - return "User cancelled selection dialogue" | |
| 43 | + logging.info("User cancelled selection dialogue") | |
| 44 | + return None | |
| 44 | 45 | else: |
| 45 | 46 | logging.info("Only found one likely serial device: " + targetdevs[0]) |
| 46 | 47 | serialport = targetdevs[0] |
| 47 | 48 | |
| 48 | - | |
| 49 | 49 | try: |
| 50 | 50 | datafeed = serial.Serial( |
| 51 | 51 | port=serialport, |
| ... | ... | @@ -59,4 +59,5 @@ def selectserial(): |
| 59 | 59 | logging.info("Sucessfully opened " + serialport + " as data source!") |
| 60 | 60 | return datafeed |
| 61 | 61 | except Exception as e: |
| 62 | - return str(e) | |
| 62 | + logging.critical(str(e)) | |
| 63 | + return None | ... | ... |