Skip to content

Commit

Permalink
hex defines cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dzid26 committed Aug 17, 2024
1 parent 78ce6a0 commit 1152b6b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions board/safety/safety_bmw.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// CAN msgs we care about
#define BMW_EngineAndBrake 168
#define BMW_AccPedal 170
#define BMW_Speed 416
#define BMW_SteeringWheelAngle 196
#define BMW_CruiseControlStatus 512
#define BMW_DynamicCruiseControlStatus 403
#define BMW_CruiseControlStalk 404
#define BMW_TransmissionDataDisplay 466
#define BMW_EngineAndBrake 0xA8
#define BMW_AccPedal 0xAA
#define BMW_Speed 0x1A0
#define BMW_SteeringWheelAngle 0xC4
#define BMW_CruiseControlStatus 0x200
#define BMW_DynamicCruiseControlStatus 0x193
#define BMW_CruiseControlStalk 0x194
#define BMW_TransmissionDataDisplay 0x1D2

#define BMW_PT_CAN 0
#define BMW_F_CAN 1
Expand Down Expand Up @@ -86,10 +86,10 @@ static void bmw_rx_hook(const CANPacket_t *to_push) {
int bus = GET_BUS(to_push);

bool cruise_engaged = false;
if ((addr == 0x193) || (addr == 0x200)) { //handles both vehicle options VO544 and Vo540
if (addr == 0x193) { //dynamic cruise control
if ((addr == BMW_DynamicCruiseControlStatus) || (addr == BMW_CruiseControlStatus)) { //handles both vehicle options VO544 and Vo540
if (addr == BMW_DynamicCruiseControlStatus) { //dynamic cruise control
cruise_engaged = (((GET_BYTE(to_push, 5) >> 3) & 0x1U) == 1U);
} else if (addr == 0x200) { //normal cruise control option
} else if (addr == BMW_CruiseControlStatus) { //normal cruise control option
cruise_engaged = (((GET_BYTE(to_push, 1) >> 5) & 0x1U) == 1U);
} else {
cruise_engaged = false;
Expand Down

0 comments on commit 1152b6b

Please sign in to comment.