-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
22 lines (20 loc) · 792 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
This runs the InterspaceStateMachine from statemachine.py
in a thread and runs statemachine.spectrum_analyzer.tick()
in the main thread. This is due to the necessity of pyplot
to run in the main thread and pyplot currently being slow.
"""
import sys
import threading
from conversation import interspace_statemachine
if __name__ == "__main__":
state_machine = interspace_statemachine.InterspaceStateMachine()
while True:
interspace_statemachine.frame_received_semaphore.acquire()
fft_frame = interspace_statemachine.fft_buffer.pop()
state_machine.run(fft_frame)
try:
interspace_statemachine.spectrum_analyzer.tick()
except KeyboardInterrupt:
interspace_statemachine.spectrum_analyzer.quit()
sys.exit(0)