Closed LIFsCode closed 8 months ago
@LIFsCode The output ERR: Failed to run classifier (-5)
Is normally a sign of insufficient memory.
Ok that's a good hint. I'll check for unreleased memory or heap fragmentation.
@LIFsCode A quick & simple check to see if memory is the issue is to modify the WAVFileWriter buffer size here. You could reduce if from 1024 3 to 1024 2 which would free 2048 bytes (it uses a double buffer scheme). I haven't checked if it would impact the wav file performance.
I guess it's related with the STD::map structure I'm using for storing the calibration values. I'll replace that with something statically allocated.
Unfortunately it was not the use of std::map, I will do some more debugging, currently I have no guess what has caused this.
@LIFsCode I've noticed there can be a significant time between sending a command via BT to the ELOC & it registering on the terminal when toggling on & off the AI/ EI status. I believe it could result in a race condition with starting & stopping the associated thread. I've tried to improve the code to make it more resilient with this commit & looks like its improved but will do more testing tomorrow.
I've reduced the size of the I2S DMA buffers in the commit above from 18 1000 to 8 1024. This frees 9808 bytes & appears, at least on initial testing, to resolve this issue, supporting the theory that its memory exhaustion issue.
I've just carried out sound recording at 16kHz & the performance seems unaffected. The worse case scenario is probably at max sampling rate (44kHz?) which needs to be tested.
@OOHehir I just run into some problems with the EI running in parallel with the recording.
I attached the log file
and the config file
Do you have any idea about what coud has caused these errors? I have not seen these errors with commit c3281543a, but since I merged the battery calibration stuff I see them (commit d093f7476)
But I don't see what the battery stuff has to do with the EI, the battery is only read in the main loop. So I guess it is more a sideeffect which triggered this behavior.