aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/serialhdl.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-03-31 20:48:29 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-04-01 12:26:24 -0400
commit565861f680210ef6f3c13a375d3829ee7b319042 (patch)
tree80d32689301c01a71337182d18397efef8244282 /klippy/serialhdl.py
parent7c991399ac2d411a3cf9fe419f64815f32673bd2 (diff)
downloadkutter-565861f680210ef6f3c13a375d3829ee7b319042.tar.gz
kutter-565861f680210ef6f3c13a375d3829ee7b319042.tar.xz
kutter-565861f680210ef6f3c13a375d3829ee7b319042.zip
reactor: Support pause() command even when the reactor is not running
If the reactor isn't running then implement pause using the system sleep command. This simplifies the users of pause(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/serialhdl.py')
-rw-r--r--klippy/serialhdl.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/klippy/serialhdl.py b/klippy/serialhdl.py
index ef344381..35e2a135 100644
--- a/klippy/serialhdl.py
+++ b/klippy/serialhdl.py
@@ -3,7 +3,7 @@
# Copyright (C) 2016 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import logging, threading, time
+import logging, threading
import serial
import msgproto, chelper, util
@@ -338,10 +338,10 @@ def arduino_reset(serialport, reactor):
# First try opening the port at 1200 baud
ser = serial.Serial(serialport, 1200, timeout=0)
ser.read(1)
- time.sleep(0.100)
+ reactor.pause(reactor.monotonic() + 0.100)
# Then try toggling DTR
ser.dtr = True
- time.sleep(0.100)
+ reactor.pause(reactor.monotonic() + 0.100)
ser.dtr = False
- time.sleep(0.100)
+ reactor.pause(reactor.monotonic() + 0.100)
ser.close()