-
Notifications
You must be signed in to change notification settings - Fork 29
Fix #16, Convert LC state macros to enums #48
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: main
Are you sure you want to change the base?
Fix #16, Convert LC state macros to enums #48
Conversation
jphickey
left a comment
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.
For messages and tables we need to stick with types that have a well-defined bit length because these are interface structures.
Otherwise, I like making enum's, but we need to adhere to the name convention, because in the future the intent is to generate these header files from a command/data dictionary.
fsw/src/lc_msgdefs.h
Outdated
| LC_STATE_PASSIVE, /**< \brief LC Application State Pasive */ | ||
| LC_STATE_DISABLED, /**< \brief LC Application State Disabled */ | ||
| LC_STATE_FROM_CDS /**< \brief Used for reset processing, not valid state */ | ||
| } LC_AppState_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.
Type name should be LC_AppState_Enum_t and labels should all start with LC_AppState_ prefix (instead of LC_STATE_)
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.
Updated.
fsw/src/lc_msgdefs.h
Outdated
| LC_APSTATE_DISABLED, /**< \brief Actionpoint state disabled */ | ||
| LC_APSTATE_PERMOFF, /**< \brief Actionpoint state permanently off, see #LC_SET_AP_PERMOFF_CC */ | ||
| LC_ACTION_NOT_USED = 255 /**< \brief Actionpoint unused, not valid command argument */ | ||
| } LC_APState_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.
Similar typedef and name here (see cFE naming convention document)
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.
Updated.
Renamed to LC_ActionPointState... (rather than LC_ApState... to avoid confusion with LC_AppState....
fsw/src/lc_tbl.h
Outdated
| uint16 RPNEquation[LC_MAX_RPN_EQU_SIZE]; /**< \brief Reverse Polish Equation that | ||
| specifies when this actionpoint | ||
| should fail */ | ||
| LC_APState_t DefaultState; /**< \brief Default state for this AP (enumerated) |
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.
this should stay uint8 because it is a table (enums are not defined length)
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.
Updated.
Forgot to consider that aspect.
fsw/src/lc_msg.h
Outdated
| uint16 APNumber; /**< \brief Which actionpoint(s) to change */ | ||
| uint16 NewAPState; /**< \brief New actionpoint state */ | ||
| uint16 APNumber; /**< \brief Which actionpoint(s) to change */ | ||
| LC_APState_t NewAPState; /**< \brief New actionpoint state */ |
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.
this should stay uint16 because it is a message (enums are not defined length)
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.
Updated.
Thanks - forgot to consider that aspect.
fsw/src/lc_tbl.h
Outdated
| uint8 CurrentState; /**< \brief Current state of this actionpoint */ | ||
| uint8 ActionResult; /**< \brief Result for the last sample of this actionpoint */ | ||
|
|
||
| LC_APState_t CurrentState; /**< \brief Current state of this actionpoint */ |
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, it needs to be a defined length in this context (uint8)
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.
Updated.
0a658cd to
ad7c0e7
Compare
fe4d7f2 to
9147dfc
Compare
fsw/inc/lc_msgdefs.h
Outdated
|
|
||
| #ifndef LC_OMIT_DEPRECATED | ||
| #define LC_SET_AP_PERMOFF_CC LC_SET_AP_PERM_OFF_CC | ||
| #define LC_ACTION_NOT_USED LC_APSTATE_NOT_USED |
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.
1fec42a to
fbb0dcc
Compare
604bb1d to
cce59de
Compare
06f1b3b to
3c2b663
Compare
7558be6 to
4d4b42d
Compare
4d4b42d to
27324be
Compare
27324be to
712a7ac
Compare
712a7ac to
b4a92c1
Compare
Checklist
Describe the contribution
#definemacros have been converted to enums.Testing performed
GitHub CI actions (incl. Build + Run, Unit Tests etc.) all passing successfully.
Expected behavior changes
No impact on behavior. Enums improve type-safety and ease debugging.
Contributor Info
Avi @thnkslprpt