Skip to content

Commit

Permalink
pandad: add log_once_ to prevent repeated logging (commaai#33505)
Browse files Browse the repository at this point in the history
add log_once_ flag
  • Loading branch information
deanlee authored Sep 7, 2024
1 parent e3f05db commit ee6d7ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions selfdrive/pandad/panda_safety.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void PandaSafety::configureSafetyMode() {
} else if (!is_onroad) {
initialized_ = false;
safety_configured_ = false;
log_once_ = false;
}
}

Expand Down Expand Up @@ -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 {};
}
Expand Down
1 change: 1 addition & 0 deletions selfdrive/pandad/pandad.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PandaSafety {
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_;
Expand Down

0 comments on commit ee6d7ae

Please sign in to comment.