From 689727028981a755cb87938973c7424bd35e2c61 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Sun, 6 Dec 2009 13:18:32 +0000 Subject: [PATCH] Bugfix to the Contiki LPP encounter timing code: encounters are now properly timed. --- core/net/mac/lpp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/net/mac/lpp.c b/core/net/mac/lpp.c index a22b3ee50..47b3cc201 100644 --- a/core/net/mac/lpp.c +++ b/core/net/mac/lpp.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: lpp.c,v 1.27 2009/11/02 11:58:56 adamdunkels Exp $ + * $Id: lpp.c,v 1.28 2009/12/06 13:18:32 adamdunkels Exp $ */ /** @@ -90,7 +90,7 @@ #ifdef LPP_CONF_OFF_TIME #define OFF_TIME LPP_CONF_OFF_TIME #else -#define OFF_TIME (CLOCK_SECOND / 2) +#define OFF_TIME (CLOCK_SECOND / 2 - LISTEN_TIME) #endif /* LPP_CONF_OFF_TIME */ #define PACKET_LIFETIME (LISTEN_TIME + OFF_TIME) @@ -314,7 +314,7 @@ turn_radio_on_for_neighbor(rimeaddr_t *neighbor, struct queue_list_item *i) time with modulo OFF_TIME. */ now = clock_time(); - wait = ((clock_time_t)(e->time - now)) % (OFF_TIME); + wait = ((clock_time_t)(e->time - now)) % (OFF_TIME + LISTEN_TIME) - LISTEN_TIME; /* printf("now %d e %d e-n %d w %d %d\n", now, e->time, e->time - now, (e->time - now) % (OFF_TIME), wait);