-
Notifications
You must be signed in to change notification settings - Fork 57
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
Pratham Sood Firmware Training Oct 2021 #399
base: master
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.
Your training mostly looks good! Just some minor fixes needed
|
||
add_library (TutorialServo STATIC) | ||
target_sources (TutorialServo PRIVATE src/TutorialServo.cpp) | ||
target_link_libraries (tutorial-servo-can-control PRIVATE |
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.
You shouldn't need this line since it's repeated in line 12
} | ||
|
||
void TutorialServo::setPositionInDegrees( const float degrees){ | ||
if (degrees >= m_servoRangeInDegrees && degrees >= 0) |
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 (degrees >= m_servoRangeInDegrees && degrees >= 0) | |
if (degrees <= m_servoRangeInDegrees && degrees >= 0) |
Make sure to also follow the "Clang-Format" section of the readme and format your files |
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.
There's just one small issue, but everything else looks good. Were you able apply clang format?
void TutorialServo::setPositionInDegrees( const float degrees){ | ||
if (degrees <= m_servoRangeInDegrees && degrees >= 0) | ||
{ | ||
m_servoPwmOut.pulsewidth((degrees/m_servoRangeInDegrees)*(m_maxPulsewidthInMs-m_minPulsewidthInMs)); |
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.
what if m_minPulsewidthInMs
is nonzero? you'll need the constant offset so that 0 degrees maps to m_minPulsewidthInMs
No description provided.