Lauffähig und aufgeräumt
This commit is contained in:
@@ -94,14 +94,14 @@ void MotorControl::runMotorControl() {
|
||||
void MotorControl::setMinPwm(uint8_t min) {
|
||||
if (min > 80) min = 80;
|
||||
//transform percentage to real pwm value
|
||||
min = (uint8_t) (((1 >> pwm_res) - 1) * (min / 100));
|
||||
min = (uint8_t) (((1 << pwm_res) - 1) * (min / 100.0));
|
||||
this->dutycycle_min = min;
|
||||
}
|
||||
|
||||
void MotorControl::setMaxPwm(uint8_t max) {
|
||||
if (max > 100) max = 100;
|
||||
//transform percentage to real pwm value
|
||||
max = (uint8_t) (((1 >> pwm_res) - 1) * (max / 100));
|
||||
max = (uint8_t) (((1 << pwm_res) - 1) * (max / 100.0));
|
||||
this->dutycycle_max = max;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ void MotorControl::setRealPower(int8_t power) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (power == 0) {
|
||||
if (this->power == 0) {
|
||||
this->direction = 0;
|
||||
digitalWrite(this->dir_1, LOW);
|
||||
digitalWrite(this->dir_2, LOW);
|
||||
|
||||
Reference in New Issue
Block a user