cleanup and comments

user interface
This commit is contained in:
Martin Zietz
2021-02-17 11:26:25 +01:00
parent 3b62e41f5a
commit f5dc7f097e
5 changed files with 295 additions and 261 deletions
+5 -2
View File
@@ -1,11 +1,13 @@
# This file contains all classes and functions directly related to the operation of the helmholtz test stand.
# The two main classes are Axis and ArduinoCtrl, see their definitions for details.
# import packages:
import numpy as np
import serial
import traceback
from tkinter import messagebox
# import other project files
from User_Interface import ui_print
from pyps2000b import PS2000B
from Arduino import Arduino
@@ -122,7 +124,8 @@ class Axis:
if abs(value) > self.max_amps: # prevent excessive currents
self.power_down() # set output to 0 and deactivate
raise ValueError("Invalid current value. Tried %0.2fA, max. %0.2fA allowed" % (value, self.max_amps))
raise ValueError("Invalid current value on %s. Tried %0.2fA, max. %0.2fA allowed"
% (self.name, value, self.max_amps))
elif value >= 0: # switch the e-box relay to change polarity as needed
g.ARDUINO.digitalWrite(self.ardPin, "LOW") # command the output pin on the arduino in the electronics box
@@ -384,7 +387,7 @@ def set_current_vec(vector): # sets currents on each axis according to given ve
axis.set_signed_current(vector[i]) # command test stand to set the current
except ValueError as e: # current was too high
ui_print(e)
ui_print(e) # print out the error message
i += 1