|
@@ -1,8 +1,7 @@
|
|
-import sensors
|
|
|
|
|
|
+from sensors.acusticSensor import AcusticSensor
|
|
|
|
+from sensors.calibration import CalibrationStateMashine
|
|
from gui.mainWindow import MainWindow
|
|
from gui.mainWindow import MainWindow
|
|
|
|
|
|
-import time
|
|
|
|
-import threading
|
|
|
|
import queue
|
|
import queue
|
|
import configparser
|
|
import configparser
|
|
import tkinter as tk
|
|
import tkinter as tk
|
|
@@ -11,54 +10,10 @@ import traceback
|
|
conf = configparser.ConfigParser()
|
|
conf = configparser.ConfigParser()
|
|
conf.read('config.ini')
|
|
conf.read('config.ini')
|
|
|
|
|
|
-class CalibrationStateMashine():
|
|
|
|
-
|
|
|
|
- def __init__(self):
|
|
|
|
- self.state = 0
|
|
|
|
- self.value_count = 0
|
|
|
|
-
|
|
|
|
- self.NOT_CALIBRATED = 0
|
|
|
|
- self.WAITING_POS_1 = 1
|
|
|
|
- self.ACCUMULATING_1 = 2
|
|
|
|
- self.WAITING_POS_2 = 3
|
|
|
|
- self.ACCUMULATING_2 = 4
|
|
|
|
- self.CALIBRATION_DONE = 5
|
|
|
|
-
|
|
|
|
- def state_clearname(self):
|
|
|
|
- if self.state == self.NOT_CALIBRATED:
|
|
|
|
- return "not calibrated"
|
|
|
|
- elif self.state == self.WAITING_POS_1:
|
|
|
|
- return "Waiting for Position one"
|
|
|
|
- elif self.state == self.ACCUMULATING_1:
|
|
|
|
- return "gathering values on position one"
|
|
|
|
- elif self.state == self.WAITING_POS_2:
|
|
|
|
- return "Waiting for position two"
|
|
|
|
- elif self.state == self.ACCUMULATING_2:
|
|
|
|
- return "gathering values on position two"
|
|
|
|
- elif self.state == self.CALIBRATION_DONE:
|
|
|
|
- return "calibration done"
|
|
|
|
-
|
|
|
|
- def next_state(self):
|
|
|
|
- if self.state < self.CALIBRATION_DONE:
|
|
|
|
- self.state += 1
|
|
|
|
- print(self.state_clearname())
|
|
|
|
-
|
|
|
|
- def next_state_gui(self):
|
|
|
|
- print("next_state_gui",self.state)
|
|
|
|
- if self.state == self.WAITING_POS_1 or self.state == self.WAITING_POS_2:
|
|
|
|
- self.next_state()
|
|
|
|
-
|
|
|
|
- def get_state(self):
|
|
|
|
- return self.state
|
|
|
|
-
|
|
|
|
- def reset_state(self):
|
|
|
|
- self.state = 0
|
|
|
|
-
|
|
|
|
-
|
|
|
|
def main():
|
|
def main():
|
|
ac_queue = queue.Queue()
|
|
ac_queue = queue.Queue()
|
|
ac_calibration_state = CalibrationStateMashine()
|
|
ac_calibration_state = CalibrationStateMashine()
|
|
- ac_sensor = sensors.AcusticSensor(conf, ac_queue, ac_calibration_state)
|
|
|
|
|
|
+ ac_sensor = AcusticSensor(conf, ac_queue, ac_calibration_state)
|
|
|
|
|
|
try:
|
|
try:
|
|
ac_sensor.start()
|
|
ac_sensor.start()
|