AP_ADC: fixed APM1 HIL_SENSORS Ch6() return

This commit is contained in:
Andrew Tridgell 2013-04-02 13:20:08 +11:00
parent a69c9ff674
commit 5667f5d817
2 changed files with 6 additions and 3 deletions

View File

@ -60,7 +60,10 @@ uint32_t AP_ADC_HIL::Ch6(const uint8_t *channel_numbers, float *result)
for (uint8_t i=0; i<6; i++) {
result[i] = Ch(channel_numbers[i]);
}
return ((hal.scheduler->millis() - last_hil_time)*2)/5;
uint32_t now = hal.scheduler->micros();
uint32_t ret = now - _last_ch6_time;
_last_ch6_time = now;
return ret;
}
// Set one channel value

View File

@ -56,8 +56,8 @@ private:
// The raw adc array
uint16_t adcValue[8];
// the time in milliseconds when we last got a HIL update
uint32_t last_hil_time;
// the time in microseconds when Ch6 was last requested
uint32_t _last_ch6_time;
///
// sensor constants