From d7c5e41d5d53e1f9ca7c365fd491b385b1343c2b Mon Sep 17 00:00:00 2001 From: Phil Schatzmann Date: Fri, 20 Oct 2023 16:56:30 +0200 Subject: [PATCH] adc_continuous_read --- src/AudioAnalog/AnalogAudioESP32V1.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AudioAnalog/AnalogAudioESP32V1.h b/src/AudioAnalog/AnalogAudioESP32V1.h index 007d0ba606..0600d3cb68 100644 --- a/src/AudioAnalog/AnalogAudioESP32V1.h +++ b/src/AudioAnalog/AnalogAudioESP32V1.h @@ -147,7 +147,7 @@ class AnalogDriverESP32V1 : public AnalogDriverBase { if(adc_continuous_read(self->adc_handle, dest, samples, &result, self->timeout)== ESP_OK) { // convert unsigned 8 bits to signed 16 bits; int16_t* data16 = (int16_t*)dest; - for (int j=samples-1;j>=0;j--){ + for (int j = result-1; j>=0; j--){ data16[j] = (static_cast(dest[8]) - 128) * 256; } } else {