mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-29 10:32:10 +08:00
Add option to disable fan control (#25690)
add option for external fan control Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: 13d9a77b93e083d3a35d7f4f2ea755b880e4a1ed
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user