mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-07 01:06:01 +08:00
little zookeeper fixes (#24861)
* little zookeeper fixes
* bump that up
old-commit-hash: 6757e235f9
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f44f6ded24cd62e4d29dddd45f8897b9b0383e31abc1a6c582415bb1e1b891cb
|
||||
size 1608
|
||||
oid sha256:81524c7faf15ca3709aa45731b2ab70e21bee027ef404b67177f2b97f99fa3fe
|
||||
size 1621
|
||||
|
||||
Generated
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4d95c6ca483d3aa03fd9889d37d70f2125784fbb604d587a1194da558e7b81cb
|
||||
size 168718
|
||||
oid sha256:d4f522eb3621892e9c97c8c3674fc427d6c368186741d2df03c08d2fe8bb5245
|
||||
size 170788
|
||||
|
||||
Executable → Regular
+2
-5
@@ -1,9 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Python library to control Zookeeper
|
||||
|
||||
import ft4222 # pylint: disable=import-error
|
||||
import ft4222.I2CMaster # pylint: disable=import-error
|
||||
import ft4222
|
||||
import ft4222.I2CMaster
|
||||
|
||||
DEBUG = False
|
||||
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#!/usr/bin/env python3
|
||||
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
|
||||
from common.realtime import Ratekeeper
|
||||
from common.filter_simple import FirstOrderFilter
|
||||
from tools.zookeeper import Zookeeper
|
||||
|
||||
if __name__ == "__main__":
|
||||
z = Zookeeper()
|
||||
z.set_device_power(True)
|
||||
z.set_device_ignition(False)
|
||||
|
||||
duration = None
|
||||
if len(sys.argv) > 1:
|
||||
duration = int(sys.argv[1])
|
||||
|
||||
rate = 123
|
||||
rk = Ratekeeper(rate, print_delay_threshold=None)
|
||||
fltr = FirstOrderFilter(0, 5, 1. / rate, initialized=False)
|
||||
|
||||
try:
|
||||
start_time = time.monotonic()
|
||||
measurements = []
|
||||
while duration is None or time.monotonic() - start_time < duration:
|
||||
p = z.read_power()
|
||||
print(round(p, 3), "W")
|
||||
measurements.append(p)
|
||||
time.sleep(0.25)
|
||||
fltr.update(z.read_power())
|
||||
if rk.frame % rate == 0:
|
||||
print(f"{fltr.x:.2f} W")
|
||||
rk.keep_time()
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
finally:
|
||||
average_power = sum(measurements)/len(measurements)
|
||||
print(f"Average power: {round(average_power, 4)}W")
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
ft4222==1.2.1
|
||||
Reference in New Issue
Block a user