From 0aa8cbfe513366799a76497dff1808c615102538 Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Wed, 20 Sep 2017 14:05:03 +0200 Subject: [PATCH] tests/production_tests: in touch test, wait for TOUCH_START first --- tests/production_tests/main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/production_tests/main.py b/tests/production_tests/main.py index 34d86c3d10..24c13d5d3d 100644 --- a/tests/production_tests/main.py +++ b/tests/production_tests/main.py @@ -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