-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stuck reading Led_dB #6
Comments
@Xpcker
prints a variable to the serial output. You can simply remove or comment those lines. The code you posted does not compile. The line |
thanks! i managed to fix it ! |
@Xpcker Good to hear! It makes sense to post how you fixed it so others can possibly solve similar problems. You could then also close your issue I guess... |
I'm still working on the project and I'll upload everything, for some reason the esp32 Wifi crashes with the XQueueCreate in the FREERTOS, I'm trying to sync it with a neotimer with no luck, I'll make another issue with that For the fix, I made a function void readNoise() and I just call it from the loop, The code below is in a readNoise.h file so the code is cleaner below is the code: @HorstBaerbel =) |
#include <driver/i2s.h> float noise; // #define LEQ_PERIOD 0.1 // second(s) // NOTE: Some microphones require at least DC-Blocker filter // Customize these values from microphone datasheet // Calculate reference amplitude value at compile time // // I2S peripheral to use (0 or 1) // // DC-Blocker filter - removes DC component from I2S data // // TDK/InvenSense INMP441 // // // // // Data we push to 'samples_queue' // Static buffer for block of samples // i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL); #if (MIC_TIMING_SHIFT > 0) i2s_set_pin(I2S_PORT, &pin_config); //FIXME: There is a known issue with esp-idf and sampling rates, see: // // Discard first block, microphone may have startup time (i.e. INMP441 up to 83ms) while (true) {
} void readNoise() // Create FreeRTOS queue // Create the I2S reader FreeRTOS task sum_queue_t q; // Read sum of samaples, calculated by 'i2s_reader_task'
} |
Try a smaller number of queues: And it would be nice if you could format your source code using the "insert code" button. Makes it much more readable. |
You could also close the issue yourself, if you got it fixed... |
Hey buddy i have the same issue, but when i call it from loop as you said so i get flash reset problem with esp32, is it possible if you could share your code. it would be so helpful |
Hello there! Thank you so much for this project, its amaizing!
I've been trying to incorporate the code to a multisensor I'm creating but when the ESP reads
Serial.printf("%.1f\n", Leq_dB);
Serial.println("dB");
it gets stucks reading forever and won't go back to the loop (see attached picture)
any thoughts?
extra:
what does ("%.1f\n", Leq_dB); means?
I tried reading a Serial.print(Leq_dB); but i get an error
my code is:
void readNoise()
{
// Create FreeRTOS queue
samples_queue = xQueueCreate(8, sizeof(sum_queue_t));
// Create the I2S reader FreeRTOS task
// NOTE: Current version of ESP-IDF will pin the task
// automatically to the first core it happens to run on
// (due to using the hardware FPU instructions).
// For manual control see: xTaskCreatePinnedToCore
xTaskCreate(mic_i2s_reader_task, "Mic I2S Reader", I2S_TASK_STACK, NULL, I2S_TASK_PRI, NULL);
sum_queue_t q;
uint32_t Leq_samples = 0;
double Leq_sum_sqr = 0;
double Leq_dB = 0;
// Read sum of samaples, calculated by 'i2s_reader_task'
while (xQueueReceive(samples_queue, &q, portMAX_DELAY)) {
}
thanks!!!
The text was updated successfully, but these errors were encountered: