fix number boolean comparison in PIDs

This commit is contained in:
2026-06-29 23:37:14 -05:00
parent 46c04bf646
commit b8b22f29b1

View File

@@ -861,8 +861,8 @@ function CreatePID(kp, ki, kd)
kd = kd,
integral = 0, lastError = 0,
minOutput = 0,
maxOutput = 256,
minOutput = 0.0,
maxOutput = 256.0,
update = function(self, setpoint, pv, dt)
local error = setpoint - pv
@@ -878,7 +878,7 @@ function CreatePID(kp, ki, kd)
local clampedOutput = 0
if self.minOutput <= potential_i <= self.maxOutput then
if self.minOutput <= potential_i and potential_i <= self.maxOutput then
self.integral = potential_i
clampedOutput = raw_output
else