samples: drivers: adc: adc_sequence: Do not overwrite vref_mv

Sample is reading vref-mv property to get reference voltage and then if
reference source is set to ADC_REF_INTERNAL this value is overwritten.
If vref-mv property is provided then it should not be overwritten.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruściński 2025-03-20 13:49:57 +01:00 committed by Benjamin Cabé
commit 2174e1690a

View file

@ -64,7 +64,7 @@ int main(void)
printf("Could not setup channel #%d (%d)\n", i, err); printf("Could not setup channel #%d (%d)\n", i, err);
return 0; return 0;
} }
if (channel_cfgs[i].reference == ADC_REF_INTERNAL) { if ((vrefs_mv[i] == 0) && (channel_cfgs[i].reference == ADC_REF_INTERNAL)) {
vrefs_mv[i] = adc_ref_internal(adc); vrefs_mv[i] = adc_ref_internal(adc);
} }
} }