]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/platforms/eyesIFX/net/lqi/LqiRoutingEngineP.nc
be a bit more conservative when choosing links
[tinyos-2.x.git] / tos / platforms / eyesIFX / net / lqi / LqiRoutingEngineP.nc
index c226c669c124465cdc0bc2bb75d5f5dc885c5eec..a78aa54031770e9fb6e7fd766f9935772af4c509 100644 (file)
@@ -113,19 +113,19 @@ implementation {
   int16_t gRecentOriginPacketSeqNo[MHOP_HISTORY_SIZE];
 
   uint16_t adjustLQI(uint8_t val) {
-    uint16_t result;                
-    if(val > 30) val = 30;
+    uint16_t result;
+    if(val >= 80) val = 80;                 
     result = 80 - val;
     result = (((result * result) >> 3) * result) >> 3;
     return result;
   }
 
   lqi_header_t* getHeader(message_t* msg) {
-    return (lqi_header_t*)call Packet.getPayload(msg, NULL);
+    return (lqi_header_t*)call Packet.getPayload(msg, sizeof(lqi_header_t));
   }
   
   lqi_beacon_msg_t* getBeacon(message_t* msg) {
-    return (lqi_beacon_msg_t*)call Packet.getPayload(msg, NULL);
+    return (lqi_beacon_msg_t*)call Packet.getPayload(msg, sizeof(lqi_beacon_msg_t));
   }
 
   task void SendRouteTask() {
@@ -288,7 +288,7 @@ implementation {
   }
 
   command error_t RouteSelect.initializeFields(message_t* msg) {
-    lqi_header_t* header = (lqi_header_t*)call Packet.getPayload(msg, NULL);
+    lqi_header_t* header = (lqi_header_t*)call Packet.getPayload(msg, sizeof(lqi_header_t));
 
     header->originaddr = TOS_NODE_ID;
     header->originseqno = gOriginSeqNo++;