- const static uint8_t lookup[] = {
- 0x01, 0x03, 0x02, 0x06, 0x04, 0x0c, 0x08, 0x18,
- 0x10, 0x30, 0x20, 0x60, 0x40, 0xc0, 0x80, 0x81
- };
- uint8_t wind;
- uint8_t i = 0;
-
- wind = call Vane.get();
- for (i = 0; i < sizeof(lookup); i++) {
- if (lookup[i] == wind) {
- compass[i]++;
- return;
- }
+ post startRead();
+ }
+
+ event void Vane.readDone(error_t error, uint16_t value)
+ {
+ if (error == SUCCESS) {
+ if (++m_compass[degreeToSector(value)] == 0)
+ m_overflow = TRUE;