mirror of
https://github.com/okalachev/flix.git
synced 2026-01-11 13:36:43 +00:00
Fix getDutyCycle return type to make it possible to increase resolution
This commit is contained in:
@@ -27,7 +27,7 @@ void setupMotors() {
|
|||||||
Serial.println("Motors initialized");
|
Serial.println("Motors initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t getDutyCycle(float value) {
|
int getDutyCycle(float value) {
|
||||||
value = constrain(value, 0, 1);
|
value = constrain(value, 0, 1);
|
||||||
float pwm = mapff(value, 0, 1, PWM_MIN, PWM_MAX);
|
float pwm = mapff(value, 0, 1, PWM_MIN, PWM_MAX);
|
||||||
float duty = mapff(pwm, 0, 1000000 / PWM_FREQUENCY, 0, (1 << PWM_RESOLUTION) - 1);
|
float duty = mapff(pwm, 0, 1000000 / PWM_FREQUENCY, 0, (1 << PWM_RESOLUTION) - 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user