From 35d8d12ec8a935a2fd35e2eb374cd62883243d61 Mon Sep 17 00:00:00 2001 From: Jonas Larsson Date: Fri, 13 Apr 2018 15:56:49 -0700 Subject: [PATCH] joy_demo: Don't start preview if alpha is 0. Running the preview pipeline and having DispmanX compose with alpha blending adds to the total workload, potentially increasing thermal output. If it's not gonna be visible, don't do it. Change-Id: Icd10989f217eadddaa3fefe1c1d01ccfe409e436 --- src/examples/vision/joy/joy_detection_demo.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/examples/vision/joy/joy_detection_demo.py b/src/examples/vision/joy/joy_detection_demo.py index 91f0d871..6f33146e 100755 --- a/src/examples/vision/joy/joy_detection_demo.py +++ b/src/examples/vision/joy/joy_detection_demo.py @@ -263,7 +263,11 @@ def take_photo(): photographer.shoot(camera) # Blend the preview layer with the alpha value from the flags. - camera.start_preview(alpha=preview_alpha) + if preview_alpha > 0: + logger.info('Starting preview with alpha %d', preview_alpha) + camera.start_preview(alpha=preview_alpha) + else: + logger.info('Not starting preview, alpha 0') button = Button(23) button.when_pressed = take_photo