Changed setThresholds to take ref parameter so we can set ref=0 before autoCalibrate