  from selfdrive.controls.lib.alertmanager import set_offroad_alert
  from selfdrive.loggerd.config import get_available_percent
  from selfdrive.pandad import get_expected_signature
  from selfdrive.swaglog import cloudlog
  from selfdrive.thermald.power_monitoring import (PowerMonitoring,
                                                   get_battery_capacity,
                                                   get_battery_current,
                                                   get_battery_status,
                                                   get_battery_voltage,
                                                   get_usb_present)
  from selfdrive.version import get_git_branch, terms_version, training_version
  
  ThermalConfig = namedtuple('ThermalConfig', ['cpu', 'gpu', 'mem', 'bat', 'ambient'])
  
  FW_SIGNATURE = get_expected_signature()
 
</s> remove     msg.thermal.batteryPercent = get_battery_capacity()
    msg.thermal.batteryStatus = get_battery_status()
    msg.thermal.batteryCurrent = get_battery_current()
    msg.thermal.batteryVoltage = get_battery_voltage()
    msg.thermal.usbOnline = get_usb_present()
 </s> add     msg.thermal.batteryPercent = HARDWARE.get_battery_capacity()
    msg.thermal.batteryStatus = HARDWARE.get_battery_status()
    msg.thermal.batteryCurrent = HARDWARE.get_battery_current()
    msg.thermal.batteryVoltage = HARDWARE.get_battery_voltage()
    msg.thermal.usbOnline = HARDWARE.get_usb_present() </s> remove     with pm_patch("get_battery_voltage", BATT_VOLTAGE * 1e6), pm_patch("get_battery_current", BATT_CURRENT * 1e6), \
    pm_patch("get_battery_status", "Discharging"), pm_patch("MAX_TIME_OFFROAD_S", MOCKED_MAX_OFFROAD_TIME, constant=True):
 </s> add     with pm_patch("HARDWARE.get_battery_voltage", BATT_VOLTAGE * 1e6), pm_patch("HARDWARE.get_battery_current", BATT_CURRENT * 1e6), \
    pm_patch("HARDWARE.get_battery_status", "Discharging"), pm_patch("MAX_TIME_OFFROAD_S", MOCKED_MAX_OFFROAD_TIME, constant=True), \
    pm_patch("HARDWARE.get_current_power_draw", None): </s> remove     with pm_patch("get_battery_voltage", BATT_VOLTAGE * 1e6), pm_patch("get_battery_current", BATT_CURRENT * 1e6), \
    pm_patch("get_battery_status", "Discharging"):
 </s> add     with pm_patch("HARDWARE.get_battery_voltage", BATT_VOLTAGE * 1e6), pm_patch("HARDWARE.get_battery_current", BATT_CURRENT * 1e6), \
    pm_patch("HARDWARE.get_battery_status", "Discharging"), pm_patch("HARDWARE.get_current_power_draw", None): </s> remove     with pm_patch("get_battery_voltage", BATT_VOLTAGE * 1e6), pm_patch("get_battery_current", BATT_CURRENT * 1e6), \
    pm_patch("get_battery_status", "Discharging"):
 </s> add     with pm_patch("HARDWARE.get_battery_voltage", BATT_VOLTAGE * 1e6), pm_patch("HARDWARE.get_battery_current", BATT_CURRENT * 1e6), \
    pm_patch("HARDWARE.get_battery_status", "Discharging"), pm_patch("HARDWARE.get_current_power_draw", None): </s> remove     with pm_patch("get_battery_voltage", BATT_VOLTAGE * 1e6), pm_patch("get_battery_current", BATT_CURRENT * 1e6), \
    pm_patch("get_battery_status", "Discharging"):
 </s> add     with pm_patch("HARDWARE.get_battery_voltage", BATT_VOLTAGE * 1e6), pm_patch("HARDWARE.get_battery_current", BATT_CURRENT * 1e6), \
    pm_patch("HARDWARE.get_battery_status", "Discharging"), pm_patch("HARDWARE.get_current_power_draw", None):
from selfdrive.thermald.power_monitoring import PowerMonitoring
  from selfdrive.controls.lib.alertmanager import set_offroad_alert
  from selfdrive.loggerd.config import get_available_percent
  from selfdrive.pandad import get_expected_signature
  from selfdrive.swaglog import cloudlog
from selfdrive.thermald.power_monitoring import PowerMonitoring
from selfdrive.thermald.power_monitoring import PowerMonitoring
from selfdrive.thermald.power_monitoring import PowerMonitoring
from selfdrive.thermald.power_monitoring import PowerMonitoring
from selfdrive.thermald.power_monitoring import PowerMonitoring
from selfdrive.thermald.power_monitoring import PowerMonitoring
  from selfdrive.version import get_git_branch, terms_version, training_version
  
  ThermalConfig = namedtuple('ThermalConfig', ['cpu', 'gpu', 'mem', 'bat', 'ambient'])
  
  FW_SIGNATURE = get_expected_signature()
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
 Move thermald hardware calls into HW abstraction layer (#2630)

* abstracted away hardware calls

* oopsie

* remove bugs

* remove bugs #2

* fix unit test

* removed print

Co-authored-by: Comma Device <device@comma.ai> 
selfdrive/thermald/thermald.py