forked from zietzm/Helmholtz_Test_Bench
cleanup and comments
user interface
This commit is contained in:
+5
-2
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user