fix static analysis CI
parent
81433f1e54
commit
2d79ccb9ad
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
@ -7,7 +6,6 @@ def average(avg, sample):
|
||||||
# Weighted avg between existing value and new sample
|
# Weighted avg between existing value and new sample
|
||||||
return ((avg[0] * avg[1] + sample) / (avg[1] + 1), avg[1] + 1)
|
return ((avg[0] * avg[1] + sample) / (avg[1] + 1), avg[1] + 1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
sample_time = None
|
sample_time = None
|
||||||
|
@ -16,9 +14,9 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
start_time = time.monotonic()
|
start_time = time.monotonic()
|
||||||
try:
|
try:
|
||||||
voltage_average = (0., 0) # average, count
|
voltage_average = (0, 0) # average, count
|
||||||
current_average = (0., 0)
|
current_average = (0, 0)
|
||||||
power_average = (0., 0)
|
power_average = (0, 0)
|
||||||
while sample_time is None or time.monotonic() - start_time < sample_time:
|
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:
|
with open("/sys/bus/i2c/devices/0-0040/hwmon/hwmon1/in1_input") as f:
|
||||||
voltage = int(f.read()) / 1000.
|
voltage = int(f.read()) / 1000.
|
||||||
|
|
Loading…
Reference in New Issue