From cd08939b3850ed50fdc9e779227faa6228bedb27 Mon Sep 17 00:00:00 2001 From: nvt-se Date: Wed, 15 Dec 2010 14:35:07 +0000 Subject: [PATCH] Corrected the reported ETX in the initial callback, and fixed the coding style --- core/net/neighbor-info.c | 17 +++++++---------- core/net/rpl/rpl.c | 6 ++---- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/core/net/neighbor-info.c b/core/net/neighbor-info.c index 594172bc7..99039a41b 100644 --- a/core/net/neighbor-info.c +++ b/core/net/neighbor-info.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: neighbor-info.c,v 1.17 2010/10/28 08:54:54 joxe Exp $ + * $Id: neighbor-info.c,v 1.18 2010/12/15 14:35:07 nvt-se Exp $ */ /** * \file @@ -40,13 +40,8 @@ #include "net/neighbor-info.h" #include "net/neighbor-attr.h" -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif /* DEBUG */ +#define DEBUG DEBUG_NONE +#include "net/uip-debug.h" #define ETX_LIMIT 15 #define ETX_SCALE 100 @@ -100,7 +95,7 @@ add_neighbor(const rimeaddr_t *addr) break; default: if(subscriber_callback != NULL) { - subscriber_callback(addr, 1, ETX_FIRST_GUESS); + subscriber_callback(addr, 1, ETX2FIX(ETX_FIRST_GUESS)); } break; } @@ -139,7 +134,9 @@ neighbor_info_packet_sent(int status, int numtx) break; } - if (packet_etx > 0) update_etx(dest, packet_etx); + if(packet_etx > 0) { + update_etx(dest, packet_etx); + } } /*---------------------------------------------------------------------------*/ void diff --git a/core/net/rpl/rpl.c b/core/net/rpl/rpl.c index c00962fd6..84e5d7522 100644 --- a/core/net/rpl/rpl.c +++ b/core/net/rpl/rpl.c @@ -32,7 +32,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rpl.c,v 1.13 2010/11/03 15:41:23 adamdunkels Exp $ + * $Id: rpl.c,v 1.14 2010/12/15 14:35:07 nvt-se Exp $ */ /** * \file @@ -128,13 +128,11 @@ rpl_link_neighbor_callback(const rimeaddr_t *addr, int known, int etx) rpl_dag_t *dag; rpl_parent_t *parent; - /* etx = FIX2ETX(etx); */ - uip_ip6addr(&ipaddr, 0xfe80, 0, 0, 0, 0, 0, 0, 0); uip_ds6_set_addr_iid(&ipaddr, (uip_lladdr_t *)addr); PRINTF("RPL: Neighbor "); PRINT6ADDR(&ipaddr); - PRINTF(" is %sknown. ETX = %d\n", known ? "" : "no longer ", etx); + PRINTF(" is %sknown. ETX = %u\n", known ? "" : "no longer ", FIX2ETX(etx)); dag = rpl_get_dag(RPL_DEFAULT_INSTANCE); if(dag == NULL) {