Added user interface elements for magnetometer calibration

This commit is contained in:
2021-08-23 01:02:53 +02:00
parent 244aaa8e89
commit bcadc3f273
3 changed files with 98 additions and 28 deletions
+7 -4
View File
@@ -81,6 +81,9 @@ class HelmholtzCageDevice:
# The axes talks to the HW objects (Arduino, PSU) referenced in this object
self.axes.append(Axis(i, self))
# Zero and activate channels. This is a sort of "armed" state so that we can send commands later
self.idle()
# --- HW COMMUNICATION THREAD ---
self._cmd_exec_thread = Thread(target=self._cmd_exec_thread_method)
self._cmd_exec_thread.start()
@@ -92,6 +95,7 @@ class HelmholtzCageDevice:
def reconnect_hardware(self):
self.shutdown()
self.connect_hardware()
self.idle()
# TODO: Move to proxy
def connect_hardware(self):
@@ -133,9 +137,6 @@ class HelmholtzCageDevice:
self.psu2 = None
ui_print("Error creating PSU device:\n{}".format(e))
# Zero and activate channels. This is a sort of "armed" state so that we can send commands later
self.idle()
def idle(self):
""" Zero and activate channels """
if self.psu1 is not None:
@@ -144,6 +145,9 @@ class HelmholtzCageDevice:
self.psu2.idle()
if self.arduino is not None:
self.arduino.idle()
# Since these actions are not handled by the axes objects, also make sure to update their target field status
for axis in self.axes:
axis.target_current = 0
def request_proxy(self):
"""Returns a new HelmholtzCageProxy or None, depending on if access is available"""
@@ -222,7 +226,6 @@ class HelmholtzCageDevice:
else:
raise Exception("Command unknown!")
def _hw_poll_thread_method(self):
"""This method forms the main thread for hardware command execution."""
while True: