1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Modified pios_adc.c to remove race condition by which the ADC value was reset to 0.

This commit is contained in:
Laura Sebesta 2012-07-08 22:23:05 +02:00
parent 4f20a0f9a1
commit 0a34b786a9

View File

@ -306,8 +306,8 @@ int32_t PIOS_ADC_PinGet(uint32_t pin)
/* return accumulated result and clear accumulator */
result = accumulator[pin].accumulator / (accumulator[pin].count ?: 1);
accumulator[pin].accumulator = 0;
accumulator[pin].count = 0;
accumulator[pin].accumulator = result;
accumulator[pin].count = 1;
return result;
#endif