fix static analysis CI

pull/20294/head
Adeeb Shihadeh 4 years ago
parent 81433f1e54
commit 2d79ccb9ad
  1. 8
      selfdrive/hardware/tici/power_monitor.py

@ -1,5 +1,4 @@
#!/usr/bin/env python3
import os
import sys
import time
@ -7,7 +6,6 @@ def average(avg, sample):
# Weighted avg between existing value and new sample
return ((avg[0] * avg[1] + sample) / (avg[1] + 1), avg[1] + 1)
if __name__ == '__main__':
sample_time = None
@ -16,9 +14,9 @@ if __name__ == '__main__':
start_time = time.monotonic()
try:
voltage_average = (0., 0) # average, count
current_average = (0., 0)
power_average = (0., 0)
voltage_average = (0, 0) # average, count
current_average = (0, 0)
power_average = (0, 0)
while sample_time is None or time.monotonic() - start_time < sample_time:
with open("/sys/bus/i2c/devices/0-0040/hwmon/hwmon1/in1_input") as f:
voltage = int(f.read()) / 1000.

Loading…
Cancel
Save