forked from zietzm/Helmholtz_Test_Bench
Visual improvements for csv graphs
This commit is contained in:
+16
-15
@@ -364,16 +364,17 @@ def set_current_vec(vector): # sets needed currents on each axis for given vect
|
||||
|
||||
|
||||
def devices_ok(xy_off=False, z_off=False, arduino_off=False):
|
||||
# ToDo: comments
|
||||
try:
|
||||
if not xy_off:
|
||||
if g.XY_DEVICE is not None:
|
||||
g.X_AXIS.update_status_info()
|
||||
if g.X_AXIS.connected != "Connected":
|
||||
return False
|
||||
else:
|
||||
# check if all devices are connected, return True if yes
|
||||
# checks for individual devices can be disabled by parameters above (default not disabled)
|
||||
try: # handle errors while checking connections
|
||||
if not xy_off: # if check for this device is not disabled
|
||||
if g.XY_DEVICE is not None: # has the handle for this device been set?
|
||||
g.X_AXIS.update_status_info() # update info --> this actually communicates with the device
|
||||
if g.X_AXIS.connected != "Connected": # if not connected
|
||||
return False # return and exit function
|
||||
else: # if handle has not been set the device is inactive --> not ok
|
||||
return False
|
||||
if not z_off:
|
||||
if not z_off: # same as above
|
||||
if g.Z_DEVICE is not None:
|
||||
g.Z_AXIS.update_status_info()
|
||||
if g.Z_AXIS.connected != "Connected":
|
||||
@@ -381,12 +382,12 @@ def devices_ok(xy_off=False, z_off=False, arduino_off=False):
|
||||
else:
|
||||
return False
|
||||
|
||||
if not arduino_off:
|
||||
g.ARDUINO.update_status_info()
|
||||
if not arduino_off: # check not disabled
|
||||
g.ARDUINO.update_status_info() # update status info --> attempts communication
|
||||
if g.ARDUINO.connected != "Connected":
|
||||
return False
|
||||
except Exception as e:
|
||||
messagebox.showerror("Error!", "Error while checking devices: \n%s" % e)
|
||||
return False
|
||||
else:
|
||||
except Exception as e: # if an error is encountered while checking the devices
|
||||
messagebox.showerror("Error!", "Error while checking devices: \n%s" % e) # show error pop-up
|
||||
return False # clearly something is not ok
|
||||
else: # if nothing has triggered so far all devices are ok --> return True
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user