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 {