Small bugfix while waiting for first two interrupts before entering mainloop

This commit is contained in:
telegnom 2015-04-08 13:41:58 +02:00
parent 771cc49e2d
commit 284e8d8209

View File

@ -26,23 +26,25 @@ def trans():
def readgpio():
gpio = open("/sys/class/gpio/gpio24/value", "r")
gpiopoll = poll()
gpiopoll.register(gpio, POLLERR)
if sys.stdout.isatty():
print("wait for 2 interrupts...")
gpioevent = gpiopoll.poll()
gpio.read()
gpio.seek(0)
last = time.time()
gpioevent = gpiopoll.poll()
gpio.read()
gpio.seek(0)
if sys.stdout.isatty():
print("start readgpio mainloop")
while True:
gpioevent = gpiopoll.poll()
gpioval = gpio.read(1)
gpio = open("/sys/class/gpio/gpio24/value", "r")
gpiopoll = poll()
gpiopoll.register(gpio, POLLERR)
if sys.stdout.isatty():
print("wait for 2 interrupts...")
gpioevent = gpiopoll.poll()
gpio.read()
gpio.seek(0)
if sys.stdout.isatty():
print("wait for 1 interrupt....")
gpioevent = gpiopoll.poll()
last = time.time()
gpio.read()
gpio.seek(0)
if sys.stdout.isatty():
print("start readgpio mainloop")
while True:
gpioevent = gpiopoll.poll()
gpioval = gpio.read(1)
gpio.seek(0)
if gpioval == '0':
now = time.time()
@ -84,4 +86,4 @@ if __name__ == "__main__":
th2.start()
while True:
time.sleep(1)
time.sleep(1)