ports/stm32: Reset vbuffer state when dropping frames.

When dropping a frame the current vbuffer state was Not reset, which
caused the following frame(s) to be corrupted, probably also overwriting
the next vbuffer.
This bug is what caused transposed high-resolution frames to be corrupted.
If the DMA is not keeping up you should simply just see slower FPS or no
frames at all but definitely never corrupted frames, since they're dropped.
This commit is contained in:
iabdalkader 2024-05-21 20:15:34 +02:00
parent c21472a1cd
commit 64b2708754

View File

@ -405,6 +405,12 @@ void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi) {
sensor.first_line = false;
if (sensor.drop_frame) {
sensor.drop_frame = false;
// If the frame was dropped, the buffer will not change, so its state
// must be reset.
vbuffer_t *buffer = framebuffer_get_tail(FB_PEEK);
if (buffer) {
buffer->reset_state = true;
}
return;
}