Add option to disable fan control (#25690)

add option for external fan control

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 13d9a77b93
taco
Robbe Derks 3 years ago committed by GitHub
parent 8256220a51
commit 89fc193e83
  1. 7
      selfdrive/boardd/boardd.cc

@ -468,7 +468,7 @@ void panda_state_thread(PubMaster *pm, std::vector<Panda *> pandas, bool spoofin
}
void peripheral_control_thread(Panda *panda) {
void peripheral_control_thread(Panda *panda, bool no_fan_control) {
util::set_thread_name("boardd_peripheral_control");
SubMaster sm({"deviceState", "driverCameraState"});
@ -488,7 +488,7 @@ void peripheral_control_thread(Panda *panda) {
// Other pandas don't have fan/IR to control
if (panda->hw_type != cereal::PandaState::PandaType::UNO && panda->hw_type != cereal::PandaState::PandaType::DOS) continue;
if (sm.updated("deviceState")) {
if (sm.updated("deviceState") && !no_fan_control) {
// Fan speed
uint16_t fan_speed = sm["deviceState"].getDeviceState().getFanSpeedPercentDesired();
if (fan_speed != prev_fan_speed || cnt % 100 == 0) {
@ -496,6 +496,7 @@ void peripheral_control_thread(Panda *panda) {
prev_fan_speed = fan_speed;
}
}
if (sm.updated("driverCameraState")) {
auto event = sm["driverCameraState"];
int cur_integ_lines = event.getDriverCameraState().getIntegLines();
@ -568,7 +569,7 @@ void boardd_main_thread(std::vector<std::string> serials) {
std::vector<std::thread> threads;
threads.emplace_back(panda_state_thread, &pm, pandas, getenv("STARTED") != nullptr);
threads.emplace_back(peripheral_control_thread, peripheral_panda);
threads.emplace_back(peripheral_control_thread, peripheral_panda, getenv("NO_FAN_CONTROL") != nullptr);
threads.emplace_back(can_send_thread, pandas, getenv("FAKESEND") != nullptr);
threads.emplace_back(can_recv_thread, pandas);

Loading…
Cancel
Save