Commit Graph

17 Commits (fc4b6de49aab601ecc25182fefb1959ac093cff2)

Author SHA1 Message Date
Jakob Pless fc4b6de49a
Send the last photo fragment when the size is a multiple of 2048
The fragment loop only wrote a full fragment while more data followed
it, and only wrote a partial one when there was a remainder. When the
photo length was an exact multiple of PHOTO_FRAGMENT_SIZE the final
fragment was never sent, the length check failed and the upload was
reported as incomplete.

Replace it with a loop that sends what is left, up to one fragment at a
time. Checked on the host for every length from 0 to 299999 and on a
XIAO ESP32-S3 Sense (uploads return 200 OK).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:55:22 +01:00
Jakob Pless 8c7109e67f
Fix reboot when opening the MJPEG stream
The camera driver runs with a single frame buffer, but the firmware kept
the last photo in it and returned it to the driver repeatedly (on every
stream frame, on stream start and on stream close). A failed grab also
left the frame-buffer mutex held and streamed a stale buffer.

Photos and stream frames are now copied into PSRAM and the driver buffer
is returned immediately. The stream, the Prusa Connect upload and
/saved-photo.jpg each own their copy, so none can free a frame another
is still sending. Stream clients are counted, a failed capture ends the
stream cleanly, and web-side waits on the camera lock time out after 3 s
instead of blocking the async_tcp task.

Tested on a XIAO ESP32-S3 Sense: two overlapping streams for 75 s while
Prusa Connect uploads ran, no reboot, all uploads 200 OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:43:48 +01:00
Miroslav Pivovarsky d55035b31a Added FW version in the info message for the Prusa Connect 2024-11-20 21:14:27 +01:00
Miroslav Pivovarsky 51330258d4 Initial version with multi-board support 2024-06-27 22:12:49 +02:00
Miroslav Pivovarsky 276d0309c2 update frame buffer return 2024-06-02 15:27:44 +02:00
Miroslav Pivovarsky ec7b7eabc7 Added photo copying during the stream 2024-06-02 10:58:01 +02:00
Miroslav Pivovarsky 4243473169 updated library for logging 2024-05-31 22:44:12 +02:00
Miroslav Pivovarsky 68e26390ac updated logging and web design 2024-05-27 17:53:04 +02:00
Miroslav Pivovarsky 55bdcecf84 added saving image snapshot to micro SD card 2024-05-27 17:42:44 +02:00
Miroslav Pivovarsky 527f2a53ae added photo EXIF metadata 2024-05-27 17:15:15 +02:00
Miroslav Pivovarsky 85ac1c9806 used mdns as camera name for prusa connect 2024-05-16 22:42:52 +02:00
Miroslav Pivovarsky 532ed3e46f change sending data to connect 2024-05-16 22:29:48 +02:00
Miroslav Pivovarsky 49f89e94fd added test parts of the code for various errors 2024-05-13 21:53:56 +02:00
Miroslav Pivovarsky 449bb07b58 Fixed memory utilization issue. Utilized F() macro for moving strings from RAM to PROGMEM. 2024-05-10 23:29:55 +02:00
Miroslav Pivovarsky c2dd99f5c5 Fixed issue with sending large images to the backend. 2024-04-25 17:57:08 +02:00
Miroslav Pivovarsky ebb0e41e5f Implemented WEB server control during photo upload, fixed MCU startup issue, and added jQuery source file. 2024-04-22 23:00:21 +02:00
Miroslav Pivovarsky 0eefd45e11 initial commit 2024-04-18 21:55:30 +02:00