-
Notifications
You must be signed in to change notification settings - Fork 113
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
Allow IsPowered to return negative power percentages. #3703
Conversation
It's way worse now, but I don't have the bandwidth for a full factor of this code - and there will need to be some consideration for when we set the pins versus the locks. |
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.
LGTM
@@ -214,7 +219,6 @@ func (m *Motor) setPWM(ctx context.Context, powerPct float64, extra map[string]i | |||
} | |||
|
|||
powerPct = math.Max(math.Abs(powerPct), m.minPowerPct) |
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.
[nit] I don't think we need this line anymore, since we moved the min logic to the top
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.
no but I'm not going to touch more in this pr. It will be merged in messy.
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.
Edit - no I'm msitaken. This is now the only thing making the pwmPinPower positive. otherwise the pin will crash when you set it to negative.
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.
lgtm assuming hardware tests pass
I am pretty sure this was not written expecting that PowerPct would always return positive. Just an oversight on taking the absolute value of the power percentage.
Still need to fix tests, but it should be returning negative percentages even when on now.
Please