From 02626b91465e353c62f2c5952cfd6a7beaf71fd1 Mon Sep 17 00:00:00 2001 From: scipio Date: Thu, 15 Feb 2007 18:53:26 +0000 Subject: [PATCH] Needed to initialize engine. Fixed bug in packet length calculation that was preventing transmissions. --- tos/lib/net/lqi/LQIMultiHopRouter.nc | 4 +++- tos/lib/net/lqi/MultiHop.h | 1 - tos/lib/net/lqi/MultiHopEngineM.nc | 8 ++++++-- tos/lib/net/lqi/MultiHopLQI.nc | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tos/lib/net/lqi/LQIMultiHopRouter.nc b/tos/lib/net/lqi/LQIMultiHopRouter.nc index c0e8fc02..28467f7a 100644 --- a/tos/lib/net/lqi/LQIMultiHopRouter.nc +++ b/tos/lib/net/lqi/LQIMultiHopRouter.nc @@ -58,12 +58,13 @@ implementation { new AMSenderC(AM_DATAMSG) as DataSender, new AMReceiverC(AM_DATAMSG) as DataReceiver, new TimerMilliC(), - NoLedsC as LedsC, + NoLedsC, LedsC, RandomC, ActiveMessageC, MainC; MainC.SoftwareInit -> MultiHopEngineM; + MainC.SoftwareInit -> MultiHopLQI; components CC2420ActiveMessageC as CC2420; @@ -95,4 +96,5 @@ implementation { MultiHopLQI.CC2420Packet -> CC2420; MultiHopLQI.AMPacket -> ActiveMessageC; MultiHopLQI.Packet -> ActiveMessageC; + MultiHopLQI.Leds -> NoLedsC; } diff --git a/tos/lib/net/lqi/MultiHop.h b/tos/lib/net/lqi/MultiHop.h index 1a2750ad..e1d2c765 100644 --- a/tos/lib/net/lqi/MultiHop.h +++ b/tos/lib/net/lqi/MultiHop.h @@ -83,7 +83,6 @@ typedef nx_struct beacon_msg { nx_uint16_t parent; nx_uint16_t cost; nx_uint16_t hopcount; - nx_uint32_t timestamp; } beacon_msg_t; typedef struct DBGEstEntry { diff --git a/tos/lib/net/lqi/MultiHopEngineM.nc b/tos/lib/net/lqi/MultiHopEngineM.nc index 220c3a1e..cef45000 100644 --- a/tos/lib/net/lqi/MultiHopEngineM.nc +++ b/tos/lib/net/lqi/MultiHopEngineM.nc @@ -119,15 +119,18 @@ implementation { ***********************************************************************/ command error_t Send.send(message_t* pMsg, uint8_t len) { len += sizeof(lqi_header_t); - if (len > call Packet.maxPayloadLength()) { + if (len > call SubPacket.maxPayloadLength()) { + call Leds.led0On(); return ESIZE; } if (call RootControl.isRoot()) { + call Leds.led1On(); return FAIL; } call RouteSelect.initializeFields(pMsg); if (call RouteSelect.selectRoute(pMsg, 0) != SUCCESS) { + call Leds.led2On(); return FAIL; } call PacketAcknowledgements.requestAck(pMsg); @@ -168,7 +171,8 @@ implementation { static message_t* mForward(message_t* msg) { message_t* newMsg = msg; int8_t buf = get_buff(); - + call Leds.led2Toggle(); + if (call RootControl.isRoot()) { return signal Receive.receive(msg, call Packet.getPayload(msg, NULL), call Packet.payloadLength(msg)); } diff --git a/tos/lib/net/lqi/MultiHopLQI.nc b/tos/lib/net/lqi/MultiHopLQI.nc index 9259b3e4..f1c18dfb 100644 --- a/tos/lib/net/lqi/MultiHopLQI.nc +++ b/tos/lib/net/lqi/MultiHopLQI.nc @@ -55,6 +55,7 @@ module MultiHopLQI { interface AMPacket; interface LqiRouteStats; interface CC2420Packet; + interface Leds; } } @@ -190,6 +191,7 @@ implementation { } command error_t RootControl.setRoot() { + call Leds.led2On(); isRoot = TRUE; return SUCCESS; } -- 2.39.2