fix delta time in imu shim

This commit is contained in:
Michael Oborne 2011-10-13 22:36:51 +08:00
parent 392160314e
commit b02c3608ef
1 changed files with 8 additions and 0 deletions

View File

@ -19,6 +19,13 @@ public:
virtual bool update(void) {
bool updated = _updated;
_updated = false;
// return number of microseconds since last call
uint32_t us = micros();
uint32_t ret = us - last_ch6_micros;
last_ch6_micros = us;
_sample_time = ret;
return updated;
}
//@}
@ -54,6 +61,7 @@ public:
private:
/// set true when new data is delivered
bool _updated;
uint32_t last_ch6_micros;
};
#endif