feat: asymetric throttle

This commit is contained in:
Cyrille Nofficial committed 2022-06-13 18:35:27 +02:00
1 parent ed1f210a83
commit 973ebb9df9
2 files changed
+16 -3

No files matched your search

+10 -1
View File
@@ -170,7 +170,16 @@ func (a *Part) processChannel2(v string) {
} else if value > a.pwmThrottleConfig.Max {
value = a.pwmThrottleConfig.Max
}
a.throttle = ((float32(value)-MinPwmThrottle)/(MaxPwmThrottle-MinPwmThrottle))*2.0 - 1.0
throttle := 0.
if value > a.pwmThrottleConfig.Zero {
throttle = (float64(value) - float64(a.pwmThrottleConfig.Zero)) / float64(a.pwmThrottleConfig.Max-a.pwmThrottleConfig.Zero)
}
if value < a.pwmThrottleConfig.Zero {
throttle = -1. * (float64(a.pwmThrottleConfig.Zero) - float64(value)) / (float64(a.pwmThrottleConfig.Zero - a.pwmThrottleConfig.Min))
}
a.throttle = float32(throttle)
}
func (a *Part) processChannel3(v string) {