Browse Source

AP_ADC: fixed APM1 HIL_SENSORS Ch6() return

mission-4.1.18
Andrew Tridgell 12 years ago
parent
commit
5667f5d817
  1. 5
      libraries/AP_ADC/AP_ADC_HIL.cpp
  2. 4
      libraries/AP_ADC/AP_ADC_HIL.h

5
libraries/AP_ADC/AP_ADC_HIL.cpp

@ -60,7 +60,10 @@ uint32_t AP_ADC_HIL::Ch6(const uint8_t *channel_numbers, float *result) @@ -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

4
libraries/AP_ADC/AP_ADC_HIL.h

@ -56,8 +56,8 @@ private: @@ -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

Loading…
Cancel
Save