Skip to content

Conversation

@chpy04
Copy link
Contributor

@chpy04 chpy04 commented Sep 15, 2025

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

  • Case A
  • Edge case
  • ...

To Do

Any remaining things that need to get done

  • item 1
  • ...

Checklist

It can be helpful to check the Checks and Files changed tabs.
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.

  • No merge conflicts
  • All checks passing
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #330

} nero_menu_t;

typedef enum {
NO_ERROR,
Copy link
Contributor

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;
Copy link
Contributor

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);
Copy link
Contributor

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

cerberus_state.transition_error |= (1 << ENTER_DRIVE_BREAKS_NOT_ENGAGED);
}
if (cerberus_state.functional == FAULTED) {
cerberus_state.transition_error |= (1 << DRIVE_FROM_FAULT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add rejection reasons for state change

3 participants