|
|
@ -385,9 +385,6 @@ void hardware_control_thread() { |
|
|
|
LOGD("start hardware control thread"); |
|
|
|
LOGD("start hardware control thread"); |
|
|
|
SubMaster sm({"thermal", "frontFrame"}); |
|
|
|
SubMaster sm({"thermal", "frontFrame"}); |
|
|
|
|
|
|
|
|
|
|
|
// Other pandas don't have hardware to control
|
|
|
|
|
|
|
|
if (panda->hw_type != cereal::HealthData::HwType::UNO && panda->hw_type != cereal::HealthData::HwType::DOS) return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint64_t last_front_frame_t = 0; |
|
|
|
uint64_t last_front_frame_t = 0; |
|
|
|
uint16_t prev_fan_speed = 999; |
|
|
|
uint16_t prev_fan_speed = 999; |
|
|
|
uint16_t ir_pwr = 0; |
|
|
|
uint16_t ir_pwr = 0; |
|
|
@ -401,15 +398,8 @@ void hardware_control_thread() { |
|
|
|
cnt++; |
|
|
|
cnt++; |
|
|
|
sm.update(1000); // TODO: what happens if EINTR is sent while in sm.update?
|
|
|
|
sm.update(1000); // TODO: what happens if EINTR is sent while in sm.update?
|
|
|
|
|
|
|
|
|
|
|
|
if (sm.updated("thermal")){ |
|
|
|
|
|
|
|
// Fan speed
|
|
|
|
|
|
|
|
uint16_t fan_speed = sm["thermal"].getThermal().getFanSpeed(); |
|
|
|
|
|
|
|
if (fan_speed != prev_fan_speed || cnt % 100 == 0){ |
|
|
|
|
|
|
|
panda->set_fan_speed(fan_speed); |
|
|
|
|
|
|
|
prev_fan_speed = fan_speed; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef QCOM |
|
|
|
#ifdef QCOM |
|
|
|
|
|
|
|
if (sm.updated("thermal")){ |
|
|
|
// Charging mode
|
|
|
|
// Charging mode
|
|
|
|
bool charging_disabled = sm["thermal"].getThermal().getChargingDisabled(); |
|
|
|
bool charging_disabled = sm["thermal"].getThermal().getChargingDisabled(); |
|
|
|
if (charging_disabled != prev_charging_disabled){ |
|
|
|
if (charging_disabled != prev_charging_disabled){ |
|
|
@ -422,7 +412,18 @@ void hardware_control_thread() { |
|
|
|
} |
|
|
|
} |
|
|
|
prev_charging_disabled = charging_disabled; |
|
|
|
prev_charging_disabled = charging_disabled; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Other pandas don't have fan/IR to control
|
|
|
|
|
|
|
|
if (panda->hw_type != cereal::HealthData::HwType::UNO && panda->hw_type != cereal::HealthData::HwType::DOS) continue; |
|
|
|
|
|
|
|
if (sm.updated("thermal")){ |
|
|
|
|
|
|
|
// Fan speed
|
|
|
|
|
|
|
|
uint16_t fan_speed = sm["thermal"].getThermal().getFanSpeed(); |
|
|
|
|
|
|
|
if (fan_speed != prev_fan_speed || cnt % 100 == 0){ |
|
|
|
|
|
|
|
panda->set_fan_speed(fan_speed); |
|
|
|
|
|
|
|
prev_fan_speed = fan_speed; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (sm.updated("frontFrame")){ |
|
|
|
if (sm.updated("frontFrame")){ |
|
|
|
auto event = sm["frontFrame"]; |
|
|
|
auto event = sm["frontFrame"]; |
|
|
|