Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
PINTO0309 authored May 2, 2018
1 parent f00696f commit 139f8a0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sdk/src/rplidar_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,11 @@ u_result RPlidarDriverSerialImpl::setMotorPWM(_u16 pwm)
{
u_result ans;
rplidar_payload_motor_pwm_t motor_pwm;

//protection:
if(pwm > MAX_MOTOR_PWM)
pwm = MAX_MOTOR_PWM;

motor_pwm.pwm_value = pwm;

{
Expand All @@ -995,10 +1000,10 @@ u_result RPlidarDriverSerialImpl::setMotorPWM(_u16 pwm)
return RESULT_OK;
}

u_result RPlidarDriverSerialImpl::startMotor()
u_result RPlidarDriverSerialImpl::startMotor(_u16 pwm)
{
if (_isSupportingMotorCtrl) { // RPLIDAR A2
setMotorPWM(DEFAULT_MOTOR_PWM);
setMotorPWM(pwm);
delay(500);
return RESULT_OK;
} else { // RPLIDAR A1
Expand Down

0 comments on commit 139f8a0

Please sign in to comment.