Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

prathams417
Copy link

No description provided.

Copy link
Member

@cindyli-13 cindyli-13 left a 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
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (degrees >= m_servoRangeInDegrees && degrees >= 0)
if (degrees <= m_servoRangeInDegrees && degrees >= 0)

@cindyli-13
Copy link
Member

Make sure to also follow the "Clang-Format" section of the readme and format your files

Copy link
Member

@cindyli-13 cindyli-13 left a 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));
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants