From f475f8e01526d237704de9eb005a46662afb740c Mon Sep 17 00:00:00 2001 From: Carl Date: Wed, 29 Jul 2026 17:59:54 +0100 Subject: [PATCH] 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 --- backend/app/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/app/main.py b/backend/app/main.py index a991dbfa7..eb07273a1 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -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")