In the outer case statement, you set the shift register value to true. This stays true throughout and the output of your OR function is always true no matter what the result of the comparison of the slope is. So, once the comparison is true once, the true case is always executed. You need so logic in there to reset the shift register if the comparsion becomes false.