From 590009b1e92cd2324b391e8e5397f605c8a7026b Mon Sep 17 00:00:00 2001 From: andreaskoepke Date: Thu, 14 Aug 2008 13:14:09 +0000 Subject: [PATCH] improve computation of mean --- tos/platforms/eyesIFX/byte_radio/RssiFixedThresholdCMP.nc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tos/platforms/eyesIFX/byte_radio/RssiFixedThresholdCMP.nc b/tos/platforms/eyesIFX/byte_radio/RssiFixedThresholdCMP.nc index b1fd2097..cf9d4ad1 100644 --- a/tos/platforms/eyesIFX/byte_radio/RssiFixedThresholdCMP.nc +++ b/tos/platforms/eyesIFX/byte_radio/RssiFixedThresholdCMP.nc @@ -286,7 +286,7 @@ implementation task void UpdateNoiseFloorTask() { shellsort(rssisamples,NSAMPLES); atomic { - noisefloor = (5*noisefloor + rssisamples[NSAMPLES/2])/6; + noisefloor = (5*noisefloor + rssisamples[NSAMPLES/2] + 3)/6; rssiindex = 0; } sdDebug(60000U + noisefloor); @@ -318,7 +318,7 @@ implementation } else { shellsort(rssisamples,NSAMPLES); if(rssisamples[MINIMUM_POSITION] < noisefloor + THREE_SIGMA) { - noisefloor = (7*noisefloor + rssisamples[NSAMPLES/2])/8; + noisefloor = (7*noisefloor + rssisamples[NSAMPLES/2] + 4)/8; ++deadlockCounter; } else { @@ -411,6 +411,6 @@ implementation async command uint16_t BatteryLevel.getLevel() { uint16_t l; atomic l = batteryLevel; - return (uint32_t)l*39>>5; + return (uint32_t)(l+3)*6/5; } } -- 2.39.2