white/grey/black pandas still have power ctrl function (#2308)

pull/2322/head
eFini 2020-10-12 21:58:36 +10:00 committed by GitHub
parent f258366e0c
commit ea81d36c41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 11 deletions

View File

@ -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"];