Skip to content

Commit

Permalink
Reverse motor direction
Browse files Browse the repository at this point in the history
  • Loading branch information
bjsowa committed Aug 9, 2022
1 parent ff2804e commit 28b9f5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/motor_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ inline float clamp(const float value, const float limit) {
void MotorController::init() {
motor_ = mot_driver[config_.driver_num].getDCMotor(config_.motor_num);
motor_->init(PWM_21kHz);
motor_->setPolarity(!config_.reverse_polarity);
motor_->setPolarity(config_.reverse_polarity);
motor_->setDriveMode(true);
mot_driver[config_.driver_num].enable();
encoder_ = &encoder[config_.driver_num * 2 + config_.motor_num];
encoder_->setPolarity(config_.reverse_polarity);
encoder_->setPolarity(!config_.reverse_polarity);
encoder_->init();
}

Expand Down

0 comments on commit 28b9f5c

Please sign in to comment.