tests/wipy: Improve robustness of rtc_irq test.

This commit is contained in:
Daniel Campora 2015-09-27 13:18:12 +02:00
parent 8192310dad
commit 0a7e4fa5ce
3 changed files with 5 additions and 10 deletions

View File

@ -82,6 +82,8 @@ rtc.alarm(time=(2015, 8, 29, 9, 0, 45))
time.sleep_ms(1000)
left = rtc.alarm_left()
print(abs(left-44000) <= 90)
rtc.alarm_cancel()
rtc.deinit()
# next ones must raise
try:

View File

@ -69,13 +69,13 @@ print(abs(t1 - t0 - 500) < 20)
# deep sleep repeated mode
rtc.alarm_cancel()
rtc_irq_count = 0
rtc.alarm(time=250, repeat=True)
rtc.alarm(time=500, repeat=True)
t0 = rtc_ticks_ms(rtc)
rtc_irq = rtc.irq(trigger=RTC.ALARM0, handler=alarm_handler, wake=Sleep.SUSPENDED)
while rtc_irq_count < 10:
while rtc_irq_count < 3:
Sleep.suspend()
t1 = rtc_ticks_ms(rtc)
print(abs(t1 - t0 - (250 * rtc_irq_count)) < 25)
print(abs(t1 - t0 - (500 * rtc_irq_count)) < 25)
# next ones must raise
try:

View File

@ -7,12 +7,5 @@ True
True
True
True
True
True
True
True
True
True
True
Exception
Exception