瀏覽代碼

Gui Änderung

Janek 3 年之前
父節點
當前提交
00b4b7bae2
共有 2 個文件被更改,包括 18 次插入6 次删除
  1. 10 6
      raspberry-pi/mainWindow.py
  2. 8 0
      raspberry-pi/sensors/magneticSensor.py

+ 10 - 6
raspberry-pi/mainWindow.py

@@ -62,8 +62,12 @@ class MainWindow(tk.Frame):
     self.mag_label.pack(side="top", fill="both", expand=False)
     self.mag_dro_x = tk.StringVar()
     self.mag_dro_y = tk.StringVar()
+    self.mag_dro_val_sums = tk.StringVar()
+    self.mag_dro_val_count = tk.StringVar()
     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_y, 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_y, 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.pack(side="bottom", fill="both")
@@ -134,12 +138,12 @@ class MainWindow(tk.Frame):
     else:
       self.opt_label.config(fg="black", bg="yellow")
 
-    # if not self.mag_sensor.:
-    #  self.mag_label.config(fg="white", bg="red")
-    # elif len(mag_positions) > 0:
-    #  self.mag_label.config(fg="white", bg="green")
-    # else:
-    #  self.mag_label.config(fg="black", bg="yellow")
+    if not self.mag_sensor.:
+     self.mag_label.config(fg="white", bg="red")
+    elif len(mag_positions) > 0:
+     self.mag_label.config(fg="white", bg="green")
+    else:
+     self.mag_label.config(fg="black", bg="yellow")
 
 
     # readouts will only be updated so often

+ 8 - 0
raspberry-pi/sensors/magneticSensor.py

@@ -1,6 +1,7 @@
 import queue
 import time
 
+from sensors.calibration import CalibrationStateMashine
 from sensors.connection import globalArduinoSlave
 import logHandler
 
@@ -11,7 +12,14 @@ class MagneticSensor:
   def __init__(self, conf):
     self.conf = conf
     self.queue = queue.Queue()
+    self.calibration_state  = CalibrationStateMashine()
     self.log_handler = logHandler.get_log_handler() # neu
+
+    self.field_height = float(conf["field"]["y"])
+    self.field_width = float(conf["field"]["x"])
+
+    self.n = 0
+  
     #pass
 
   def start(self):