|
@@ -1,7 +1,9 @@
|
|
|
# The code for changing pages was derived from: http://stackoverflow.com/questions/7546050/switch-between-two-frames-in-tkinter
|
|
|
# License: http://creativecommons.org/licenses/by-sa/3.0/
|
|
|
|
|
|
+from database import Table
|
|
|
from analogPressure.sdpArray import SdpArray
|
|
|
+from analogPressure.mcp3008 import MCP3008
|
|
|
from digitalPressure.sdp610Array import Spd610Array
|
|
|
from wirelessLoadCell.loadCells import LoadCells
|
|
|
from ui import *
|
|
@@ -11,12 +13,26 @@ import tk_tools
|
|
|
from time import *
|
|
|
|
|
|
|
|
|
-class Main(tk.Tk):
|
|
|
+class Main(tk.Tk, Table):
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
tk.Tk.__init__(self, *args, **kwargs)
|
|
|
tk.Tk.wm_title(self, "Windkanal-Tool")
|
|
|
+
|
|
|
+ self.adc = MCP3008(0,0)
|
|
|
+ self.pressureSensors = Spd610Array()
|
|
|
+ self.forceSensors = LoadCells()
|
|
|
+ self.motorController = None
|
|
|
|
|
|
+ Table.__init__(self,
|
|
|
+ ["time", "windspeed", "motor_pwm"] +
|
|
|
+ [f"pressure_{i}" for i in range(8)] +
|
|
|
+ [f"adc_{i}" for i in range(8)] +
|
|
|
+ [f"force_X_1", f"force_Y_1", f"force_Z_1"] +
|
|
|
+ [f"force_X_2", f"force_Y_2", f"force_Z_2"] +
|
|
|
+ [f"force_X_3", f"force_Y_3", f"force_Z_3"])
|
|
|
|
|
|
+ self.saveAsCsv("test.csv")
|
|
|
+
|
|
|
container = tk.Frame(self)
|
|
|
container.pack(side="top", fill="both", expand = True)
|
|
|
container.grid_rowconfigure(0, weight=1)
|
|
@@ -64,6 +80,8 @@ class Main(tk.Tk):
|
|
|
|
|
|
self.show_frame(Page_1)
|
|
|
|
|
|
+ self.interval()
|
|
|
+
|
|
|
def show_frame(self, cont):
|
|
|
frame = self.frames[cont]
|
|
|
frame.tkraise()
|
|
@@ -76,7 +94,9 @@ class Main(tk.Tk):
|
|
|
b1 = tk.Button(popup, text="Okay", command=popup.destroy)
|
|
|
b1.pack()
|
|
|
def interval(self):
|
|
|
-
|
|
|
+ adcValues = self.adc.read()
|
|
|
+
|
|
|
+ self.addRow([time.time()] + adcValues)
|
|
|
for frame in self.frames:
|
|
|
frame.update()
|
|
|
|