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:
parent
4f20a0f9a1
commit
0a34b786a9
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user