Quote:
Originally Posted by virtuald
I agree, that's a bug there. Different from what Oblarg was saying (unless they meant setSetpoint instead of enable).
The documentation should also probably specify what each of these functions should and should not do (is enable intended to clear the error? should setsetpoint always force onTarget to be false).
|
He misspoke - he meant setSetpoint and has corrected his original post.
setSetpoint doesn't have to force onTarget to be false because it clears the buffer - which makes isAvgErrorValid() false, which forces onTarget() to be false.
However, I'd be interested in seeing isAvgErrorValid() being changed a bit to not return true until your buffer is full. I've had issues with OnTarget being true because of one value in the buffer when it first started up, even though I asked for a 20 reading average.
I'd like to propose changing this:
Code:
private synchronized boolean isAvgErrorValid() {
return m_buf.size() != 0;
}
to this
Code:
private synchronized boolean isAvgErrorValid() {
return m_buf.size() == m_bufLength;
}