fix(camera): apply camera_rotation to finish photos

_apply_camera_rotation was only ever wired into
_capture_snapshot_for_notification (print-start photo, in-print frame
bank) - the finish-photo pipeline (_background_finish_photo's three
branches: stage-22 pre-captured frame, external-camera fallback,
built-in buffered-frame fallback) saved frames straight to disk with
no rotation, so a finish photo came out upside-down whenever
camera_rotation was configured. Pre-existing gap, unrelated to
yesterday's collision fixes - just more visible now that a finish
photo reliably gets captured at all.

Built-in camera's final capture_finish_photo() fallback (writes its
own file, returns only a filename) is left unrotated - out of scope
here since Carl uses an external camera; would need its own change to
services/camera.py.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Carl
2026-07-30 17:27:16 +01:00
co-authored by Claude Sonnet 5
parent db538e43f1
commit f475f8e015
+3
View File
@@ -5350,6 +5350,7 @@ async def on_print_complete(printer_id: int, data: dict):
)
cached_frame = _stage22_finish_frames.pop(printer_id, None)
if cached_frame:
cached_frame = _apply_camera_rotation(cached_frame, printer, logger)
photos_dir = archive_dir / "photos"
photos_dir.mkdir(parents=True, exist_ok=True)
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
@@ -5384,6 +5385,7 @@ async def on_print_complete(printer_id: int, data: dict):
snapshot_url=printer.external_camera_snapshot_url,
)
if frame_data:
frame_data = _apply_camera_rotation(frame_data, printer, logger)
photos_dir = archive_dir / "photos"
photos_dir.mkdir(parents=True, exist_ok=True)
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
@@ -5401,6 +5403,7 @@ async def on_print_complete(printer_id: int, data: dict):
if (active_for_printer or active_chamber_for_printer) and buffered_frame:
# Use frame from active stream
logger.info("[PHOTO-BG] Using buffered frame from active stream")
buffered_frame = _apply_camera_rotation(buffered_frame, printer, logger)
photos_dir = archive_dir / "photos"
photos_dir.mkdir(parents=True, exist_ok=True)
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")