Skip to content

Commit df8ea39

Browse files
committed
Merge remote-tracking branch 'origin/master' into outback-forester-22-PR
2 parents 12dcbee + 579fff0 commit df8ea39

File tree

6 files changed

+151
-152
lines changed

6 files changed

+151
-152
lines changed

board/safety/safety_chrysler.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,38 +41,38 @@ typedef struct {
4141

4242
// CAN messages for Chrysler/Jeep platforms
4343
const ChryslerAddrs CHRYSLER_ADDRS = {
44-
.EPS_2 = 544, // EPS driver input torque
45-
.ESP_1 = 320, // Brake pedal and vehicle speed
46-
.ESP_8 = 284, // Brake pedal and vehicle speed
47-
.ECM_5 = 559, // Throttle position sensor
48-
.DAS_3 = 500, // ACC engagement states from DASM
49-
.DAS_6 = 678, // LKAS HUD and auto headlight control from DASM
50-
.LKAS_COMMAND = 658, // LKAS controls from DASM
51-
.CRUISE_BUTTONS = 571, // Cruise control buttons
44+
.EPS_2 = 0x220, // EPS driver input torque
45+
.ESP_1 = 0x140, // Brake pedal and vehicle speed
46+
.ESP_8 = 0x11C, // Brake pedal and vehicle speed
47+
.ECM_5 = 0x22F, // Throttle position sensor
48+
.DAS_3 = 0x1F4, // ACC engagement states from DASM
49+
.DAS_6 = 0x2A6, // LKAS HUD and auto headlight control from DASM
50+
.LKAS_COMMAND = 0x292, // LKAS controls from DASM
51+
.CRUISE_BUTTONS = 0x23B, // Cruise control buttons
5252
};
5353

5454
// CAN messages for the 5th gen RAM DT platform
5555
const ChryslerAddrs CHRYSLER_RAM_DT_ADDRS = {
56-
.EPS_2 = 49, // EPS driver input torque
57-
.ESP_1 = 131, // Brake pedal and vehicle speed
58-
.ESP_8 = 121, // Brake pedal and vehicle speed
59-
.ECM_5 = 157, // Throttle position sensor
60-
.DAS_3 = 153, // ACC engagement states from DASM
61-
.DAS_6 = 250, // LKAS HUD and auto headlight control from DASM
62-
.LKAS_COMMAND = 166, // LKAS controls from DASM
63-
.CRUISE_BUTTONS = 177, // Cruise control buttons
56+
.EPS_2 = 0x31, // EPS driver input torque
57+
.ESP_1 = 0x83, // Brake pedal and vehicle speed
58+
.ESP_8 = 0x79, // Brake pedal and vehicle speed
59+
.ECM_5 = 0x9D, // Throttle position sensor
60+
.DAS_3 = 0x99, // ACC engagement states from DASM
61+
.DAS_6 = 0xFA, // LKAS HUD and auto headlight control from DASM
62+
.LKAS_COMMAND = 0xA6, // LKAS controls from DASM
63+
.CRUISE_BUTTONS = 0xB1, // Cruise control buttons
6464
};
6565

6666
// CAN messages for the 5th gen RAM HD platform
6767
const ChryslerAddrs CHRYSLER_RAM_HD_ADDRS = {
68-
.EPS_2 = 544, // EPS driver input torque
69-
.ESP_1 = 320, // Brake pedal and vehicle speed
70-
.ESP_8 = 284, // Brake pedal and vehicle speed
71-
.ECM_5 = 559, // Throttle position sensor
72-
.DAS_3 = 500, // ACC engagement states from DASM
73-
.DAS_6 = 629, // LKAS HUD and auto headlight control from DASM
74-
.LKAS_COMMAND = 630, // LKAS controls from DASM
75-
.CRUISE_BUTTONS = 570, // Cruise control buttons
68+
.EPS_2 = 0x220, // EPS driver input torque
69+
.ESP_1 = 0x140, // Brake pedal and vehicle speed
70+
.ESP_8 = 0x11C, // Brake pedal and vehicle speed
71+
.ECM_5 = 0x22F, // Throttle position sensor
72+
.DAS_3 = 0x1F4, // ACC engagement states from DASM
73+
.DAS_6 = 0x275, // LKAS HUD and auto headlight control from DASM
74+
.LKAS_COMMAND = 0x276, // LKAS controls from DASM
75+
.CRUISE_BUTTONS = 0x23A, // Cruise control buttons
7676
};
7777

7878
const CanMsg CHRYSLER_TX_MSGS[] = {

board/safety/safety_gm.h

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,27 @@ const LongitudinalLimits *gm_long_limits;
2727

2828
const int GM_STANDSTILL_THRSLD = 10; // 0.311kph
2929

30-
const CanMsg GM_ASCM_TX_MSGS[] = {{384, 0, 4}, {1033, 0, 7}, {1034, 0, 7}, {715, 0, 8}, {880, 0, 6}, // pt bus
31-
{161, 1, 7}, {774, 1, 8}, {776, 1, 7}, {784, 1, 2}, // obs bus
32-
{789, 2, 5}, // ch bus
30+
const CanMsg GM_ASCM_TX_MSGS[] = {{0x180, 0, 4}, {0x409, 0, 7}, {0x40A, 0, 7}, {0x2CB, 0, 8}, {0x370, 0, 6}, // pt bus
31+
{0xA1, 1, 7}, {0x306, 1, 8}, {0x308, 1, 7}, {0x310, 1, 2}, // obs bus
32+
{0x315, 2, 5}, // ch bus
3333
{0x104c006c, 3, 3}, {0x10400060, 3, 5}}; // gmlan
3434

35-
const CanMsg GM_CAM_TX_MSGS[] = {{384, 0, 4}, // pt bus
36-
{481, 2, 7}, {388, 2, 8}}; // camera bus
35+
const CanMsg GM_CAM_TX_MSGS[] = {{0x180, 0, 4}, // pt bus
36+
{0x1E1, 2, 7}, {0x184, 2, 8}}; // camera bus
3737

38-
const CanMsg GM_CAM_LONG_TX_MSGS[] = {{384, 0, 4}, {789, 0, 5}, {715, 0, 8}, {880, 0, 6}, // pt bus
39-
{388, 2, 8}}; // camera bus
38+
const CanMsg GM_CAM_LONG_TX_MSGS[] = {{0x180, 0, 4}, {0x315, 0, 5}, {0x2CB, 0, 8}, {0x370, 0, 6}, // pt bus
39+
{0x184, 2, 8}}; // camera bus
4040

4141
// TODO: do checksum and counter checks. Add correct timestep, 0.1s for now.
4242
AddrCheckStruct gm_addr_checks[] = {
43-
{.msg = {{388, 0, 8, .expected_timestep = 100000U}, { 0 }, { 0 }}},
44-
{.msg = {{842, 0, 5, .expected_timestep = 100000U}, { 0 }, { 0 }}},
45-
{.msg = {{481, 0, 7, .expected_timestep = 100000U}, { 0 }, { 0 }}},
46-
{.msg = {{190, 0, 6, .expected_timestep = 100000U}, // Volt, Silverado, Acadia Denali
47-
{190, 0, 7, .expected_timestep = 100000U}, // Bolt EUV
48-
{190, 0, 8, .expected_timestep = 100000U}}}, // Escalade
49-
{.msg = {{452, 0, 8, .expected_timestep = 100000U}, { 0 }, { 0 }}},
50-
{.msg = {{201, 0, 8, .expected_timestep = 100000U}, { 0 }, { 0 }}},
43+
{.msg = {{0x184, 0, 8, .expected_timestep = 100000U}, { 0 }, { 0 }}},
44+
{.msg = {{0x34A, 0, 5, .expected_timestep = 100000U}, { 0 }, { 0 }}},
45+
{.msg = {{0x1E1, 0, 7, .expected_timestep = 100000U}, { 0 }, { 0 }}},
46+
{.msg = {{0xBE, 0, 6, .expected_timestep = 100000U}, // Volt, Silverado, Acadia Denali
47+
{0xBE, 0, 7, .expected_timestep = 100000U}, // Bolt EUV
48+
{0xBE, 0, 8, .expected_timestep = 100000U}}}, // Escalade
49+
{.msg = {{0x1C4, 0, 8, .expected_timestep = 100000U}, { 0 }, { 0 }}},
50+
{.msg = {{0xC9, 0, 8, .expected_timestep = 100000U}, { 0 }, { 0 }}},
5151
};
5252
#define GM_RX_CHECK_LEN (sizeof(gm_addr_checks) / sizeof(gm_addr_checks[0]))
5353
addr_checks gm_rx_checks = {gm_addr_checks, GM_RX_CHECK_LEN};
@@ -73,22 +73,22 @@ static int gm_rx_hook(CANPacket_t *to_push) {
7373
if (valid && (GET_BUS(to_push) == 0U)) {
7474
int addr = GET_ADDR(to_push);
7575

76-
if (addr == 388) {
76+
if (addr == 0x184) {
7777
int torque_driver_new = ((GET_BYTE(to_push, 6) & 0x7U) << 8) | GET_BYTE(to_push, 7);
7878
torque_driver_new = to_signed(torque_driver_new, 11);
7979
// update array of samples
8080
update_sample(&torque_driver, torque_driver_new);
8181
}
8282

8383
// sample rear wheel speeds
84-
if (addr == 842) {
84+
if (addr == 0x34A) {
8585
int left_rear_speed = (GET_BYTE(to_push, 0) << 8) | GET_BYTE(to_push, 1);
8686
int right_rear_speed = (GET_BYTE(to_push, 2) << 8) | GET_BYTE(to_push, 3);
8787
vehicle_moving = (left_rear_speed > GM_STANDSTILL_THRSLD) || (right_rear_speed > GM_STANDSTILL_THRSLD);
8888
}
8989

9090
// ACC steering wheel buttons (GM_CAM is tied to the PCM)
91-
if ((addr == 481) && !gm_pcm_cruise) {
91+
if ((addr == 0x1E1) && !gm_pcm_cruise) {
9292
int button = (GET_BYTE(to_push, 5) & 0x70U) >> 4;
9393

9494
// enter controls on falling edge of set or rising edge of resume (avoids fault)
@@ -108,15 +108,15 @@ static int gm_rx_hook(CANPacket_t *to_push) {
108108

109109
// Reference for brake pressed signals:
110110
// https://github.com/commaai/openpilot/blob/master/selfdrive/car/gm/carstate.py
111-
if ((addr == 190) && (gm_hw == GM_ASCM)) {
111+
if ((addr == 0xBE) && (gm_hw == GM_ASCM)) {
112112
brake_pressed = GET_BYTE(to_push, 1) >= 8U;
113113
}
114114

115-
if ((addr == 201) && (gm_hw == GM_CAM)) {
115+
if ((addr == 0xC9) && (gm_hw == GM_CAM)) {
116116
brake_pressed = GET_BIT(to_push, 40U) != 0U;
117117
}
118118

119-
if (addr == 452) {
119+
if (addr == 0x1C4) {
120120
gas_pressed = GET_BYTE(to_push, 5) != 0U;
121121

122122
// enter controls on rising edge of ACC, exit controls when ACC off
@@ -126,14 +126,14 @@ static int gm_rx_hook(CANPacket_t *to_push) {
126126
}
127127
}
128128

129-
if (addr == 189) {
129+
if (addr == 0xBD) {
130130
regen_braking = (GET_BYTE(to_push, 0) >> 4) != 0U;
131131
}
132132

133-
bool stock_ecu_detected = (addr == 384); // ASCMLKASteeringCmd
133+
bool stock_ecu_detected = (addr == 0x180); // ASCMLKASteeringCmd
134134

135135
// Check ASCMGasRegenCmd only if we're blocking it
136-
if (!gm_pcm_cruise && (addr == 715)) {
136+
if (!gm_pcm_cruise && (addr == 0x2CB)) {
137137
stock_ecu_detected = true;
138138
}
139139
generic_rx_checks(stock_ecu_detected);
@@ -163,7 +163,7 @@ static int gm_tx_hook(CANPacket_t *to_send) {
163163
}
164164

165165
// BRAKE: safety check
166-
if (addr == 789) {
166+
if (addr == 0x315) {
167167
int brake = ((GET_BYTE(to_send, 0) & 0xFU) << 8) + GET_BYTE(to_send, 1);
168168
brake = (0x1000 - brake) & 0xFFF;
169169
if (longitudinal_brake_checks(brake, *gm_long_limits)) {
@@ -172,7 +172,7 @@ static int gm_tx_hook(CANPacket_t *to_send) {
172172
}
173173

174174
// LKA STEER: safety check
175-
if (addr == 384) {
175+
if (addr == 0x180) {
176176
int desired_torque = ((GET_BYTE(to_send, 0) & 0x7U) << 8) + GET_BYTE(to_send, 1);
177177
desired_torque = to_signed(desired_torque, 11);
178178

@@ -184,7 +184,7 @@ static int gm_tx_hook(CANPacket_t *to_send) {
184184
}
185185

186186
// GAS/REGEN: safety check
187-
if (addr == 715) {
187+
if (addr == 0x2CB) {
188188
bool apply = GET_BIT(to_send, 0U) != 0U;
189189
int gas_regen = ((GET_BYTE(to_send, 2) & 0x7FU) << 5) + ((GET_BYTE(to_send, 3) & 0xF8U) >> 3);
190190

@@ -199,7 +199,7 @@ static int gm_tx_hook(CANPacket_t *to_send) {
199199
}
200200

201201
// BUTTONS: used for resume spamming and cruise cancellation with stock longitudinal
202-
if ((addr == 481) && gm_pcm_cruise) {
202+
if ((addr == 0x1E1) && gm_pcm_cruise) {
203203
int button = (GET_BYTE(to_send, 5) >> 4) & 0x7U;
204204

205205
bool allowed_cancel = (button == 6) && cruise_engaged_prev;
@@ -219,16 +219,16 @@ static int gm_fwd_hook(int bus_num, int addr) {
219219
if (gm_hw == GM_CAM) {
220220
if (bus_num == 0) {
221221
// block PSCMStatus; forwarded through openpilot to hide an alert from the camera
222-
bool is_pscm_msg = (addr == 388);
222+
bool is_pscm_msg = (addr == 0x184);
223223
if (!is_pscm_msg) {
224224
bus_fwd = 2;
225225
}
226226
}
227227

228228
if (bus_num == 2) {
229229
// block lkas message and acc messages if gm_cam_long, forward all others
230-
bool is_lkas_msg = (addr == 384);
231-
bool is_acc_msg = (addr == 789) || (addr == 715) || (addr == 880);
230+
bool is_lkas_msg = (addr == 0x180);
231+
bool is_acc_msg = (addr == 0x315) || (addr == 0x2CB) || (addr == 0x370);
232232
int block_msg = is_lkas_msg || (is_acc_msg && gm_cam_long);
233233
if (!block_msg) {
234234
bus_fwd = 0;

0 commit comments

Comments
 (0)