Lauffähig und aufgeräumt

This commit is contained in:
2021-12-16 17:09:19 +01:00
parent cd29191bb4
commit 29a636060c
8 changed files with 79 additions and 49 deletions
+3 -3
View File
@@ -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);