Fixed debug printfs. Added control of max_rankinc parameter.

This commit is contained in:
nvt-se 2010-10-25 20:03:37 +00:00
parent 19d7543267
commit 127c87efcc

View file

@ -32,7 +32,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: rpl-dag.c,v 1.33 2010/10/22 15:40:10 nvt-se Exp $ * $Id: rpl-dag.c,v 1.34 2010/10/25 20:03:37 nvt-se Exp $
*/ */
/** /**
* \file * \file
@ -117,16 +117,17 @@ remove_parents(rpl_dag_t *dag, rpl_rank_t minimum_rank)
static int static int
should_send_dao(rpl_dag_t *dag, rpl_dio_t *dio, rpl_parent_t *p) should_send_dao(rpl_dag_t *dag, rpl_dio_t *dio, rpl_parent_t *p)
{ {
return 1; return dio->dst_adv_supported;
return dio->dst_adv_supported && dio->dst_adv_trigger && /* return dio->dst_adv_supported && dio->dst_adv_trigger &&
dio->dtsn > p->dtsn && p == dag->preferred_parent; dio->dtsn > p->dtsn && p == dag->preferred_parent;*/
} }
/************************************************************************/ /************************************************************************/
static int static int
acceptable_rank(rpl_dag_t *dag, rpl_rank_t rank) acceptable_rank(rpl_dag_t *dag, rpl_rank_t rank)
{ {
return rank != INFINITE_RANK && return rank != INFINITE_RANK &&
DAG_RANK(rank, dag) <= DAG_RANK(dag->min_rank + dag->max_rankinc, dag); (dag->max_rankinc == 0 ||
DAG_RANK(rank, dag) <= DAG_RANK(dag->min_rank + dag->max_rankinc, dag));
} }
/************************************************************************/ /************************************************************************/
rpl_dag_t * rpl_dag_t *
@ -570,7 +571,7 @@ rpl_process_parent_event(rpl_dag_t *dag, rpl_parent_t *p)
dag->min_rank = dag->rank; dag->min_rank = dag->rank;
} }
PRINTF("RPL: Moving in the DAG from rank %hu to %hu\n", PRINTF("RPL: Moving in the DAG from rank %hu to %hu\n",
old_rank, DAG_RANK(dag->rank)); DAG_RANK(old_rank, dag), DAG_RANK(dag->rank, dag));
PRINTF("RPL: The preferred parent is "); PRINTF("RPL: The preferred parent is ");
PRINT6ADDR(&dag->preferred_parent->addr); PRINT6ADDR(&dag->preferred_parent->addr);
PRINTF(" (rank %u)\n", PRINTF(" (rank %u)\n",