From 00bc9403fe210b3b919ae3efa58828ddec11e08b Mon Sep 17 00:00:00 2001 From: Philip Gladstone Date: Thu, 9 Feb 2017 15:53:12 -0500 Subject: [PATCH] Fix the adjusting of the time when there is a rollover (#1788) --- app/modules/gpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/modules/gpio.c b/app/modules/gpio.c index 0b57c462..21f1d2fd 100644 --- a/app/modules/gpio.c +++ b/app/modules/gpio.c @@ -43,7 +43,8 @@ static void gpio_intr_callback_task (task_param_t param, uint8 priority) // Now must be >= then . Add the missing bits if (then > (now & 0xffffff)) { - then += 0x1000000; + // Now must have rolled over since the interrupt -- back it down + now -= 0x1000000; } then = (then + (now & 0x7f000000)) & 0x7fffffff;