From: Benjamin Braatz Date: Wed, 17 Feb 2021 11:52:32 +0000 (+0100) Subject: Wait before changing mode X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=e5c7262791a36fd9b522a790c6b0cd16a48adc1b;p=graphit%2Fschaltschrank.git Wait before changing mode --- diff --git a/schaltschrank/config.py b/schaltschrank/config.py index ab1aa16..902cd20 100644 --- a/schaltschrank/config.py +++ b/schaltschrank/config.py @@ -65,6 +65,7 @@ async def process_andpin_conf(andpin_conf, queues, pins): async def fu_handler(queues, fu): in_queue = asyncio.Queue() queues.append(in_queue) + previous = '' while True: event = await in_queue.get() if event['name'] == 'motorstop': @@ -72,11 +73,16 @@ async def fu_handler(queues, fu): for out_queue in queues: await out_queue.put({'name': 'motoraus'}) elif event['name'] == 'dauervor': + if previous != 'dauervor': + await asyncio.sleep(1) for out_queue in queues: await out_queue.put({'name': 'motoran'}) await fu.set_frequency(50) await fu.start_inverter() + previous = 'dauervor' elif event['name'] == 'tippenvor': + if previous != 'tippenvor': + await asyncio.sleep(1) for out_queue in queues: await out_queue.put({'name': 'motoran'}) await fu.set_frequency(30) @@ -88,7 +94,10 @@ async def fu_handler(queues, fu): await asyncio.sleep(0.5) for out_queue in queues: await out_queue.put({'name': 'tippenfertig'}) + previous = 'tippenvor' elif event['name'] == 'tippenrück': + if previous != 'tippenrück': + await asyncio.sleep(1) for out_queue in queues: await out_queue.put({'name': 'motoran'}) await fu.set_frequency(-30) @@ -100,6 +109,7 @@ async def fu_handler(queues, fu): await asyncio.sleep(0.5) for out_queue in queues: await out_queue.put({'name': 'tippenfertig'}) + previous = 'tippenrück' in_queue.task_done()