1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-25 17:25:10 +03:00

Re #3827: added mutex to getADC(), because adcRead() is not reentrant (#3889)

* Re #3827: added mutex to getADC(), because adcRead() is not reentrant

* Re #3827: alternative solution to prevent calling getADC() from different threads, because adcRead() is not reentrant

* Cosmetics
This commit is contained in:
Damjan Adamic 2016-10-08 22:09:25 +02:00 committed by Bertrand Songis
parent 1e4470a007
commit 2dd8b8702f
4 changed files with 25 additions and 12 deletions

View file

@ -737,14 +737,13 @@ void checkSwitches()
while (1) {
#if defined(TELEMETRY_MOD_14051) || defined(TELEMETRY_MOD_14051_SWAPPED)
// FIXME: One getADC() call only reads one 14051 MUX input. To have all switch states updated, we need to call it MUX_MAX+1 times.
#define GETADC_COUNT (MUX_MAX+1)
#define GETADC_COUNT (MUX_MAX+1)
#elif defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
#define GETADC_COUNT 1
#define GETADC_COUNT 1
#endif
#ifdef GETADC_COUNT
for (uint8_t i=0; i<GETADC_COUNT; i++) {
getADC();
GET_ADC_IF_MIXER_NOT_RUNNING();
}
#undef GETADC_COUNT
#endif
@ -942,6 +941,9 @@ void checkSwitches()
wdt_reset();
SIMU_SLEEP(1);
#if defined(CPUARM)
CoTickDelay(10);
#endif
}
#endif