-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
#536 ability to enable high-level commands after low-level commands #560
Conversation
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.
Hi and thanks for the pull request!
It looks good to me , but I have two small comments.
- There are a bit too many DEBUG_PRINT for my taste. DEBUG_PRINT always outputs a message on the console log and I think we should keep logging during "normal" operation to a minimum, and only notify the user of exceptional events. One option is to define your local log macro, something like https://github.com/bitcraze/crazyflie-firmware/blob/master/src/deck/core/deck_info.c#L39-L43
- I prefer named constants in the decoding of the packet, to make it easier to understand what the purpose of the channel is. (I will try to add review comments for this in the code, I have not used this feature before in github :-))
br
Kristoffer
src/modules/src/crtp_commander.c
Outdated
switch (pk->channel) { | ||
case 0: | ||
crtpCommanderGenericDecodeSetpoint(&setpoint, pk); | ||
commanderSetSetpoint(&setpoint, COMMANDER_PRIORITY_CRTP); | ||
break; | ||
case 1: { | ||
uint8_t metaCmd = pk->data[0]; | ||
if (metaCmd < nMetaCommands && (metaCommandDecoders[metaCmd] != NULL)) { | ||
metaCommandDecoders[metaCmd](pk->data + 1, pk->size - 1); | ||
} | ||
} | ||
break; | ||
} |
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.
Named constants makes it easier to understand what the cases are handling. Maybe something like
switch (pk->channel) {
case SET_SETPOINT_CHANNEL:
// ...
break;
case META_COMMAND_CHANNEL:
// ...
break;
default:
// Do nothing
break;
}
and a default for completeness.
@krichardsson Thank you for the review! I added the channel Following the style of |
Merged. Thanks! |
So that changes on param update will be reflected. Fixes: bitcraze#560
Extensive discussion of the code design is in #536. This code is tested on real hardware. Confirmed that we can:
velocity_world
andfull_state
)I was not able to test manual override because I was not sure how. However, based on the design I am confident it will work.