7
mirror of https://github.com/tenderlove/initial-v.git synced 2025-04-22 04:13:22 +00:00

add enum for park bit

This commit is contained in:
Aaron Patterson 2023-02-12 16:33:59 -08:00
parent e8c6c03ade
commit 8985e74052
No known key found for this signature in database
GPG Key ID: 953170BCB4FFAFC6

View File

@ -26,6 +26,16 @@ typedef enum {
SHIFTER_SIDE_UP,
SHIFTER_SIDE_DOWN,
SHIFTER_SIDE,
SHIFTER_CENTER_PARK,
SHIFTER_UP_PARK,
SHIFTER_UP_UP_PARK,
SHIFTER_DOWN_PARK,
SHIFTER_DOWN_DOWN_PARK,
SHIFTER_SIDE_UP_PARK,
SHIFTER_SIDE_DOWN_PARK,
SHIFTER_SIDE_PARK,
SHIFTER_MAX,
} handle_position_t;
@ -54,7 +64,7 @@ SHIFTER_POSITION(twai_message_t message, handle_position_t * pos)
uint8_t position = (message.data[2] >> 4) & 0xF;
// Resetting causes the position to go to 9
if (position > SHIFTER_MAX) {
if (position > 8) {
position = SHIFTER_CENTER;
}