Skip to content

Commit

Permalink
Resolving conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
atuline committed Oct 27, 2021
2 parents 36dfb5c + 4560e92 commit 7a02585
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions wled00/audio_reactive.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ void FFTcode( void * parameter) {
micData = analogRead(audioPin) >> 2; // Analog Read
} else {
int32_t digitalSample = 0;
// TODO: I2S_POP_SAMLE DEPRECATED, FIND ALTERNATE SOLUTION
int bytes_read = i2s_pop_sample(I2S_PORT, (char *)&digitalSample, portMAX_DELAY); // no timeout
if (bytes_read > 0) {
micData = abs(digitalSample >> 16);
}
size_t bytes_read = 0;
esp_err_t result = i2s_read(I2S_PORT, &digitalSample, sizeof(digitalSample), &bytes_read, /*portMAX_DELAY*/ 10);
//int bytes_read = i2s_pop_sample(I2S_PORT, (char *)&digitalSample, portMAX_DELAY); // no timeout
if (bytes_read > 0) micData = abs(digitalSample >> 16);

}
micDataSm = ((micData * 3) + micData)/4; // We'll be passing smoothed micData to the volume routines as the A/D is a bit twitchy.
vReal[i] = micData; // Store Mic Data in an array
Expand Down
7 changes: 6 additions & 1 deletion wled00/usermod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,15 @@ void userSetup() {
float mean = 0.0;
int32_t samples[BLOCK_SIZE];
// TODO: I2S_READ_BYTES DEPRECATED, FIND ALTERNATE SOLUTION
int num_bytes_read = i2s_read_bytes(I2S_PORT,
size_t num_bytes_read = 0;

esp_err_t result = i2s_read(I2S_PORT, &samples, BLOCK_SIZE, &num_bytes_read, portMAX_DELAY);

/*int num_bytes_read = i2s_read_bytes(I2S_PORT,
(char *)samples,
BLOCK_SIZE, // the doc says bytes, but its elements.
portMAX_DELAY); // no timeout
*/

int samples_read = num_bytes_read / 8;
if (samples_read > 0) {
Expand Down

0 comments on commit 7a02585

Please sign in to comment.