[Controller]
- refactored - added IPC for RUN, PAUSE, STOP, STIRR ON/OFF [TIMER] - fixed default minimum wait time - added duration to elapse git-svn-id: http://moon:8086/svn/projects/HendiControl@277 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import signal
|
||||
import json
|
||||
from controller import Controller
|
||||
from controller import Controller, commands
|
||||
from mass import Mass
|
||||
from stirrer import Stirrer
|
||||
#from pololu1376 import Pololu1376
|
||||
@@ -49,20 +49,31 @@ def results_plot(self):
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
stirr_isOn = False
|
||||
|
||||
def handler(signum, frame):
|
||||
global stirr_isOn
|
||||
print('Signal handler called with signal', signum)
|
||||
|
||||
if signum == signal.SIGINT:
|
||||
ablauf.stop()
|
||||
ablauf.command(commands.ABORT)
|
||||
if signum == signal.SIGSTOP:
|
||||
ablauf.pause()
|
||||
if signum == signal.SIGCONT:
|
||||
ablauf.cont()
|
||||
ablauf.command(commands.PAUSE)
|
||||
if signum == signal.SIGUSR1:
|
||||
ablauf.command(commands.RUN)
|
||||
if signum == signal.SIGHUP:
|
||||
if stirr_isOn:
|
||||
ablauf.command(commands.STIRR_OFF)
|
||||
stirr_isOn = False
|
||||
else:
|
||||
ablauf.command(commands.STIRR_ON)
|
||||
stirr_isOn = True
|
||||
|
||||
# Set the signal handler and a 5-second alarm
|
||||
signal.signal(signal.SIGABRT, handler)
|
||||
signal.signal(signal.SIGINT, handler)
|
||||
signal.signal(signal.SIGCONT, handler)
|
||||
signal.signal(signal.SIGUSR1, handler)
|
||||
signal.signal(signal.SIGHUP, handler)
|
||||
|
||||
fp = open("brewpi.json")
|
||||
configJson = json.load(fp)
|
||||
@@ -77,7 +88,7 @@ if __name__ == '__main__':
|
||||
fp = open("Rezept-001.json")
|
||||
recipeJson = json.load(fp)
|
||||
|
||||
ablauf.start(recipeJson)
|
||||
ablauf.setRecipe(recipeJson)
|
||||
ablauf.wait_finished()
|
||||
|
||||
results_plot(ablauf)
|
||||
|
||||
Reference in New Issue
Block a user