From 5697ecbbc34f9b8d5899813927e41f538d10b079 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 27 Jan 2022 17:20:37 -0800 Subject: [PATCH 1/2] consistent style, like toyota --- selfdrive/car/chrysler/carstate.py | 2 +- selfdrive/car/gm/carstate.py | 8 ++--- selfdrive/car/honda/carstate.py | 26 +++++++--------- selfdrive/car/hyundai/carstate.py | 44 ++++++++-------------------- selfdrive/car/nissan/carstate.py | 24 ++++----------- selfdrive/car/subaru/carstate.py | 12 ++------ selfdrive/car/toyota/carstate.py | 4 +-- selfdrive/car/volkswagen/carstate.py | 10 +++---- 8 files changed, 42 insertions(+), 88 deletions(-) diff --git a/selfdrive/car/chrysler/carstate.py b/selfdrive/car/chrysler/carstate.py index 27b5745d8448b7..30a0bf6a3a3f09 100644 --- a/selfdrive/car/chrysler/carstate.py +++ b/selfdrive/car/chrysler/carstate.py @@ -126,7 +126,7 @@ def get_can_parser(CP): ("BLIND_SPOT_RIGHT", "BLIND_SPOT_WARNINGS"), ("BLIND_SPOT_LEFT", "BLIND_SPOT_WARNINGS"), ] - checks += [("BLIND_SPOT_WARNINGS", 2)] + checks.append(("BLIND_SPOT_WARNINGS", 2)) return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 0) diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index 945f21a1551d43..97425609235ce0 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -124,12 +124,8 @@ def get_can_parser(CP): ] if CP.carFingerprint == CAR.VOLT: - signals += [ - ("RegenPaddle", "EBCMRegenPaddle"), - ] - checks += [ - ("EBCMRegenPaddle", 50), - ] + signals.append(("RegenPaddle", "EBCMRegenPaddle")) + checks.append(("EBCMRegenPaddle", 50)) return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, CanBus.POWERTRAIN) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index e6bb9c14844c69..75f8d23204105b 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -65,17 +65,13 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg): ] if CP.carFingerprint in (CAR.CRV_HYBRID, CAR.CIVIC_BOSCH_DIESEL, CAR.ACURA_RDX_3G, CAR.HONDA_E): - checks += [ - (gearbox_msg, 50), - ] + checks.append((gearbox_msg, 50)) else: - checks += [ - (gearbox_msg, 100), - ] + checks.append((gearbox_msg, 100)) if CP.carFingerprint in HONDA_BOSCH_ALT_BRAKE_SIGNAL: - signals += [("BRAKE_PRESSED", "BRAKE_MODULE", 0)] - checks += [("BRAKE_MODULE", 50)] + signals.append(("BRAKE_PRESSED", "BRAKE_MODULE", 0)) + checks.append(("BRAKE_MODULE", 50)) if CP.carFingerprint in HONDA_BOSCH: signals += [ @@ -103,14 +99,14 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg): ("CRUISE_SPEED_OFFSET", "CRUISE_PARAMS", 0)] if CP.carFingerprint == CAR.ODYSSEY_CHN: - checks += [("CRUISE_PARAMS", 10)] + checks.append(("CRUISE_PARAMS", 10)) else: - checks += [("CRUISE_PARAMS", 50)] + checks.append(("CRUISE_PARAMS", 50)) if CP.carFingerprint in (CAR.ACCORD, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E): - signals += [("DRIVERS_DOOR_OPEN", "SCM_FEEDBACK", 1)] + signals.append(("DRIVERS_DOOR_OPEN", "SCM_FEEDBACK", 1)) elif CP.carFingerprint == CAR.ODYSSEY_CHN: - signals += [("DRIVERS_DOOR_OPEN", "SCM_BUTTONS", 1)] + signals.append(("DRIVERS_DOOR_OPEN", "SCM_BUTTONS", 1)) elif CP.carFingerprint in (CAR.FREED, CAR.HRV): signals += [("DRIVERS_DOOR_OPEN", "SCM_BUTTONS", 1), ("WHEELS_MOVING", "STANDSTILL", 1)] @@ -133,8 +129,8 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg): ("EPB_STATUS", 50), ] elif CP.carFingerprint in (CAR.ODYSSEY, CAR.ODYSSEY_CHN): - signals += [("EPB_STATE", "EPB_STATUS", 0)] - checks += [("EPB_STATUS", 50)] + signals.append(("EPB_STATE", "EPB_STATUS", 0)) + checks.append(("EPB_STATUS", 50)) # add gas interceptor reading if we are using it if CP.enableGasInterceptor: @@ -147,7 +143,7 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg): ("BRAKE_ERROR_1", "STANDSTILL", 1), ("BRAKE_ERROR_2", "STANDSTILL", 1) ] - checks += [("STANDSTILL", 50)] + checks.append(("STANDSTILL", 50)) return signals, checks diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 205f293484f72e..29e7d8f2e52b81 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -206,7 +206,7 @@ def get_can_parser(CP): ("FCA_CmdAct", "FCA11"), ("CF_VSM_Warn", "FCA11"), ] - checks += [("FCA11", 50)] + checks.append(("FCA11", 50)) else: signals += [ ("AEB_CmdAct", "SCC12"), @@ -218,20 +218,14 @@ def get_can_parser(CP): ("CF_Lca_IndLeft", "LCA11"), ("CF_Lca_IndRight", "LCA11"), ] - checks += [("LCA11", 50)] + checks.append(("LCA11", 50)) if CP.carFingerprint in (HYBRID_CAR | EV_CAR): if CP.carFingerprint in HYBRID_CAR: - signals += [ - ("CR_Vcu_AccPedDep_Pos", "E_EMS11") - ] + signals.append(("CR_Vcu_AccPedDep_Pos", "E_EMS11")) else: - signals += [ - ("Accel_Pedal_Pos", "E_EMS11") - ] - checks += [ - ("E_EMS11", 50), - ] + signals.append(("Accel_Pedal_Pos", "E_EMS11")) + checks.append(("E_EMS11", 50)) else: signals += [ ("PV_AV_CAN", "EMS12"), @@ -243,29 +237,17 @@ def get_can_parser(CP): ] if CP.carFingerprint in FEATURES["use_cluster_gears"]: - signals += [ - ("CF_Clu_Gear", "CLU15"), - ] - checks += [ - ("CLU15", 5) - ] + signals.apepnd(("CF_Clu_Gear", "CLU15")) + checks.append(("CLU15", 5)) elif CP.carFingerprint in FEATURES["use_tcu_gears"]: - signals += [ - ("CUR_GR", "TCU12") - ] - checks += [ - ("TCU12", 100) - ] + signals.append(("CUR_GR", "TCU12")) + checks.append(("TCU12", 100)) elif CP.carFingerprint in FEATURES["use_elect_gears"]: - signals += [("Elect_Gear_Shifter", "ELECT_GEAR")] - checks += [("ELECT_GEAR", 20)] + signals.append(("Elect_Gear_Shifter", "ELECT_GEAR")) + checks.append(("ELECT_GEAR", 20)) else: - signals += [ - ("CF_Lvr_Gear", "LVR12") - ] - checks += [ - ("LVR12", 100) - ] + signals.append(("CF_Lvr_Gear", "LVR12")) + checks.append(("LVR12", 100)) return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 0) diff --git a/selfdrive/car/nissan/carstate.py b/selfdrive/car/nissan/carstate.py index 1c88dfbc3eb03c..856383c34b95ab 100644 --- a/selfdrive/car/nissan/carstate.py +++ b/selfdrive/car/nissan/carstate.py @@ -218,12 +218,8 @@ def get_can_parser(CP): ] return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 1) - signals += [ - ("STEER_TORQUE_DRIVER", "STEER_TORQUE_SENSOR"), - ] - checks += [ - ("STEER_TORQUE_SENSOR", 100), - ] + signals.append(("STEER_TORQUE_DRIVER", "STEER_TORQUE_SENSOR")) + checks.append(("STEER_TORQUE_SENSOR", 100)) return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 0) @@ -345,19 +341,11 @@ def get_cam_can_parser(CP): checks = [] if CP.carFingerprint in (CAR.ROGUE, CAR.XTRAIL): - signals += [ - ("CRUISE_ON", "PRO_PILOT"), - ] - checks += [ - ("PRO_PILOT", 100), - ] + signals.append(("CRUISE_ON", "PRO_PILOT")) + checks.append(("PRO_PILOT", 100)) elif CP.carFingerprint == CAR.ALTIMA: - signals += [ - ("STEER_TORQUE_DRIVER", "STEER_TORQUE_SENSOR"), - ] - checks += [ - ("STEER_TORQUE_SENSOR", 100), - ] + signals.append(("STEER_TORQUE_DRIVER", "STEER_TORQUE_SENSOR")) + checks.append(("STEER_TORQUE_SENSOR", 100)) return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 0) return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 1) diff --git a/selfdrive/car/subaru/carstate.py b/selfdrive/car/subaru/carstate.py index 53693d9a063f07..468f039d1bd561 100644 --- a/selfdrive/car/subaru/carstate.py +++ b/selfdrive/car/subaru/carstate.py @@ -119,9 +119,7 @@ def get_can_parser(CP): ("L_APPROACHING", "BSD_RCTA"), ("R_APPROACHING", "BSD_RCTA"), ] - checks += [ - ("BSD_RCTA", 17), - ] + checks.append(("BSD_RCTA", 17)) if CP.carFingerprint not in PREGLOBAL_CARS: signals += [ @@ -137,13 +135,9 @@ def get_can_parser(CP): ("CruiseControl", 20), ] else: - signals += [ - ("UNITS", "Dash_State2"), - ] + signals.append(("UNITS", "Dash_State2")) - checks += [ - ("Dash_State2", 1), - ] + checks.append(("Dash_State2", 1)) if CP.carFingerprint == CAR.FORESTER_PREGLOBAL: checks += [ diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index 3f35fcb575794f..752bbcedf255bc 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -201,9 +201,7 @@ def get_can_parser(CP): ("R_ADJACENT", "BSM", 0), ("R_APPROACHING", "BSM", 0), ] - checks += [ - ("BSM", 1) - ] + checks.append(("BSM", 1)) return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 0) diff --git a/selfdrive/car/volkswagen/carstate.py b/selfdrive/car/volkswagen/carstate.py index 9f8a97f34d8d11..79bd68cd41ce1c 100644 --- a/selfdrive/car/volkswagen/carstate.py +++ b/selfdrive/car/volkswagen/carstate.py @@ -212,15 +212,15 @@ def get_can_parser(CP): ] if CP.transmissionType == TransmissionType.automatic: - signals += [("GE_Fahrstufe", "Getriebe_11")] # Auto trans gear selector position - checks += [("Getriebe_11", 20)] # From J743 Auto transmission control module + signals.append(("GE_Fahrstufe", "Getriebe_11")) # Auto trans gear selector position + checks.append(("Getriebe_11", 20)) # From J743 Auto transmission control module elif CP.transmissionType == TransmissionType.direct: - signals += [("GearPosition", "EV_Gearshift")] # EV gear selector position - checks += [("EV_Gearshift", 10)] # From J??? unknown EV control module + signals.append(("GearPosition", "EV_Gearshift")) # EV gear selector position + checks.append(("EV_Gearshift", 10)) # From J??? unknown EV control module elif CP.transmissionType == TransmissionType.manual: signals += [("MO_Kuppl_schalter", "Motor_14"), # Clutch switch ("BCM1_Rueckfahrlicht_Schalter", "Gateway_72")] # Reverse light from BCM - checks += [("Motor_14", 10)] # From J623 Engine control module + checks.append(("Motor_14", 10)) # From J623 Engine control module if CP.networkLocation == NetworkLocation.fwdCamera: # Radars are here on CANBUS.pt From 842bc8d978b830a427c8398277ce795f682ae376 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 27 Jan 2022 17:25:25 -0800 Subject: [PATCH 2/2] typo --- selfdrive/car/hyundai/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 29e7d8f2e52b81..8da60f1b8f90aa 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -237,7 +237,7 @@ def get_can_parser(CP): ] if CP.carFingerprint in FEATURES["use_cluster_gears"]: - signals.apepnd(("CF_Clu_Gear", "CLU15")) + signals.append(("CF_Clu_Gear", "CLU15")) checks.append(("CLU15", 5)) elif CP.carFingerprint in FEATURES["use_tcu_gears"]: signals.append(("CUR_GR", "TCU12"))