Move safety constants to opendbc (#2145)

* move to opendbc

* all passing

* do the rest

* fix

* and another

* order

* and update ref to master
This commit is contained in:
Shane Smiskol
2025-02-11 22:14:44 -06:00
committed by GitHub
parent 72a99e9e9d
commit d3508ff042
48 changed files with 182 additions and 189 deletions

View File

@@ -1,10 +1,11 @@
#!/usr/bin/env python3
import argparse
from tqdm import tqdm
from panda import Panda
from opendbc.car.carlog import carlog
from opendbc.car.uds import UdsClient, MessageTimeoutError, NegativeResponseError, InvalidSubAddressError, \
SESSION_TYPE, DATA_IDENTIFIER_TYPE
from opendbc.safety import Safety
from panda import Panda
if __name__ == "__main__":
parser = argparse.ArgumentParser()
@@ -63,7 +64,7 @@ if __name__ == "__main__":
exit()
panda = Panda(serial=args.serial)
panda.set_safety_mode(Panda.SAFETY_ELM327, 1 if args.no_obd else 0)
panda.set_safety_mode(Safety.SAFETY_ELM327, 1 if args.no_obd else 0)
print("querying addresses ...")
with tqdm(addrs) as t:
for addr in t:

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import time
import struct
from opendbc.safety import Safety
from panda import Panda
from hexdump import hexdump
from panda.python.isotp import isotp_send, isotp_recv
@@ -30,7 +31,7 @@ def get_supported_pids():
if __name__ == "__main__":
panda = Panda()
panda.set_safety_mode(Panda.SAFETY_ELM327)
panda.set_safety_mode(Safety.SAFETY_ELM327)
panda.can_clear(0)
# 09 02 = Get VIN

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import binascii
from opendbc.safety import Safety
from panda import Panda
def tesla_tester():
@@ -13,7 +14,7 @@ def tesla_tester():
# Now set the panda from its default of SAFETY_SILENT (read only) to SAFETY_ALLOUTPUT
# Careful, as this will let us send any CAN messages we want (which could be very bad!)
print("Setting Panda to output mode...")
p.set_safety_mode(Panda.SAFETY_ALLOUTPUT)
p.set_safety_mode(Safety.SAFETY_ALLOUTPUT)
# BDY 0x248 is the MCU_commands message, which includes folding mirrors, opening the trunk, frunk, setting the cars lock state and more.
# For our test, we will edit the 3rd byte, which is MCU_lockRequest. 0x01 will lock, 0x02 will unlock:
@@ -26,7 +27,7 @@ def tesla_tester():
#Back to safety...
print("Disabling output on Panda...")
p.set_safety_mode(Panda.SAFETY_SILENT)
p.set_safety_mode(Safety.SAFETY_SILENT)
print("Reading VIN from 0x568. This is painfully slow and can take up to 3 minutes (1 minute per message; 3 messages needed for full VIN)...")