2023-10-07 04:38:35 +08:00
|
|
|
#!/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
|
2024-03-14 05:51:40 +08:00
|
|
|
ch = p.can_health(0)
|
|
|
|
if ch['can_data_speed'] == 1000:
|
2023-10-07 04:38:35 +08:00
|
|
|
os.system("sudo poweroff")
|
2023-11-09 08:46:41 +08:00
|
|
|
except Exception as e:
|
|
|
|
print(str(e))
|
2023-10-07 04:38:35 +08:00
|
|
|
time.sleep(0.5)
|