carrot/panda/tests/som/on-device.py
FrogAi 659adb6457 openpilot v0.9.7 release
date: 2024-03-17T10:14:38
master commit: 7e9a909e0e57ecb31df4c87c5b9a06b1204fd034
2024-05-24 17:43:27 -07:00

25 lines
537 B
Python

#!/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
dt = p.get_datetime()
if dt.year == 2040 and dt.month == 8:
os.system("sudo poweroff")
except Exception as e:
print(str(e))
time.sleep(0.5)