@@ -27,27 +27,27 @@ const LongitudinalLimits *gm_long_limits;
2727
2828const 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.
4242AddrCheckStruct 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]))
5353addr_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