CAN driver cleanup (#2276)

* it's all the same thing

* not live

* less macro

* lil more

* bool

* lil more
This commit is contained in:
Adeeb Shihadeh
2025-09-10 20:00:41 -07:00
committed by GitHub
parent a7f31bdbcc
commit 7973ba4492
14 changed files with 59 additions and 124 deletions

View File

@@ -23,7 +23,7 @@ __version__ = '0.0.10'
CANPACKET_HEAD_SIZE = 0x6
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)}
PANDA_BUS_CNT = 3
PANDA_CAN_CNT = 3
def calculate_checksum(data):
@@ -225,11 +225,11 @@ class Panda:
self.can_reset_communications()
# disable automatic CAN-FD switching
for bus in range(PANDA_BUS_CNT):
for bus in range(PANDA_CAN_CNT):
self.set_canfd_auto(bus, False)
# set CAN speed
for bus in range(PANDA_BUS_CNT):
for bus in range(PANDA_CAN_CNT):
self.set_can_speed_kbps(bus, self._can_speed_kbps)
@property