]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Chagne the wind vane compass accumulator from an uint16_t to an uint8_t array.
authorsmckown <smckown@4bc1554a-c7f2-4f65-a403-e0be01f0239c>
Wed, 4 Nov 2009 19:17:59 +0000 (19:17 +0000)
committerR. Steve McKown <rsmckown@gmail.com>
Tue, 1 Dec 2009 03:01:47 +0000 (20:01 -0700)
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

index 8ec74fc5ac7ad98c8e5b6ea9a158eb3f5cd35f47..8557c8cc2eba34b6352544fe9e12c8a5805a8b1a 100644 (file)
@@ -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 {