private double calculateDeviationFromSetPoint(double laserSetPoint,
double[] masterFitCoefficients, double[] slaveFitCoefficients)
{
double currentPeakSeparation = new double();
if (slaveFitCoefficients[1] > LOWER_CC_VOLTAGE_LIMIT
&& slaveFitCoefficients[1] < UPPER_CC_VOLTAGE_LIMIT) //Only change limits if fits are reasonable.
{
currentPeakSeparation = slaveFitCoefficients[1] - masterFitCoefficients[1];
}
else
{
currentPeakSeparation = LaserSetPoint;
}
return currentPeakSeparation - LaserSetPoint;
}