From aa84c3e6b86b56d571d5707fea1ddecf9c329106 Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Wed, 16 May 2018 15:30:13 +0200 Subject: [PATCH] trickle: remove msg_time member from struct The msg_time member is only locally used and set before read. It can be removed as the state kept by the member is not used. --- sys/include/trickle.h | 1 - sys/trickle/trickle.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/include/trickle.h b/sys/include/trickle.h index bad2118102..f2c671feef 100644 --- a/sys/include/trickle.h +++ b/sys/include/trickle.h @@ -58,7 +58,6 @@ typedef struct { trickle_callback_t callback; /**< callback function and parameter that trickle calls after each interval */ msg_t msg; /**< the msg_t to use for intervals */ - uint64_t msg_time; /**< interval in ms */ xtimer_t msg_timer; /**< xtimer to send a msg_t to the target thread for a new interval */ } trickle_t; diff --git a/sys/trickle/trickle.c b/sys/trickle/trickle.c index 1a36723ad6..cad07fd6d0 100644 --- a/sys/trickle/trickle.c +++ b/sys/trickle/trickle.c @@ -51,8 +51,8 @@ void trickle_interval(trickle_t *trickle) /* old_interval == trickle->I / 2 */ trickle->t = random_uint32_range(old_interval, trickle->I); - trickle->msg_time = (trickle->t + diff) * MS_PER_SEC; - xtimer_set_msg64(&trickle->msg_timer, trickle->msg_time, &trickle->msg, + uint64_t msg_time = (trickle->t + diff) * US_PER_MS; + xtimer_set_msg64(&trickle->msg_timer, msg_time, &trickle->msg, trickle->pid); }