mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-08-08 09:45:41 +08:00
a5cee30aa6
date: 2024-06-25T13:13:17
commit: 69a099242f
25 lines
531 B
Python
Executable File
25 lines
531 B
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import time
|
|
|
|
from panda import Panda
|
|
|
|
|
|
if __name__ == "__main__":
|
|
flag_set = False
|
|
while True:
|
|
try:
|
|
with Panda(disable_checks=False) as p:
|
|
if not flag_set:
|
|
p.set_heartbeat_disabled()
|
|
p.set_safety_mode(Panda.SAFETY_ELM327, 30)
|
|
flag_set = True
|
|
|
|
# shutdown when told
|
|
ch = p.can_health(0)
|
|
if ch['can_data_speed'] == 1000:
|
|
os.system("sudo poweroff")
|
|
except Exception as e:
|
|
print(str(e))
|
|
time.sleep(0.5)
|