Seems in ocrrect, should be estVal = Math.MAX(estval, this.setup.minval)  and the next one Math.MIN(...)

.. if the idea is to guaranteed that estVale is newver smaller than minVal and never larger than maxval. Now it returns always maxval.