|
@@ -7,6 +7,7 @@ import numpy as np
|
|
from gui.popup import CalibrationPopUp
|
|
from gui.popup import CalibrationPopUp
|
|
from gui.graph import Graph
|
|
from gui.graph import Graph
|
|
from gui.logScreen import LogScreen
|
|
from gui.logScreen import LogScreen
|
|
|
|
+from sensors.opticalSensor import OpticalSensor
|
|
import logHandler
|
|
import logHandler
|
|
|
|
|
|
|
|
|
|
@@ -57,24 +58,31 @@ class MainWindow(tk.Frame):
|
|
tk.Label(self.controls, textvariable=self.opt_dro_offset, anchor="nw").pack(side="top", fill="both", expand=False)
|
|
tk.Label(self.controls, textvariable=self.opt_dro_offset, anchor="nw").pack(side="top", fill="both", expand=False)
|
|
tk.Label(self.controls, textvariable=self.opt_dro_size, anchor="nw").pack(side="top", fill="both", expand=False)
|
|
tk.Label(self.controls, textvariable=self.opt_dro_size, anchor="nw").pack(side="top", fill="both", expand=False)
|
|
|
|
|
|
- self.mag_label = tk.Label(self.controls, text="Magnetic Sensor", anchor="c", font=("Helvatica", 10, 'bold'))
|
|
|
|
- self.mag_label.pack(side="top", fill="both", expand=False)
|
|
|
|
|
|
+ self.mag_dro_val_sums = np.ndarray((4), dtype=np.float)
|
|
|
|
+ self.mag_dro_val_count = 0
|
|
self.mag_dro_x = tk.StringVar()
|
|
self.mag_dro_x = tk.StringVar()
|
|
self.mag_dro_y = tk.StringVar()
|
|
self.mag_dro_y = tk.StringVar()
|
|
|
|
+ self.mag_label = tk.Label(self.controls, text="Magnetic Sensor", anchor="c", font=("Helvatica", 10, 'bold'))
|
|
|
|
+ self.mag_label.pack(side="top", fill="both", expand=False)
|
|
tk.Label(self.controls, textvariable=self.mag_dro_x, anchor = "nw").pack(side = "top", fill = "both", expand = False)
|
|
tk.Label(self.controls, textvariable=self.mag_dro_x, anchor = "nw").pack(side = "top", fill = "both", expand = False)
|
|
tk.Label(self.controls, textvariable=self.mag_dro_x, anchor = "nw").pack(side = "top", fill = "both", expand = False)
|
|
tk.Label(self.controls, textvariable=self.mag_dro_x, anchor = "nw").pack(side = "top", fill = "both", expand = False)
|
|
-
|
|
|
|
|
|
+ #
|
|
|
|
+ #
|
|
|
|
+
|
|
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.calibrate_button = tk.Button(self.controls, text="Calibrate AC", command=self.calibrate_ac, height=4)
|
|
|
|
- self.calibrate_button.pack(side="bottom", fill="both")
|
|
|
|
|
|
+ self.calibrateac_button = tk.Button(self.controls, text="Calibrate AC", command=self.calibrate_ac, height=4)
|
|
|
|
+ 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.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=4)
|
|
- self.clear_button.pack(side="bottom", fill="both")
|
|
|
|
|
|
+ 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=4)
|
|
- self.logscreen_button.pack(side="bottom", fill="both")
|
|
|
|
|
|
+ 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=4)
|
|
self.menu_button.pack(side="bottom", fill="both")
|
|
self.menu_button.pack(side="bottom", fill="both")
|
|
@@ -82,15 +90,6 @@ class MainWindow(tk.Frame):
|
|
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=4)
|
|
self.menu_back_button.pack_forget()
|
|
self.menu_back_button.pack_forget()
|
|
|
|
|
|
- #"verstecken" der Buttons für Platz für Statusanzeigen Magnetsensor
|
|
|
|
-
|
|
|
|
- self.calibrate_button.pack_forget()
|
|
|
|
-
|
|
|
|
- self.clear_button.pack_forget()
|
|
|
|
-
|
|
|
|
- self.logscreen_button.pack_forget()
|
|
|
|
-
|
|
|
|
-
|
|
|
|
def update(self):
|
|
def update(self):
|
|
if not self.root.winfo_exists():
|
|
if not self.root.winfo_exists():
|
|
return
|
|
return
|
|
@@ -115,7 +114,7 @@ class MainWindow(tk.Frame):
|
|
mag_positions = []
|
|
mag_positions = []
|
|
while self.mag_sensor.queue.qsize() > 0:
|
|
while self.mag_sensor.queue.qsize() > 0:
|
|
name, data = self.mag_sensor.queue.get()
|
|
name, data = self.mag_sensor.queue.get()
|
|
- if name == 'data':
|
|
|
|
|
|
+ if name == "data":
|
|
mag_positions.append(data[0:2])
|
|
mag_positions.append(data[0:2])
|
|
self.mag_dro_val_sums += data
|
|
self.mag_dro_val_sums += data
|
|
self.mag_dro_val_count += 1
|
|
self.mag_dro_val_count += 1
|
|
@@ -201,6 +200,9 @@ 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):
|
|
|
|
+ pass
|
|
|
|
+
|
|
def open_log(self):
|
|
def open_log(self):
|
|
#create new window
|
|
#create new window
|
|
self.log_root = tk.Toplevel(self.root)
|
|
self.log_root = tk.Toplevel(self.root)
|
|
@@ -219,14 +221,17 @@ 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.calibrate_button.pack(side="bottom", fill="both")
|
|
|
|
|
|
+ self.calibrateac_button.pack(side="bottom", fill="both")
|
|
|
|
+ self.calibratemc_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
|
|
def back(self):
|
|
def back(self):
|
|
- self.calibrate_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.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()
|