Changed the variable name local_confidence to etx to better reflect what it was used for

This commit is contained in:
Adam Dunkels 2011-02-11 14:18:57 +01:00
parent ba6bf7dd6b
commit 706045120f
4 changed files with 13 additions and 8 deletions

View File

@ -56,6 +56,8 @@
#define DEBUG DEBUG_NONE
#include "net/uip-debug.h"
#include "net/neighbor-info.h"
/************************************************************************/
extern rpl_of_t RPL_OF;
static rpl_of_t * const objective_functions[] = {&RPL_OF};
@ -92,6 +94,9 @@ static rpl_of_t * const objective_functions[] = {&RPL_OF};
#else
#define RPL_DIO_INTERVAL_DOUBLINGS RPL_CONF_DIO_INTERVAL_DOUBLINGS
#endif /* !RPL_CONF_DIO_INTERVAL_DOUBLINGS */
#define INITIAL_ETX ETX_DIVISOR * 5
/************************************************************************/
/* Allocate parents from the same static MEMB chunk to reduce memory waste. */
MEMB(parent_memb, struct rpl_parent, RPL_MAX_PARENTS);
@ -277,7 +282,7 @@ rpl_add_parent(rpl_dag_t *dag, rpl_dio_t *dio, uip_ipaddr_t *addr)
memcpy(&p->addr, addr, sizeof(p->addr));
p->dag = dag;
p->rank = dio->rank;
p->local_confidence = 0;
p->etx = INITIAL_ETX;
p->dtsn = 0;
list_add(dag->parents, p);
@ -423,7 +428,7 @@ join_dag(uip_ipaddr_t *from, rpl_dio_t *dio)
}
PRINTF("succeeded\n");
p->local_confidence = 0; /* The lowest confidence for new parents. */
p->etx = INITIAL_ETX; /* The lowest confidence for new parents. */
/* Determine the objective function by using the
objective code point of the DIO. */

View File

@ -118,10 +118,10 @@ calculate_rank(rpl_parent_t *p, rpl_rank_t base_rank)
rank_increase = INITIAL_LINK_METRIC * DEFAULT_MIN_HOPRANKINC;
} else {
dag = (rpl_dag_t *)p->dag;
if(p->local_confidence == 0) {
p->local_confidence = INITIAL_LINK_METRIC * ETX_DIVISOR;
if(p->etx == 0) {
p->etx = INITIAL_LINK_METRIC * ETX_DIVISOR;
}
rank_increase = (p->local_confidence * dag->min_hoprankinc) / ETX_DIVISOR;
rank_increase = (p->etx * dag->min_hoprankinc) / ETX_DIVISOR;
if(base_rank == 0) {
base_rank = p->rank;
}

View File

@ -150,11 +150,11 @@ rpl_link_neighbor_callback(const rimeaddr_t *addr, int known, int etx)
return;
}
if(etx != parent->local_confidence) {
if(etx != parent->etx) {
/* Trigger DAG rank recalculation. */
parent->updated = 1;
}
parent->local_confidence = etx;
parent->etx = etx;
if(dag->of->parent_state_callback != NULL) {
dag->of->parent_state_callback(parent, known, etx);

View File

@ -207,7 +207,7 @@ struct rpl_parent {
void *dag;
uip_ipaddr_t addr;
rpl_rank_t rank;
uint8_t local_confidence;
uint8_t etx;
uint8_t dtsn;
uint8_t updated;
};