Revision 753ccd04 components/MotorControl.cpp
| components/MotorControl.cpp | ||
|---|---|---|
| 534 | 534 |
} |
| 535 | 535 |
|
| 536 | 536 |
for (int idxPWM = 0; idxPWM < 2; idxPWM++) |
| 537 |
pwmEnableChannel(this->pwmDriver, (idxWheel * 2) + idxPWM, widths[idxPWM]);
|
|
| 537 |
pwmEnableChannel(this->pwmDriver, (idxWheel * 2) + idxPWM, motorEnable ? widths[idxPWM] : 0);
|
|
| 538 | 538 |
} |
| 539 | 539 |
} |
| 540 |
|
|
| 541 |
|
|
| 542 |
void MotorControl::setGains(motorGains *motorConfig){
|
|
| 543 |
chSysLock(); |
|
| 544 |
this->pGain = motorConfig->pGain; |
|
| 545 |
this->iGain = motorConfig->iGain; |
|
| 546 |
this->dGain = motorConfig->dGain; |
|
| 547 |
chSysUnlock(); |
|
| 548 |
} |
|
| 549 |
|
|
| 550 |
void MotorControl::getGains(motorGains *motorConfig){
|
|
| 551 |
motorGains gains; |
|
| 552 |
motorConfig->pGain = this->pGain; |
|
| 553 |
motorConfig->iGain = this->iGain; |
|
| 554 |
motorConfig->dGain = this->dGain; |
|
| 555 |
} |
|
| 556 |
|
|
| 557 |
void MotorControl::setMotorEnable(bool enable){
|
|
| 558 |
this->motorEnable = enable; |
|
| 559 |
} |
|
| 560 |
|
|
| 561 |
bool MotorControl::getMotorEnable(){
|
|
| 562 |
return this->motorEnable; |
|
| 563 |
} |
|
| 564 |
|
|
| 565 |
void MotorControl::toggleMotorEnable(){
|
|
| 566 |
this->motorEnable = !this->motorEnable; |
|
| 567 |
} |
|
Also available in: Unified diff