|
|
@ -348,12 +348,13 @@ def thermald_thread(end_event, hw_queue): |
|
|
|
power_monitor.calculate(peripheralState, onroad_conditions["ignition"]) |
|
|
|
power_monitor.calculate(peripheralState, onroad_conditions["ignition"]) |
|
|
|
msg.deviceState.offroadPowerUsageUwh = power_monitor.get_power_used() |
|
|
|
msg.deviceState.offroadPowerUsageUwh = power_monitor.get_power_used() |
|
|
|
msg.deviceState.carBatteryCapacityUwh = max(0, power_monitor.get_car_battery_capacity()) |
|
|
|
msg.deviceState.carBatteryCapacityUwh = max(0, power_monitor.get_car_battery_capacity()) |
|
|
|
current_power_draw = HARDWARE.get_current_power_draw() # pylint: disable=assignment-from-none |
|
|
|
current_power_draw = HARDWARE.get_current_power_draw() |
|
|
|
if current_power_draw is not None: |
|
|
|
statlog.sample("power_draw", current_power_draw) |
|
|
|
statlog.sample("power_draw", current_power_draw) |
|
|
|
msg.deviceState.powerDrawW = current_power_draw |
|
|
|
msg.deviceState.powerDrawW = current_power_draw |
|
|
|
|
|
|
|
else: |
|
|
|
som_power_draw = HARDWARE.get_som_power_draw() |
|
|
|
msg.deviceState.powerDrawW = 0 |
|
|
|
statlog.sample("som_power_draw", som_power_draw) |
|
|
|
|
|
|
|
msg.deviceState.somPowerDrawW = som_power_draw |
|
|
|
|
|
|
|
|
|
|
|
# Check if we need to disable charging (handled by boardd) |
|
|
|
# Check if we need to disable charging (handled by boardd) |
|
|
|
msg.deviceState.chargingDisabled = power_monitor.should_disable_charging(onroad_conditions["ignition"], in_car, off_ts) |
|
|
|
msg.deviceState.chargingDisabled = power_monitor.should_disable_charging(onroad_conditions["ignition"], in_car, off_ts) |
|
|
|