OV7670 camera QVGA - One image contains two half images error

Hello, I recently started working on an security camera system, with arduino uno and OV7670 camera without FIFO memory, and sn ESP-8266 to transfer images.

To take QVGA photos I followed this tutorial:
https://hkalasua.wordpress.com/2017/09/11/ov7670-arduino-sd/

Obviously, I changed the code a lot, I don’t save the picture to the sd card, insted I transfer the image line-by-line to ESP-8266 and that send it to the server with websockets. On the server I do some post-processing with pyton to make a valid BMP file.

I’m sure that my problem is at the Arduino side, my images looks like this:
One (240320) QVGA image is bult by two (120320) half image.

My camera takes the two images AFTER each other, not just duplicates the first part.

I’m trying to changeing the scaling registers with different combinations, without success.

I attached my arduino code.

Thanks!

CameraArduino.ino (5.18 KB)