mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-20 21:42:05 +08:00
CanBusBase: fix offset calculation (#28938)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
# functions common among cars
|
||||
import math
|
||||
from collections import namedtuple
|
||||
from typing import Dict, Optional
|
||||
|
||||
@@ -186,7 +185,7 @@ class CanBusBase:
|
||||
def __init__(self, CP, fingerprint: Optional[Dict[int, Dict[int, int]]]) -> None:
|
||||
if CP is None:
|
||||
assert fingerprint is not None
|
||||
num = math.ceil(max([k for k, v in fingerprint.items() if len(v)], default=1) / 4)
|
||||
num = max([k for k, v in fingerprint.items() if len(v)], default=0) // 4 + 1
|
||||
else:
|
||||
num = len(CP.safetyConfigs)
|
||||
self.offset = 4 * (num - 1)
|
||||
|
||||
Reference in New Issue
Block a user