Skip to content

Commit

Permalink
boardd: reset safety mode on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
adeebshihadeh committed Apr 4, 2024
1 parent d09e77d commit 1e32418
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion selfdrive/boardd/boardd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ void panda_state_thread(std::vector<Panda *> pandas, bool spoofing_started) {
PubMaster pm({"pandaStates", "peripheralState"});

Panda *peripheral_panda = pandas[0];
bool engaged = false;
bool is_onroad = false;
bool is_onroad_last = false;
std::future<bool> safety_future;
Expand Down Expand Up @@ -483,14 +484,20 @@ void panda_state_thread(std::vector<Panda *> pandas, bool spoofing_started) {
is_onroad_last = is_onroad;

sm.update(0);
const bool engaged = sm.allAliveAndValid({"controlsState"}) && sm["controlsState"].getControlsState().getEnabled();
engaged = sm.allAliveAndValid({"controlsState"}) && sm["controlsState"].getControlsState().getEnabled();

for (const auto &panda : pandas) {
panda->send_heartbeat(engaged);
}

rk.keepTime();
}

if (is_onroad && !engaged) {
for (auto &p : pandas) {
p->set_safety_model(cereal::CarParams::SafetyModel::NO_OUTPUT);
}
}
}


Expand Down

0 comments on commit 1e32418

Please sign in to comment.