Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[RSDK-2226] audit GPIO servo code #2283
[RSDK-2226] audit GPIO servo code #2283
Changes from 26 commits
a202740
728c791
75f5537
06aec2f
fdebaf0
c5c0785
ad52574
0fc4520
ac2b683
29edfe0
f37119f
678ce5d
c8d10fe
40dfbd5
9f3da1e
fb10e97
233d3b4
16bc42b
3302de7
463019f
6549786
f6b2aa9
8207659
0240a7b
f477809
61bd967
8b65489
5fb5c9b
d5a9c65
0a48adb
040ad5b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
cool :) does the calculated frequency gets floored in this case? also why do minUs+maxUs if at most we should turn on the PWM for maxUs?
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.
If I set the GPIO pin to high (duty cycle is 100%), it cuts power to the motor entirely. I infer that the servo needs some amount of time with the PWM signal low, so it can be confident it knows how long it was high. What's the minimum time it can be low? I dunno; probably the same as the minimum it can be high, so the period should be at least minUs+maxUs. but I just made all that up, because I don't actually know how servos work.
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.
The amount of time the signal needs to spend low is the "dead band width," and the motors I've seen so far have it in the 1-10 microsecond range. My defaulting to 500 microseconds is super overkill. I'll change this to go faster.
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.
make sense i'll defer to you to select the best value but would suggest 100us to be on the safe side :P
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.
100 seems exceptionally slow, but I bumped it up to 50. You're right that 10 was probably too fast for a global maximum.