From: smckown Date: Wed, 4 Nov 2009 19:17:56 +0000 (+0000) Subject: Replace a cardinal value with its proper template argument in WindVaneP. X-Git-Tag: release/2.1.0-2~22 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=d7953c242529726be3c6743f499781db79d94f7d Replace a cardinal value with its proper template argument in WindVaneP. The wind vane infrastructure works with 128 sectors, the max, which offers approximately a 3 degree resolution. This comes at the cost of an additional 129 bytes of RAM over using 32 sectors. --- diff --git a/tos/platforms/tmirws/sensors/WindVaneP.nc b/tos/platforms/tmirws/sensors/WindVaneP.nc index ef1543c4..65716f63 100644 --- a/tos/platforms/tmirws/sensors/WindVaneP.nc +++ b/tos/platforms/tmirws/sensors/WindVaneP.nc @@ -72,7 +72,7 @@ implementation { /* Convert a degree heading into a sector */ uint16_t degreeToSector(uint16_t degree) { - return ((degree * sectors + 180) / 360) % 32; + return ((degree * sectors + 180) / 360) % sectors; } /* Return the # of sectors clockwise along the compass from start to end. */