From dee6218c5ec4a0c36e3900d4eb8c853ce66d5fb4 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Mon, 19 Jul 2021 12:41:32 +0200 Subject: [PATCH] fix dcam AE feedback loop with IR LEDs (#21651) old-commit-hash: 1c40b8092ccc5370b69104fa027f244b829b19a5 --- selfdrive/boardd/boardd.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index c770845af6..b260e23272 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -411,6 +411,8 @@ void hardware_control_thread() { bool prev_charging_disabled = false; unsigned int cnt = 0; + FirstOrderFilter integ_lines_filter(0, 10.0, 0.05); + while (!do_exit && panda->connected) { cnt++; sm.update(1000); // TODO: what happens if EINTR is sent while in sm.update? @@ -443,6 +445,10 @@ void hardware_control_thread() { if (sm.updated("driverCameraState")) { auto event = sm["driverCameraState"]; int cur_integ_lines = event.getDriverCameraState().getIntegLines(); + + if (Hardware::TICI()) { + cur_integ_lines = integ_lines_filter.update(cur_integ_lines * 2.5); + } last_front_frame_t = event.getLogMonoTime(); if (cur_integ_lines <= CUTOFF_IL) {