Added line drawing code when compiled for the netsim target

This commit is contained in:
adamdunkels 2008-02-03 20:52:41 +00:00
parent f5b08ff115
commit 53f0b7feb8
2 changed files with 17 additions and 2 deletions

View File

@ -36,7 +36,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: collect.c,v 1.5 2008/01/24 21:11:40 adamdunkels Exp $ * $Id: collect.c,v 1.6 2008/02/03 20:52:41 adamdunkels Exp $
*/ */
/** /**
@ -203,6 +203,9 @@ node_packet_received(struct ruc_conn *c, rimeaddr_t *from, u8_t seqno)
tc->forwarding = 1; tc->forwarding = 1;
n = neighbor_best(); n = neighbor_best();
if(n != NULL) { if(n != NULL) {
#if NETSIM
ether_set_line(n->addr.u8[0], n->addr.u8[1]);
#endif /* NETSIM */
ruc_send(c, &n->addr, hdr->rexmits); ruc_send(c, &n->addr, hdr->rexmits);
} }
return; return;
@ -321,6 +324,9 @@ collect_send(struct collect_conn *tc, int rexmits)
n = neighbor_best(); n = neighbor_best();
if(n != NULL) { if(n != NULL) {
/* printf("Sending to best neighbor\n");*/ /* printf("Sending to best neighbor\n");*/
#if NETSIM
ether_set_line(n->addr.u8[0], n->addr.u8[1]);
#endif /* NETSIM */
ruc_send(&tc->ruc_conn, &n->addr, rexmits); ruc_send(&tc->ruc_conn, &n->addr, rexmits);
} else { } else {
/* printf("Didn't find any neighbor\n");*/ /* printf("Didn't find any neighbor\n");*/

View File

@ -33,7 +33,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: route-discovery.c,v 1.7 2007/08/30 14:39:17 matsutsuka Exp $ * $Id: route-discovery.c,v 1.8 2008/02/03 20:52:41 adamdunkels Exp $
*/ */
/** /**
@ -63,6 +63,11 @@ struct rrep_hdr {
rimeaddr_t originator; rimeaddr_t originator;
}; };
#if NETSIM
#include "ether.h"
#endif
#define DEBUG 0 #define DEBUG 0
#if DEBUG #if DEBUG
#include <stdio.h> #include <stdio.h>
@ -124,6 +129,10 @@ insert_route(rimeaddr_t *originator, rimeaddr_t *last_hop, u8_t hops)
last_hop->u8[0], last_hop->u8[1], last_hop->u8[0], last_hop->u8[1],
hops); hops);
route_add(originator, last_hop, hops, 0); route_add(originator, last_hop, hops, 0);
#if NETSIM
ether_set_line(last_hop->u8[0], last_hop->u8[1]);
#endif
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/