Files
dragonpilot/selfdrive/test/test_leeco_fan.py
Willem Melching bd06434243 pre-commit pylint (#1580)
* "The commit-hook project sounds interesting though. I would definitely merge something that runs flake8 and pylint on the modified files!"
-  pd0wm, https://github.com/commaai/openpilot/pull/1575#issuecomment-634974344

* add pylint to pre-commit and make everything pass

* Remove uncommented stuff

Co-authored-by: J <user@4800.lan>
2020-05-27 20:00:14 -07:00

25 lines
507 B
Python
Executable File

#!/usr/bin/env python3
# pylint: skip-file
import time
from smbus2 import SMBus
def setup_leon_fan():
bus = SMBus(7, force=True)
# https://www.nxp.com/docs/en/data-sheet/PTN5150.pdf
j = 0
for i in [0x1, 0x3 | 0, 0x3 | 0x08, 0x3 | 0x10]:
print("FAN SPEED", j)
ret = bus.read_i2c_block_data(0x3d, 0, 4)
print(ret)
ret = bus.write_i2c_block_data(0x3d, 0, [i])
time.sleep(1)
ret = bus.read_i2c_block_data(0x3d, 0, 4)
print(ret)
j += 1
bus.close()
setup_leon_fan()