tests/production_tests: in touch test, wait for TOUCH_START first

pull/25/head
Jan Pochyla 7 years ago
parent 49cc4651c2
commit 0aa8cbfe51

@ -63,10 +63,15 @@ def test_touch(v):
while io.poll([io.TOUCH], r, 10000):
pass
# wait for event
touch = False
while True:
if io.poll([io.TOUCH], r, 10000) and r[0] == io.TOUCH and r[1][0] == io.TOUCH_END:
print('OK %d %d' % (r[1][1], r[1][2]))
break
if not touch:
if io.poll([io.TOUCH], r, 10000) and r[0] == io.TOUCH and r[1][0] == io.TOUCH_START:
touch = True
else:
if io.poll([io.TOUCH], r, 10000) and r[0] == io.TOUCH and r[1][0] == io.TOUCH_END:
print('OK %d %d' % (r[1][1], r[1][2]))
break
if utime.ticks_us() > deadline:
print('ERROR TIMEOUT')
break

Loading…
Cancel
Save