Compare commits

...

3 Commits

Author SHA1 Message Date
机械小鸽
b1cb459bd9
回放 2025-06-14 21:18:29 +08:00
机械小鸽
ea23209348
汉化 2025-06-14 16:03:07 +08:00
机械小鸽
0f8a46cfd6
mazda 2025-06-14 15:09:27 +08:00
37 changed files with 12 additions and 5 deletions

View File

@ -21,9 +21,10 @@ class CarState(CarStateBase):
self.low_speed_alert = False self.low_speed_alert = False
self.lkas_allowed_speed = False self.lkas_allowed_speed = False
self.lkas_disabled = False self.lkas_disabled = False
self.prev_distance_button = 0 self.prev_distance_button = 0
self.distance_button = 0 self.distance_button = 0
self.pcmCruiseGap = 0 # copy from Hyundai
def update(self, can_parsers) -> structs.CarState: def update(self, can_parsers) -> structs.CarState:
cp = can_parsers[Bus.pt] cp = can_parsers[Bus.pt]
@ -33,7 +34,7 @@ class CarState(CarStateBase):
self.prev_distance_button = self.distance_button self.prev_distance_button = self.distance_button
self.distance_button = cp.vl["CRZ_BTNS"]["DISTANCE_LESS"] self.distance_button = cp.vl["CRZ_BTNS"]["DISTANCE_LESS"]
self.prev_cruise_buttons = self.cruise_buttons self.prev_cruise_buttons = self.cruise_buttons
if bool(cp.vl["CRZ_BTNS"]["SET_P"]): if bool(cp.vl["CRZ_BTNS"]["SET_P"]):
@ -44,7 +45,7 @@ class CarState(CarStateBase):
self.cruise_buttons = Buttons.RESUME self.cruise_buttons = Buttons.RESUME
else: else:
self.cruise_buttons = Buttons.NONE self.cruise_buttons = Buttons.NONE
ret.wheelSpeeds = self.get_wheel_speeds( ret.wheelSpeeds = self.get_wheel_speeds(
cp.vl["WHEEL_SPEEDS"]["FL"], cp.vl["WHEEL_SPEEDS"]["FL"],
cp.vl["WHEEL_SPEEDS"]["FR"], cp.vl["WHEEL_SPEEDS"]["FR"],
@ -61,6 +62,12 @@ class CarState(CarStateBase):
can_gear = int(cp.vl["GEAR"]["GEAR"]) can_gear = int(cp.vl["GEAR"]["GEAR"])
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(can_gear, None)) ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(can_gear, None))
ret.gearStep = cp.vl["GEAR"]["GEAR_BOX"] ret.gearStep = cp.vl["GEAR"]["GEAR_BOX"]
ret.engineRpm = cp.vl["ENGINE_DATA"]["RPM"] # for mazda RPM
# 将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.genericToggle = bool(cp.vl["BLINK_INFO"]["HIGH_BEAMS"])
ret.leftBlindspot = cp.vl["BSM"]["LEFT_BS_STATUS"] != 0 ret.leftBlindspot = cp.vl["BSM"]["LEFT_BS_STATUS"] != 0
@ -135,7 +142,7 @@ class CarState(CarStateBase):
self.lkas_previously_enabled = self.lkas_enabled self.lkas_previously_enabled = self.lkas_enabled
self.lkas_enabled = not self.lkas_disabled self.lkas_enabled = not self.lkas_disabled
# TODO: add button types for inc and dec # TODO: add button types for inc and dec
#ret.buttonEvents = create_button_events(self.distance_button, prev_distance_button, {1: ButtonType.gapAdjustCruise}) #ret.buttonEvents = create_button_events(self.distance_button, prev_distance_button, {1: ButtonType.gapAdjustCruise})
ret.buttonEvents = [ ret.buttonEvents = [

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -130,7 +130,7 @@ class Soundd:
if self.lang == "main_ko": if self.lang == "main_ko":
wavefile = wave.open(BASEDIR + "/selfdrive/assets/sounds/" + filename, 'r') wavefile = wave.open(BASEDIR + "/selfdrive/assets/sounds/" + filename, 'r')
else: else:
wavefile = wave.open(BASEDIR + "/selfdrive/assets/sounds_eng/" + filename, 'r') wavefile = wave.open(BASEDIR + "/selfdrive/assets/sounds_chs/" + filename, 'r')
#assert wavefile.getnchannels() == 1 #assert wavefile.getnchannels() == 1
assert wavefile.getsampwidth() == 2 assert wavefile.getsampwidth() == 2