Skip to content

Commit 141e62e

Browse files
committed
ain: read i2s data only when VFX_FFT_NULL_BIT is set
1 parent bed6b62 commit 141e62e

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

main/src/user/ain.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static void ain_task(void *pvParameters)
3131
while (1) {
3232
xEventGroupWaitBits(
3333
user_event_group,
34-
AUDIO_INPUT_RUN_BIT | AUDIO_INPUT_FFT_BIT,
34+
AUDIO_INPUT_RUN_BIT | AUDIO_INPUT_FFT_BIT | VFX_FFT_NULL_BIT,
3535
pdFALSE,
3636
pdTRUE,
3737
portMAX_DELAY
@@ -41,11 +41,6 @@ static void ain_task(void *pvParameters)
4141
i2s_read(CONFIG_AUDIO_INPUT_I2S_NUM, data, FFT_N * 4, &bytes_read, portMAX_DELAY);
4242

4343
#ifdef CONFIG_ENABLE_VFX
44-
EventBits_t uxBits = xEventGroupGetBits(user_event_group);
45-
if (!(uxBits & VFX_FFT_NULL_BIT)) {
46-
continue;
47-
}
48-
4944
// Copy data to FFT input buffer
5045
uint32_t idx = 0;
5146

@@ -73,7 +68,7 @@ static void ain_task(void *pvParameters)
7368
}
7469
#endif
7570

76-
uxBits = xEventGroupGetBits(user_event_group);
71+
EventBits_t uxBits = xEventGroupGetBits(user_event_group);
7772
if (!(uxBits & AUDIO_INPUT_RUN_BIT)) {
7873
memset(vfx_fft_input, 0x00, sizeof(vfx_fft_input));
7974
}

0 commit comments

Comments
 (0)