Changed the name of macros defined in neighbor-info.h to have the NEIGHBOR_INFO prefix.

This commit is contained in:
Adam Dunkels 2011-02-13 21:21:13 +01:00
parent 15bf73ba08
commit ed3995960d
2 changed files with 6 additions and 6 deletions

View file

@ -62,13 +62,13 @@ update_etx(const rimeaddr_t *dest, int packet_etx)
etxp = (uint8_t *)neighbor_attr_get_data(&etx, dest); etxp = (uint8_t *)neighbor_attr_get_data(&etx, dest);
if(etxp == NULL || *etxp == 0) { if(etxp == NULL || *etxp == 0) {
recorded_etx = ETX2FIX(ETX_FIRST_GUESS); recorded_etx = NEIGHBOR_INFO_ETX2FIX(ETX_FIRST_GUESS);
} else { } else {
recorded_etx = *etxp; recorded_etx = *etxp;
} }
/* Update the EWMA of the ETX for the neighbor. */ /* Update the EWMA of the ETX for the neighbor. */
packet_etx = ETX2FIX(packet_etx); packet_etx = NEIGHBOR_INFO_ETX2FIX(packet_etx);
new_etx = ((uint16_t)recorded_etx * ETX_ALPHA + new_etx = ((uint16_t)recorded_etx * ETX_ALPHA +
(uint16_t)packet_etx * (ETX_SCALE - ETX_ALPHA)) / ETX_SCALE; (uint16_t)packet_etx * (ETX_SCALE - ETX_ALPHA)) / ETX_SCALE;
PRINTF("neighbor-info: ETX changed from %d to %d (packet ETX = %d) %d\n", PRINTF("neighbor-info: ETX changed from %d to %d (packet ETX = %d) %d\n",
@ -95,7 +95,7 @@ add_neighbor(const rimeaddr_t *addr)
break; break;
default: default:
if(subscriber_callback != NULL) { if(subscriber_callback != NULL) {
subscriber_callback(addr, 1, ETX2FIX(ETX_FIRST_GUESS)); subscriber_callback(addr, 1, NEIGHBOR_INFO_ETX2FIX(ETX_FIRST_GUESS));
} }
break; break;
} }

View file

@ -44,12 +44,12 @@
/* ETX_DIVISOR is the value that a fix-point representation of the ETX /* ETX_DIVISOR is the value that a fix-point representation of the ETX
should be divided by in order to obtain the integer representation. */ should be divided by in order to obtain the integer representation. */
#define ETX_DIVISOR 16 #define NEIGHBOR_INFO_ETX_DIVISOR 16
/* Macros for converting between a fix-point representation of the ETX /* Macros for converting between a fix-point representation of the ETX
and a integer representation. */ and a integer representation. */
#define ETX2FIX(etx) ((etx) << 4) #define NEIGHBOR_INFO_ETX2FIX(etx) ((etx) * NEIGHBOR_INFO_ETX_DIVISOR)
#define FIX2ETX(fix) ((fix) >> 4) #define NEIGHBOR_INFO_FIX2ETX(fix) ((fix) / NEIGHBOR_INFO_ETX_DIVISOR)
typedef void (*neighbor_info_subscriber_t)(const rimeaddr_t *, int known, int etx); typedef void (*neighbor_info_subscriber_t)(const rimeaddr_t *, int known, int etx);