diff --git a/tests/periph/selftest_shield/main.c b/tests/periph/selftest_shield/main.c index 84e192e2f7..94ea7fa1fb 100644 --- a/tests/periph/selftest_shield/main.c +++ b/tests/periph/selftest_shield/main.c @@ -93,10 +93,9 @@ * - periph_adc support (so that we have something to test) * - Arduino I/O mapping for ADC (so that we know which line to test) * - The PCF857x driver (so that we can control the R-2R resistor ladder - * connected to the GPIO expander. + * connected to the GPIO expander). */ -#if defined(MODULE_PERIPH_ADC) && defined(ARDUINO_A0) && defined(MODULE_PCF857X) && 0 -// TODO: Re-anble when PCB is fixed +#if defined(MODULE_PERIPH_ADC) && defined(ARDUINO_A0) && defined(MODULE_PCF857X) # define ENABLE_ADC_TEST 1 #else # define ENABLE_ADC_TEST 0 @@ -979,9 +978,9 @@ static bool periph_adc_test(void) uint16_t sample = adc_sample(ARDUINO_A0, ADC_RES_10BIT); uint16_t expected = i << 6; - /* the resistors are said to be rather accurate, so lets be a bit - * more strict here */ - const uint16_t delta = 16; + /* The resistors on board v0.3 are not that accurate, so allow for 10% + * error margin */ + const uint16_t delta = 1024 / 10; uint16_t lower = expected <= delta ? 0 : expected - delta; uint16_t upper = MIN(1023, expected + delta); bool test_failed = TEST((lower <= sample) && (upper >= sample));