From 2b13e010fe9542bbca8287949880cef3112a94a3 Mon Sep 17 00:00:00 2001 From: smckown Date: Wed, 4 Nov 2009 19:17:59 +0000 Subject: [PATCH] Chagne the wind vane compass accumulator from an uint16_t to an uint8_t array. We are suposed to accumulate wind readings every 2 minutes, which is only 120 points at one per second. --- tos/platforms/tmirws/sensors/WindVaneP.nc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tos/platforms/tmirws/sensors/WindVaneP.nc b/tos/platforms/tmirws/sensors/WindVaneP.nc index 8ec74fc5..8557c8cc 100644 --- a/tos/platforms/tmirws/sensors/WindVaneP.nc +++ b/tos/platforms/tmirws/sensors/WindVaneP.nc @@ -49,7 +49,7 @@ generic module WindVaneP(uint8_t sectors) { } } implementation { - uint16_t m_compass[sectors]; + uint8_t m_compass[sectors]; bool m_overflow; wind_vane_t* m_data; @@ -69,7 +69,7 @@ implementation { } /* Convert a degree heading into a sector */ - uint16_t degreeToSector(uint16_t degree) + uint8_t degreeToSector(uint16_t degree) { return ((degree * sectors + 180) / 360) % sectors; } @@ -83,7 +83,7 @@ implementation { /* circularly examine compass, starting with pos + 1, for the next compass * position having a value of zero. */ - uint8_t nextNonZero(uint16_t* compass, uint8_t pos) + uint8_t nextNonZero(uint8_t* compass, uint8_t pos) { do { pos = (pos + 1) % sectors; @@ -91,7 +91,7 @@ implementation { return pos; } - bool isCompassEmpty(uint16_t* compass) + bool isCompassEmpty(uint8_t* compass) { int i; @@ -105,7 +105,7 @@ implementation { /* Reduce all compass headings equally until a compass heading has a value * of zero. */ - void minimizeCompass(uint16_t* compass) + void minimizeCompass(uint8_t* compass) { uint8_t min = 255; int i; @@ -124,7 +124,7 @@ implementation { * that arc in m_data's left and right fields. The compass arc is always * defined clockwise, from left to right. */ - void findArc(uint16_t* compass) + void findArc(uint8_t* compass) { uint8_t begin; uint8_t save = 255; @@ -146,7 +146,7 @@ implementation { m_data->left = (save + dist) % sectors; } - void calcAvg(uint16_t* compass) + void calcAvg(uint8_t* compass) { /* Find the average compass heading */ uint32_t sum = 0; @@ -208,7 +208,7 @@ implementation { task void readCompass() { bool overflow; - uint16_t compass[sectors]; + uint8_t compass[sectors]; wind_vane_t* data = m_data; atomic { -- 2.39.2