Closed Anheledir closed 1 month ago
Everything else looks good. I need verify the functionality of the changes and then I can confirm them
@Anheledir I tried it, without this sequence of code:
/* get training photo */
FrameBuffer = esp_camera_fb_get();
esp_camera_fb_return(FrameBuffer);
But I still have a problem with the current photo being one frame behind. So it's neccesary keep this code sequence. I already had to partially modify function for the get photo. The release of the photo is not performed in this function.
I suggest the following procedure: I will confirm your pull request, then I will add the sequence for the training photo and remove the release of the photo. You added good protection against looping and improved the semaphore. We need to keep that.
It's okay for you ?
Sure, sounds good for me. I oversaw that issue you observed, would recommend to add also a concern to the code to explain why this seemingly unnecessary snippet is necessary!
Glad you approve the other changes, I really like your whole effort with this project! 👍🏻
This is good point. I will add the reason for using this code.
Thanks, I'm glad you like this project. and thanks for improving the code
Description
Removed Redundant Frame Buffer Handling:
esp_camera_fb_get()
followed immediately byesp_camera_fb_return(FrameBuffer)
captures and immediately releases a frame buffer, which seems redundant.Added Error Handling for Semaphore Take Failure:
xSemaphoreTake
fails, logging an error and returning appropriately.Released Semaphore on Error:
esp_camera_fb_get()
fails, preventing possible deadlocks.Prevented Potential Infinite Loop:
Changes