From ff727e87cabc6fabe7297997a6e33769f6f816a4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 28 Nov 2011 16:00:28 +1100 Subject: [PATCH] ADC: remove a very small (0.2 degrees/s) bias in the ADC code small bias from integer rounding --- libraries/AP_ADC/AP_ADC_ADS7844.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_ADC/AP_ADC_ADS7844.cpp b/libraries/AP_ADC/AP_ADC_ADS7844.cpp index 1f0c659278..b319b29f7d 100644 --- a/libraries/AP_ADC/AP_ADC_ADS7844.cpp +++ b/libraries/AP_ADC/AP_ADC_ADS7844.cpp @@ -212,7 +212,7 @@ uint32_t AP_ADC_ADS7844::Ch6(const uint8_t *channel_numbers, uint16_t *result) // division. That costs us 36 bytes of stack, but I think its // worth it. for (i = 0; i < 6; i++) { - result[i] = sum[i] / count[i]; + result[i] = (sum[i] + (count[i]/2)) / count[i]; }