-
Notifications
You must be signed in to change notification settings - Fork 1
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
Increase readability of ctrl.c #214
base: dev
Are you sure you want to change the base?
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.
Really good changes, my only additional request is a more descriptive PR name.
pulse_cnt[ENCODER_N] += ((CHANNEL == ENCODER_CHANNEL_A) \ | ||
^ (chan_a ^ chan_b)) \ | ||
? 1 \ | ||
: -1; \ |
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.
Let's disable clang formatting for the macro definitions so that we don't have strange formatting like this.
components/ctrl/src/ctrl.c
Outdated
const uint16_t cur_pulse_cnt[ENCODER_COUNT] | ||
= {pulse_cnt[ENCODER_LEFT], pulse_cnt[ENCODER_RIGHT]}; |
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.
Let's use [INDEX] = value
formatting for this array.
added encoder enum, ternary operators, macros (Jacob)