Enable CAN3 printer (#1991)

* panda has 3 can peripherals

* enable printing CAN3
This commit is contained in:
dzid26 2024-08-27 00:15:29 +00:00 committed by GitHub
parent 866bd9c3bc
commit 2b94e4fef7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -22,7 +22,7 @@ __version__ = '0.0.10'
CANPACKET_HEAD_SIZE = 0x6 CANPACKET_HEAD_SIZE = 0x6
DLC_TO_LEN = [0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 20, 24, 32, 48, 64] DLC_TO_LEN = [0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 20, 24, 32, 48, 64]
LEN_TO_DLC = {length: dlc for (dlc, length) in enumerate(DLC_TO_LEN)} LEN_TO_DLC = {length: dlc for (dlc, length) in enumerate(DLC_TO_LEN)}
PANDA_BUS_CNT = 4 PANDA_BUS_CNT = 3
def calculate_checksum(data): def calculate_checksum(data):

View File

@ -17,7 +17,12 @@ def can_printer():
start = sec_since_boot() start = sec_since_boot()
lp = sec_since_boot() lp = sec_since_boot()
msgs = defaultdict(list) msgs = defaultdict(list)
canbus = int(os.getenv("CAN", "0")) canbus = int(os.getenv("CAN", "0"))
if canbus == 3:
canbus = 1
p.set_obd(True)
while True: while True:
can_recv = p.can_recv() can_recv = p.can_recv()
for address, dat, src in can_recv: for address, dat, src in can_recv: