This commit is contained in:
机械小鸽 2025-03-05 18:29:08 +08:00 committed by GitHub
parent 8a5533ce1b
commit e8fad82fe9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -63,8 +63,10 @@ class CarState(CarStateBase):
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(can_gear, None))
ret.gearStep = cp.vl["GEAR"]["GEAR_BOX"]
ret.engineRpm = cp.vl["ENGINE_DATA"]["RPM"] # for mazda RPM
ret.pcmCruiseGap = cp.vl["CRZ_CTRL"]["DISTANCE_SETTING"] # copy from Hyundai
# 将CAN总线上的DISTANCE_SETTING值转换为与车辆显示一致的值
can_distance_setting = cp.vl["CRZ_CTRL"]["DISTANCE_SETTING"]
# 假设最大值为4使用5减去CAN值来获取正确的显示值
ret.pcmCruiseGap = 5 - can_distance_setting if 1 <= can_distance_setting <= 4 else can_distance_setting
ret.genericToggle = bool(cp.vl["BLINK_INFO"]["HIGH_BEAMS"])
ret.leftBlindspot = cp.vl["BSM"]["LEFT_BS_STATUS"] != 0