mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-20 01:13:56 +08:00
* zookeeper lib * add ft4222 to dev pip packages and fix include error * started on CI * it's a file * now it should be happy * use docker for all on-device tests * test scripts * does this work? * access to devices * too broad. only usb enough? * permissions for zookeeper usb * as env var maybe? * this? * try this for now * all devices * move to correct location for impoerts * right paths * not running in the right agent? * ofc not * fix broken merge * add ft4222 package again * add timeout * power monitor * cleanup Co-authored-by: Batman <batman@openpilot-ci.internal> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
31 lines
610 B
Python
Executable File
31 lines
610 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import sys
|
|
import time
|
|
from tools.zookeeper import Zookeeper
|
|
|
|
# Usage: check_consumption.py <averaging_time_sec> <max_average_power_W>
|
|
# Exit code: 0 -> passed
|
|
# 1 -> failed
|
|
|
|
z = Zookeeper()
|
|
|
|
averaging_time_s = int(sys.argv[1])
|
|
max_average_power = float(sys.argv[2])
|
|
|
|
start_time = time.time()
|
|
measurements = []
|
|
while time.time() - start_time < averaging_time_s:
|
|
measurements.append(z.read_power())
|
|
time.sleep(0.1)
|
|
|
|
average_power = sum(measurements)/len(measurements)
|
|
print(f"Average power: {round(average_power, 4)}W")
|
|
|
|
if average_power > max_average_power:
|
|
exit(1)
|
|
|
|
|
|
|
|
|