Skip to content

Commit

Permalink
reduced cyclic logging in picmaera backen.d
Browse files Browse the repository at this point in the history
  • Loading branch information
mgineer85 committed Oct 25, 2024
1 parent dd8a2c2 commit cd64475
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions node/services/backends/cameras/picamera2backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def start(self, nominal_framerate: int = None):

if self._config.enable_preview_display:
logger.info("starting display preview")
# INFO: QT catches the Ctrl-C listener, so the app is not shut down properly with the display enabled.
# use for testing purposes only!
# Preview.DRM tested, but leads to many dropped frames.
# Preview.QTGL currently not available on Pi3 according to own testing.
# Preview.QT seems to work reasonably well, so use this for now hardcoded.
Expand Down Expand Up @@ -239,15 +241,19 @@ def _camera_fun(self):
fixed_frame_duration = int(nominal_frame_duration_us - adjust_amount_clamped_us)
ctrl.FrameDurationLimits = (fixed_frame_duration,) * 2

logger.debug(
f"clock_in={round((capture_time_assigned_timestamp_ns or 0)/1e6,1)} ms, "
f"sensor_timestamp={round(picam_metadata['SensorTimestamp']/1e6,1)} ms, "
f"adjust_cycle_counter={adjust_cycle_counter}, "
f"delta={round((timestamp_delta)/1e6,1)} ms, "
f"FrameDuration={round(picam_metadata['FrameDuration']/1e3,1)} ms "
f"ExposureTime={round(picam_metadata['ExposureTime']/1e3,1)} ms "
f"adjust_amount={round(adjust_amount_us/1e3,1)} ms "
f"adjust_amount_clamped={round(adjust_amount_clamped_us/1e3,1)} ms "
)
if abs(timestamp_delta / 1.0e6) > 2.0:
# even in debug reduce verbosity a bit if all is fine and within 2ms tolerance
logger.debug(
f"timestamp clk/sensor=({round((capture_time_assigned_timestamp_ns or 0)/1e6,1)}/"
f"{round(picam_metadata['SensorTimestamp']/1e6,1)}) ms, "
f"delta={round((timestamp_delta)/1e6,1)} ms, "
f"adj_cycle_cntr={adjust_cycle_counter}, "
f"adjust_amount={round(adjust_amount_us/1e3,1)} ms "
f"adjust_amount_clamped={round(adjust_amount_clamped_us/1e3,1)} ms "
f"FrameDuration={round(picam_metadata['FrameDuration']/1e3,1)} ms "
)
else:
pass
# silent

logger.info("_camera_fun left")

0 comments on commit cd64475

Please sign in to comment.