From 9b1095a27e6d9645ef64fcea3a6375117bccfe6e Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 18 Apr 2023 21:34:49 -0700 Subject: [PATCH] FPv2: only query brands with matching present ECUs (#27697) * speed up fingerprinting for CAN fp cars * add comment to describe this behavior * more explicit, no defaultdict * do this later * fix * a little more clear I think --- selfdrive/car/fw_versions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/selfdrive/car/fw_versions.py b/selfdrive/car/fw_versions.py index f85b7f6b7d..1c0d5003ec 100755 --- a/selfdrive/car/fw_versions.py +++ b/selfdrive/car/fw_versions.py @@ -221,6 +221,10 @@ def get_fw_versions_ordered(logcan, sendcan, ecu_rx_addrs, timeout=0.1, num_pand brand_matches = get_brand_ecu_matches(ecu_rx_addrs) for brand in sorted(brand_matches, key=lambda b: len(brand_matches[b]), reverse=True): + # Skip this brand if there are no matching present ECUs + if not len(brand_matches[brand]): + continue + car_fw = get_fw_versions(logcan, sendcan, query_brand=brand, timeout=timeout, num_pandas=num_pandas, debug=debug, progress=progress) all_car_fw.extend(car_fw) # Try to match using FW returned from this brand only