]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Bug fix from Avrinash at USC; when detecting a clear channel, you care
authorscipio <scipio>
Fri, 20 Jul 2007 22:35:11 +0000 (22:35 +0000)
committerscipio <scipio>
Fri, 20 Jul 2007 22:35:11 +0000 (22:35 +0000)
about not just noise, but also concurrent transmissions. Before, CpmModelC
was only looking at noise, so it would transmit when other nodes nearby
were transmitting, leading to very pessimistic packet delivery rates.

tos/lib/tossim/CpmModelC.nc

index 59f94e10bbfbac4d264e9cb2767581229baac8c5..1fc5fb649735e0bd6a564f6ca940509a5ef94323 100644 (file)
@@ -200,8 +200,8 @@ implementation {
   }
   
   command bool Model.clearChannel() {
-    dbg("CpmModelC", "Checking clear channel @ %s: %f <= %f \n", sim_time_string(), (double)noise_hash_generation(), clearThreshold);
-    return noise_hash_generation() < clearThreshold;
+    dbg("CpmModelC", "Checking clear channel @ %s: %f <= %f \n", sim_time_string(), (double)packetNoise(NULL), clearThreshold);
+    return packetNoise(NULL) < clearThreshold;
   }
 
   void sim_gain_schedule_ack(int source, sim_time_t t, receive_message_t* r) {