white/grey/black pandas still have power ctrl function (#2308)
parent
f258366e0c
commit
ea81d36c41
|
@ -385,9 +385,6 @@ void hardware_control_thread() {
|
|||
LOGD("start hardware control thread");
|
||||
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;
|
||||
uint16_t prev_fan_speed = 999;
|
||||
uint16_t ir_pwr = 0;
|
||||
|
@ -401,15 +398,8 @@ void hardware_control_thread() {
|
|||
cnt++;
|
||||
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
|
||||
if (sm.updated("thermal")){
|
||||
// Charging mode
|
||||
bool charging_disabled = sm["thermal"].getThermal().getChargingDisabled();
|
||||
if (charging_disabled != prev_charging_disabled){
|
||||
|
@ -422,7 +412,18 @@ void hardware_control_thread() {
|
|||
}
|
||||
prev_charging_disabled = charging_disabled;
|
||||
}
|
||||
}
|
||||
#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")){
|
||||
auto event = sm["frontFrame"];
|
||||
|
|
Loading…
Reference in New Issue