X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Fplatforms%2Ftmirws%2Fsensors%2FAeroVaneReadP.nc;h=906679b7e89ee22fa9cc74624de64b71ee137e8d;hb=99d0f62fa02893cadde6f86f632b10bcead90657;hp=56001dde33f9c5d7a7bda956c1d2091baba2933d;hpb=7373db28ff8b66edda83925025fbffea6ed88148;p=tinyos-2.x.git diff --git a/tos/platforms/tmirws/sensors/AeroVaneReadP.nc b/tos/platforms/tmirws/sensors/AeroVaneReadP.nc index 56001dde..906679b7 100644 --- a/tos/platforms/tmirws/sensors/AeroVaneReadP.nc +++ b/tos/platforms/tmirws/sensors/AeroVaneReadP.nc @@ -62,8 +62,6 @@ implementation { int m_vane; int m_sum; - task void readVane(); - void init() { m_count = 0; @@ -100,18 +98,21 @@ implementation { } #if 0 + task void readVane(); + async event void Alarm.fired() -#else - event void Timer.fired() -#endif { - //call Alarm.start(call Alarm.getAlarm() + period); + call Alarm.start(call Alarm.getAlarm() + period); post readVane(); } task void readVane() { //call Alarm.start(call Alarm.getAlarm() + period); +#else + event void Timer.fired() + { +#endif if (!(call State.isIdle())) call Read.read(); } @@ -141,7 +142,8 @@ implementation { norace aerovector_t vector; /* Get speed average */ - atomic vector.speed = call Count.get(); + atomic vector.speed = (call Count.get() * 2.25) / (period * 4 / 1024) + + 0.5; /* Complete direction average */ vector.dir = m_sum / PHYS_PER_READ;