very possible it is a encoder problem, but there is one other thing that happens with these trucks. over on the passenger side, behind the right kick panel is the control module for the transfer case. remove the kick panel and unplug the connectors for the transfer case module. look inside of the connectors and see if there is a powerdly green colored substance on the connector terminals. sometimes the connectors draw moisture and cause a bad connection at the module. here is a picture
My apology if I was not clear. I have open this question back for another expert to try to help.
Thanks for using JA!!!