pandad: add log_once_ to prevent repeated logging (#33505)

add log_once_ flag
This commit is contained in:
Dean Lee
2024-09-08 07:38:44 +08:00
committed by GitHub
parent e3f05db3e0
commit ee6d7aeb53
2 changed files with 7 additions and 2 deletions

View File

@@ -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 {};
}

View File

@@ -19,6 +19,7 @@ private:
void setSafetyMode(const std::string &params_string);
bool initialized_ = false;
bool log_once_ = false;
bool safety_configured_ = false;
bool prev_obd_multiplexing_ = false;
std::vector<Panda *> pandas_;