-
Notifications
You must be signed in to change notification settings - Fork 0
state rejection reasons #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Core/Inc/state_machine.h
Outdated
| } nero_menu_t; | ||
|
|
||
| typedef enum { | ||
| NO_ERROR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: can you change to like START_TRANSITION_OK or thing like that
| ENTER_DRIVE_BREAKS_NOT_ENGAGED, | ||
| ENTER_GAMES_TSMS_ON, | ||
| ENTER_GAMES_WHILE_MOVING | ||
| } state_transition_error_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just so you dont have to it bitshift these in the code later you coulddo it like this:
typedef enum {
ERROR_OK = 0,
REVERSE_DISABLED = 1 << 0,
DRIVE_FROM_FAULT = 1 << 1,
ENTER_DRIVE_DISABLED = 1 << 2,
ENTER_DRIVE_TSMS_OFF = 1 << 3,
ENTER_DRIVE_BREAKS_NOT_ENGAGED = 1 << 4,
ENTER_GAMES_TSMS_ON = 1 << 5,
ENTER_GAMES_WHILE_MOVING = 1 << 6
} state_transition_error_t;
Then you can just OR them together with no bit shift
| case F_REVERSE: | ||
| #ifdef DISABLE_REVERSE | ||
| printf("Reverse is disabled."); | ||
| cerberus_state.transition_error = (1 << REVERSE_DISABLED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the above comment, then just OR REVERSE_DISABLED into the transition_error byte with no bit shift
Core/Src/state_machine.c
Outdated
| cerberus_state.transition_error |= (1 << ENTER_DRIVE_BREAKS_NOT_ENGAGED); | ||
| } | ||
| if (cerberus_state.functional == FAULTED) { | ||
| cerberus_state.transition_error |= (1 << DRIVE_FROM_FAULT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
Changes
Added an enum for the different reasons a state change can be rejected. Sends 8 bits over can representing the 8 reasons (bc more than 1 can be true at the same time)
Notes
Wasn't really sure what to put for the sim so I just added the interpretation as if it were a number although obv that doesn't make sense.
Test Cases
To Do
Any remaining things that need to get done
Checklist
It can be helpful to check the
ChecksandFiles changedtabs.Please reach out to your Project Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.
Closes #330