RPL probing: make delay function user-configurable

This commit is contained in:
Simon Duquennoy 2015-05-08 10:23:03 +02:00
parent 2dd182f4a8
commit 6a5f238255
2 changed files with 11 additions and 3 deletions

View File

@ -249,4 +249,14 @@
#define RPL_PROBING_SEND_FUNC(instance, addr) dio_output((instance), (addr)) #define RPL_PROBING_SEND_FUNC(instance, addr) dio_output((instance), (addr))
#endif #endif
/*
* Function used to calculate next RPL probing interval
* */
#ifdef RPL_CONF_PROBING_DELAY_FUNC
#define RPL_PROBING_DELAY_FUNC RPL_CONF_PROBING_DELAY_FUNC
#else
#define RPL_PROBING_DELAY_FUNC() ((RPL_PROBING_INTERVAL / 2) \
+ random_rand() % (RPL_PROBING_INTERVAL))
#endif
#endif /* RPL_CONF_H */ #endif /* RPL_CONF_H */

View File

@ -414,9 +414,7 @@ handle_probing_timer(void *ptr)
void void
rpl_schedule_probing(rpl_instance_t *instance) rpl_schedule_probing(rpl_instance_t *instance)
{ {
clock_time_t delay = (RPL_PROBING_INTERVAL / 2) + ctimer_set(&instance->probing_timer, RPL_PROBING_DELAY_FUNC(),
random_rand() % (RPL_PROBING_INTERVAL / 2);
ctimer_set(&instance->probing_timer, delay,
handle_probing_timer, instance); handle_probing_timer, instance);
} }
#endif /* RPL_WITH_PROBING */ #endif /* RPL_WITH_PROBING */