sc_gnrc_rpl: adjust rpl shell for xtimer usage

This commit is contained in:
Cenk Gündoğan 2015-09-04 13:20:49 +02:00 committed by Kaspar Schleiser
parent 50392b6256
commit 3609dce47d
2 changed files with 13 additions and 11 deletions

View File

@ -229,8 +229,8 @@ void _update_lifetime(void)
gnrc_rpl_parent_update(dodag, NULL);
continue;
}
else if ((int64_t)(parent->lifetime - now) <= (int64_t) (GNRC_RPL_LIFETIME_UPDATE_STEP
* SEC_IN_USEC * 2)) {
else if ((int64_t)(parent->lifetime - now) <=
(int64_t) (GNRC_RPL_LIFETIME_UPDATE_STEP * SEC_IN_USEC * 2)) {
gnrc_rpl_send_DIS(parent->dodag, &parent->addr);
}
}

View File

@ -273,9 +273,9 @@ int _gnrc_rpl_dodag_show(void)
gnrc_rpl_dodag_t *dodag = NULL;
char addr_str[IPV6_ADDR_MAX_STR_LEN];
timex_t now, cleanup;
uint32_t cleanup;
uint64_t tc, ti, xnow = xtimer_now64();
vtimer_now(&now);
for (uint8_t i = 0; i < GNRC_RPL_INSTANCES_NUMOF; ++i) {
if (gnrc_rpl_instances[i].state == 0) {
continue;
@ -293,19 +293,21 @@ int _gnrc_rpl_dodag_show(void)
| dodag->trickle.msg_interval_timer.target) - xnow;
ti = (int64_t) ti < 0 ? 0 : ti / SEC_IN_USEC;
cleanup = timex_sub(dodag->cleanup_timer.absolute, now);
timex_normalize(&cleanup);
printf("\tdodag [%s | R: %d | CL: %" PRIu32 "s | \
TR(I=[%d,%d], k=%d, c=%d, TC=%" PRIu64 "s, TI=%" PRIu64 "s)]\n",
cleanup = dodag->cleanup_timer.target - xtimer_now();
cleanup = (int32_t) cleanup < 0 ? 0 : cleanup / SEC_IN_USEC;
printf("\tdodag [%s | R: %d | CL: %" PRIu32 "s | "
"TR(I=[%d,%d], k=%d, c=%d, TC=%" PRIu64 "s, TI=%" PRIu64 "s)]\n",
ipv6_addr_to_str(addr_str, &dodag->dodag_id, sizeof(addr_str)),
dodag->my_rank, ((int32_t) cleanup.seconds) > 0 ? cleanup.seconds : 0,
dodag->my_rank, (((int32_t) cleanup < 0) ? 0 : cleanup/SEC_IN_USEC),
(1 << dodag->dio_min), dodag->dio_interval_doubl,
dodag->trickle.k, dodag->trickle.c, tc, ti);
gnrc_rpl_parent_t *parent;
LL_FOREACH(dodag->parents, parent) {
printf("\t\tparent [addr: %s | rank: %d | lifetime: %" PRIu32 "s]\n",
printf("\t\tparent [addr: %s | rank: %d | lifetime: %" PRIu64 "s]\n",
ipv6_addr_to_str(addr_str, &parent->addr, sizeof(addr_str)),
parent->rank, (parent->lifetime.seconds - now.seconds));
parent->rank, ((int64_t) (parent->lifetime - xnow) < 0 ? 0
: (parent->lifetime - xnow) / SEC_IN_USEC));
}
}
}