Changed hardware initialization to be asynchronous.

This commit is contained in:
2021-10-22 20:38:51 +02:00
parent d7ade91f80
commit f2c33f69fa
3 changed files with 29 additions and 20 deletions
+9 -9
View File
@@ -282,7 +282,7 @@ class ManualMode(Frame):
def reinitialize(self): # called on "Reinitialize!" button press
# reinitialize all PSUs and the Arduino
g.CAGE_DEVICE.reconnect_hardware()
g.CAGE_DEVICE.reconnect_hardware_async()
# log change to the log file if user has selected event logging in the Configure Logging window
logger = self.controller.pages[ConfigureLogging] # get object of logging configurator
@@ -507,7 +507,7 @@ class ExecuteCSVMode(Frame):
def reinitialize(self): # called on "Reinitialize devices" button press
# reinitialize all PSUs and the Arduino
g.CAGE_DEVICE.reconnect_hardware()
g.CAGE_DEVICE.reconnect_hardware_async()
# log change to the log file if user has selected event logging in the Configure Logging window
logger = self.controller.pages[ConfigureLogging] # get object of logging configurator
@@ -874,7 +874,7 @@ class CalibrateAmbientField(Frame):
config.edit_config("Z-Axis", "ambient_field", self.ambient_field_result[2])
ui_print("Reinitializing devices...")
g.CAGE_DEVICE.reconnect_hardware() # setup everything with the defaults
g.CAGE_DEVICE.reconnect_hardware_async() # setup everything with the defaults
def save_and_apply_coil_constants(self):
if self.coil_constant_results is not None:
@@ -884,7 +884,7 @@ class CalibrateAmbientField(Frame):
config.edit_config("Z-Axis", "coil_const", self.coil_constant_results[2])
ui_print("Reinitializing devices...")
g.CAGE_DEVICE.reconnect_hardware() # setup everything with the defaults
g.CAGE_DEVICE.reconnect_hardware_async() # setup everything with the defaults
class CalibrateMagnetometer(Frame):
def __init__(self, parent, controller):
@@ -1271,7 +1271,7 @@ class HardwareConfiguration(Frame):
def restore_defaults(self): # restore default settings
config.reset_config_to_default() # overwrite config file with default
ui_print("\nReinitializing devices...")
g.CAGE_DEVICE.reconnect_hardware() # setup everything with the defaults
g.CAGE_DEVICE.reconnect_hardware_async() # setup everything with the defaults
self.update_fields() # update fields in config window
def update_fields(self): # set current values for all entry variables from config file
@@ -1355,7 +1355,7 @@ class HardwareConfiguration(Frame):
def implement(self): # "Update and Reinitialize" button, update config with new values and reinitialize devices
self.write_values() # write current values from entry fields to config object
ui_print("\nReinitializing devices...")
g.CAGE_DEVICE.reconnect_hardware() # reinitialize devices and program with new values
g.CAGE_DEVICE.reconnect_hardware_async() # reinitialize devices and program with new values
self.update_fields() # update entry fields to show new values
def load_config(self): # load configuration from some config file
@@ -1369,7 +1369,7 @@ class HardwareConfiguration(Frame):
config.check_config(config.CONFIG_OBJECT) # check and display warnings if values are out of bounds
ui_print("\nReinitializing devices...")
g.CAGE_DEVICE.reconnect_hardware() # reinitialize devices and program with new values
g.CAGE_DEVICE.reconnect_hardware_async() # reinitialize devices and program with new values
self.update_fields() # update entry fields to show new values
elif filename == '': # this happens when file selection window is closed without selecting a file
ui_print("No file selected, could not load config.")
@@ -1390,14 +1390,14 @@ class HardwareConfiguration(Frame):
self.write_values() # write current entry field values to the config object
config.write_config_to_file(config.CONFIG_OBJECT) # write contents of config object to file
ui_print("\nReinitializing devices...")
g.CAGE_DEVICE.reconnect_hardware() # reinitialize devices and program with new values
g.CAGE_DEVICE.reconnect_hardware_async() # reinitialize devices and program with new values
self.update_fields() # update entry fields to show values as they are in the config
def save_config(self): # same as save_config_as() but with the current config file
self.write_values() # write current entry field values to the config object
config.write_config_to_file(config.CONFIG_OBJECT) # write contents of config object to file
ui_print("\nReinitializing devices...")
g.CAGE_DEVICE.reconnect_hardware() # reinitialize devices and program with new values
g.CAGE_DEVICE.reconnect_hardware_async() # reinitialize devices and program with new values
self.update_fields() # update entry fields to show values as they are in the config