Added check when switching directions.

Only switch direction if past max/min range AND direction going away
from normal range.