Set max value for translate

This commit is contained in:
2023-03-09 12:43:37 +02:00
parent 77ecb063d5
commit e1ba43e324

View File

@@ -78,8 +78,13 @@ class AxidrawController : public RobotController
{
float lspan = lmax - lmin;
float rspan = rmax - rmin;
val = (val - lmin) / lspan;
return rmin + (val * rspan);
float out = (val - lmin) / lspan;
out = rmin + (val * rspan);
// Ensure that output is within bounds
out = std::max(rmin, out);
out = std::min(rmax, out);
return out;
}
/**