TSCH: map RPL trickle interval to TSCH EB period

This commit is contained in:
Simon Duquennoy 2016-06-23 18:41:40 +02:00
parent a8989f9f1c
commit ab706a6f33
3 changed files with 11 additions and 4 deletions

View File

@ -85,7 +85,7 @@ tsch_rpl_callback_new_dio_interval(uint8_t dio_interval)
tsch_set_coordinator(1);
}
/* Set EB period */
tsch_set_eb_period(TSCH_EB_PERIOD);
tsch_set_eb_period((CLOCK_SECOND * 1UL << dag->instance->dio_intcurrent) / 1000);
/* Set join priority based on RPL rank */
tsch_set_join_priority(DAG_RANK(dag->rank, dag->instance) - 1);
} else {

View File

@ -189,7 +189,7 @@ tsch_set_join_priority(uint8_t jp)
void
tsch_set_eb_period(uint32_t period)
{
tsch_current_eb_period = period;
tsch_current_eb_period = MIN(period, TSCH_MAX_EB_PERIOD);
}
/*---------------------------------------------------------------------------*/
static void

View File

@ -60,7 +60,14 @@
#ifdef TSCH_CONF_EB_PERIOD
#define TSCH_EB_PERIOD TSCH_CONF_EB_PERIOD
#else
#define TSCH_EB_PERIOD (4 * CLOCK_SECOND)
#define TSCH_EB_PERIOD (16 * CLOCK_SECOND)
#endif
/* Max Period between two consecutive EBs */
#ifdef TSCH_CONF_MAX_EB_PERIOD
#define TSCH_MAX_EB_PERIOD TSCH_CONF_MAX_EB_PERIOD
#else
#define TSCH_MAX_EB_PERIOD (50 * CLOCK_SECOND)
#endif
/* Max acceptable join priority */
@ -157,7 +164,7 @@ extern const struct mac_driver tschmac_driver;
/* The the TSCH join priority */
void tsch_set_join_priority(uint8_t jp);
/* The the period at which EBs are sent */
/* The period at which EBs are sent */
void tsch_set_eb_period(uint32_t period);
/* Set the node as PAN coordinator */
void tsch_set_coordinator(int enable);