diff --git a/core/dev/cc2420.h b/core/dev/cc2420.h index fa9925aaf..7a2651902 100644 --- a/core/dev/cc2420.h +++ b/core/dev/cc2420.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: cc2420.h,v 1.3 2006/08/09 17:39:39 bg- Exp $ + * @(#)$Id: cc2420.h,v 1.4 2007/04/04 11:46:47 bg- Exp $ */ #ifndef CC2420_H @@ -128,6 +128,7 @@ void cc2420_input(const struct hdr_802_15 *hdr, u8_t hdr_len, const u8_t *payload, u8_t payload_len); /* Is mac far away? remote=1, local=0, don't know=-1. */ +enum { REMOTE_MAYBE = -1, REMOTE_NO = 0, REMOTE_YES = 1 }; int cc2420_check_remote(u16_t mac); void cc2420_recv_ok(uip_ipaddr_t *from); diff --git a/core/dev/cc2420_send_uaodv.c b/core/dev/cc2420_send_uaodv.c index 09a02fab8..8ebf5ee6c 100644 --- a/core/dev/cc2420_send_uaodv.c +++ b/core/dev/cc2420_send_uaodv.c @@ -29,9 +29,6 @@ cc2420_send_uaodv(void) int ret; struct hdr_802_15 h; - u8_t color = (cc2420_ack_received) ? LEDS_BLUE : LEDS_RED; - leds_toggle(color); - h.len = MAC_HDR_LEN + uip_len + 2; /* Including footer[2]. */ h.fc0 = FC0_TYPE_DATA | FC0_REQ_ACK | FC0_INTRA_PAN; h.fc1 = FC1_DST_16 | FC1_SRC_16; @@ -55,7 +52,7 @@ cc2420_send_uaodv(void) if (route == NULL) { h.dst = next_gw->u16[1]; /* try local while waiting for route */ } else { - if (cc2420_check_remote(route->nexthop.u16[1]) == 1) { + if (cc2420_check_remote(route->nexthop.u16[1]) == REMOTE_YES) { PRINTF("LOST 0x%04x\n", route->nexthop.u16[1]); /* Send bad route notification? */ #ifdef UAODV_BAD_ROUTE @@ -71,6 +68,9 @@ cc2420_send_uaodv(void) } } + u8_t color = (cc2420_ack_received) ? LEDS_BLUE : LEDS_RED; + leds_toggle(color); + /* Don't request MAC level ACKs for broadcast packets. */ if (h.dst == 0xffff) h.fc0 &= ~FC0_REQ_ACK;