From ee6d7aeb537c37e70af83c0e4cb2a454d37f3e52 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Sun, 8 Sep 2024 07:38:44 +0800 Subject: [PATCH] pandad: add log_once_ to prevent repeated logging (#33505) add log_once_ flag --- selfdrive/pandad/panda_safety.cc | 8 ++++++-- selfdrive/pandad/pandad.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/selfdrive/pandad/panda_safety.cc b/selfdrive/pandad/panda_safety.cc index 1d0f72f223444e..0a14894677fcdc 100644 --- a/selfdrive/pandad/panda_safety.cc +++ b/selfdrive/pandad/panda_safety.cc @@ -17,6 +17,7 @@ void PandaSafety::configureSafetyMode() { } else if (!is_onroad) { initialized_ = false; safety_configured_ = false; + log_once_ = false; } } @@ -46,9 +47,12 @@ std::string PandaSafety::fetchCarParams() { if (!params_.getBool("FirmwareQueryDone")) { return {}; } - LOGW("Finished FW query"); - LOGW("Waiting for params to set safety model"); + if (!log_once_) { + LOGW("Finished FW query, Waiting for params to set safety model"); + log_once_ = true; + } + if (!params_.getBool("ControlsReady")) { return {}; } diff --git a/selfdrive/pandad/pandad.h b/selfdrive/pandad/pandad.h index 14d97551f4ee88..dedd8ae79a219b 100644 --- a/selfdrive/pandad/pandad.h +++ b/selfdrive/pandad/pandad.h @@ -19,6 +19,7 @@ class PandaSafety { void setSafetyMode(const std::string ¶ms_string); bool initialized_ = false; + bool log_once_ = false; bool safety_configured_ = false; bool prev_obd_multiplexing_ = false; std::vector pandas_;