|
@@ -74,22 +74,31 @@ class MainWindow(tk.Frame):
|
|
self.quit_button = tk.Button(self.controls, text="Quit", command=self.root.destroy, height=2, foreground="red")
|
|
self.quit_button = tk.Button(self.controls, text="Quit", command=self.root.destroy, height=2, foreground="red")
|
|
self.quit_button.pack(side="bottom", fill="both")
|
|
self.quit_button.pack(side="bottom", fill="both")
|
|
|
|
|
|
- self.calibrateac_button = tk.Button(self.controls, text="Calibrate AC", command=self.calibrate_ac, height=4)
|
|
|
|
|
|
+ self.calibrate_submenu_button = tk.Button(self.controls, text="Calibrate", command=self.calibrate_submenu, height=2)
|
|
|
|
+ self.calibrate_submenu_button.pack_forget()
|
|
|
|
+
|
|
|
|
+ self.calibrate_all_button = tk.Button(self.controls, text="Calibrate All", command=self.calibrate_all, height=2)
|
|
|
|
+ self.calibrate_all_button.pack_forget()
|
|
|
|
+
|
|
|
|
+ self.calibrateac_button = tk.Button(self.controls, text="Calibrate AC", command=self.calibrate_ac, height=2)
|
|
self.calibrateac_button.pack_forget()
|
|
self.calibrateac_button.pack_forget()
|
|
|
|
|
|
- self.calibratemc_button = tk.Button(self.controls, text = "Calibrate MC", command = self.calibrate_mc,height = 4)
|
|
|
|
- self.calibratemc_button.pack_forget()
|
|
|
|
|
|
+ self.calibrateopt_button = tk.Button(self.controls, text = "Calibrate OPT", command = self.calibrate_opt,height = 2)
|
|
|
|
+ self.calibrateopt_button.pack_forget()
|
|
|
|
+
|
|
|
|
+ self.calibratemag_button = tk.Button(self.controls, text = "Calibrate MAG", command = self.calibrate_mag,height = 2)
|
|
|
|
+ self.calibratemag_button.pack_forget()
|
|
|
|
|
|
- self.clear_button = tk.Button(self.controls, text="Clear graph", command=self.graph.clear, height=4)
|
|
|
|
|
|
+ self.clear_button = tk.Button(self.controls, text="Clear graph", command=self.graph.clear, height=2)
|
|
self.clear_button.pack_forget()
|
|
self.clear_button.pack_forget()
|
|
|
|
|
|
- self.logscreen_button = tk.Button(self.controls, text="Log", command=self.open_log, height=4)
|
|
|
|
|
|
+ self.logscreen_button = tk.Button(self.controls, text="Log", command=self.open_log, height=2)
|
|
self.logscreen_button.pack_forget()
|
|
self.logscreen_button.pack_forget()
|
|
|
|
|
|
- self.menu_button = tk.Button(self.controls, text="Menu", command=self.menu, height=4)
|
|
|
|
|
|
+ self.menu_button = tk.Button(self.controls, text="Menu", command=self.menu, height=2)
|
|
self.menu_button.pack(side="bottom", fill="both")
|
|
self.menu_button.pack(side="bottom", fill="both")
|
|
|
|
|
|
- self.menu_back_button = tk.Button(self.controls, text="Back", command=self.back, height=4)
|
|
|
|
|
|
+ self.menu_back_button = tk.Button(self.controls, text="Back", command=self.back, height=2)
|
|
self.menu_back_button.pack_forget()
|
|
self.menu_back_button.pack_forget()
|
|
|
|
|
|
def update(self):
|
|
def update(self):
|
|
@@ -183,10 +192,10 @@ class MainWindow(tk.Frame):
|
|
else:
|
|
else:
|
|
self.mag_dro_val_sums.fill(0)
|
|
self.mag_dro_val_sums.fill(0)
|
|
|
|
|
|
- self.mag_dro_x.set("X: {:.1f} mm".format(self.mag_dro_val_sums[0]))
|
|
|
|
- self.mag_dro_y.set("Y: {:.1f} mm".format(self.mag_dro_val_sums[1]))
|
|
|
|
- #self.mag_dro_offset_x.set("offset: {:.1f} %".format(self.mag_dro_val_sums[2]*100))
|
|
|
|
- #self.mag_dro_offset_y.set("size: {:.1f} %".format(self.mag_dro_val_sums[3]*100))
|
|
|
|
|
|
+ self.mag_dro_x.set("X: {:.1f} mT".format(self.mag_dro_val_sums[0]))
|
|
|
|
+ self.mag_dro_y.set("Y: {:.1f} mT".format(self.mag_dro_val_sums[1]))
|
|
|
|
+ self.mag_dro_offset_x.set("X Offset: {:.1f} %".format(self.mag_dro_val_sums[2]*100))
|
|
|
|
+ self.mag_dro_offset_y.set("Y: {:.1f} %".format(self.mag_dro_val_sums[3]*100))
|
|
|
|
|
|
if self.popup_window:
|
|
if self.popup_window:
|
|
self.popup_window.update()
|
|
self.popup_window.update()
|
|
@@ -196,6 +205,21 @@ class MainWindow(tk.Frame):
|
|
|
|
|
|
self.root.after(30, self.update)
|
|
self.root.after(30, self.update)
|
|
|
|
|
|
|
|
+ def calibrate_submenu(self):
|
|
|
|
+
|
|
|
|
+ self.calibrate_submenu_button.pack_forget()
|
|
|
|
+ self.menu_button.pack_forget()
|
|
|
|
+ self.clear_button.pack_forget()
|
|
|
|
+ self.logscreen_button.pack_forget()
|
|
|
|
+ self.menu_back_button.pack(side="bottom", fill="both")
|
|
|
|
+ self.calibratemag_button.pack(side="bottom", fill="both")
|
|
|
|
+ self.calibrateopt_button.pack(side="bottom", fill="both")
|
|
|
|
+ self.calibrateac_button.pack(side="bottom", fill="both")
|
|
|
|
+ self.calibrat_all_button.pack(side="bottom", fill="both")
|
|
|
|
+
|
|
|
|
+ def calibrate_all(self):
|
|
|
|
+ pass
|
|
|
|
+
|
|
def calibrate_ac(self):
|
|
def calibrate_ac(self):
|
|
self.ac_sensor.start_calibration()
|
|
self.ac_sensor.start_calibration()
|
|
if not self.popup_window or not self.pu_root.winfo_exists():
|
|
if not self.popup_window or not self.pu_root.winfo_exists():
|
|
@@ -212,8 +236,24 @@ class MainWindow(tk.Frame):
|
|
self.popup_window = CalibrationPopUp(self.pu_root, self.ac_sensor.calibration_state, self.conf)
|
|
self.popup_window = CalibrationPopUp(self.pu_root, self.ac_sensor.calibration_state, self.conf)
|
|
self.popup_window.pack(side="top", fill="both", expand=True)
|
|
self.popup_window.pack(side="top", fill="both", expand=True)
|
|
|
|
|
|
- def calibrate_mc(self):
|
|
|
|
|
|
+ def calibrate_opt(self):
|
|
pass
|
|
pass
|
|
|
|
+
|
|
|
|
+ def calibrate_mag(self): ###
|
|
|
|
+ self.mag_sensor.start_calibration()
|
|
|
|
+ if not self.popup_window or not self.pu_root.winfo_exists():
|
|
|
|
+ # create new window
|
|
|
|
+ self.pu_root = tk.Toplevel(self.root)
|
|
|
|
+ self.pu_root.wm_transient(self.root)
|
|
|
|
+ self.pu_root.wm_title("Magnetic Sensor Calibration")
|
|
|
|
+ # make it centered
|
|
|
|
+ x = (self.pu_root.winfo_screenwidth() - 500) / 2
|
|
|
|
+ y = (self.pu_root.winfo_screenheight() - 200) / 2
|
|
|
|
+ self.pu_root.geometry(f'500x200+{int(x)}+{int(y)}')
|
|
|
|
+ # deactivate mainWindow
|
|
|
|
+ self.pu_root.grab_set()
|
|
|
|
+ self.popup_window = CalibrationPopUp(self.pu_root, self.mag_sensor.calibration_state, self.conf)
|
|
|
|
+ self.popup_window.pack(side="top", fill="both", expand=True)
|
|
|
|
|
|
def open_log(self):
|
|
def open_log(self):
|
|
#create new window
|
|
#create new window
|
|
@@ -233,17 +273,18 @@ class MainWindow(tk.Frame):
|
|
# Menu Button
|
|
# Menu Button
|
|
def menu(self):
|
|
def menu(self):
|
|
self.menu_back_button.pack(side="bottom", fill="both")
|
|
self.menu_back_button.pack(side="bottom", fill="both")
|
|
- self.calibrateac_button.pack(side="bottom", fill="both")
|
|
|
|
- self.calibratemc_button.pack(side="bottom", fill="both")
|
|
|
|
|
|
+ self.calibrate_submenu_button.pack(side="bottom", fill="both")
|
|
self.clear_button.pack(side="bottom", fill="both")
|
|
self.clear_button.pack(side="bottom", fill="both")
|
|
self.logscreen_button.pack(side="bottom", fill="both")
|
|
self.logscreen_button.pack(side="bottom", fill="both")
|
|
self.menu_button.pack_forget()
|
|
self.menu_button.pack_forget()
|
|
|
|
|
|
#Back Button
|
|
#Back Button
|
|
def back(self):
|
|
def back(self):
|
|
|
|
+ self.calibratemag_button.pack_forget()
|
|
|
|
+ self.calibrateopt_button.pack_forget()
|
|
self.calibrateac_button.pack_forget()
|
|
self.calibrateac_button.pack_forget()
|
|
- self.calibratemc_button.pack_forget()
|
|
|
|
self.clear_button.pack_forget()
|
|
self.clear_button.pack_forget()
|
|
self.logscreen_button.pack_forget()
|
|
self.logscreen_button.pack_forget()
|
|
|
|
+ self.calibrate_submenu_button.pack_forget()
|
|
self.menu_button.pack(side="bottom", fill="both")
|
|
self.menu_button.pack(side="bottom", fill="both")
|
|
self.menu_back_button.pack_forget()
|
|
self.menu_back_button.pack_forget()
|