I had the same code p0171 and the auto trans was shifting bad,jumping in to gear when downshifting and I found the problem was a loose band clamp on the intake between the air filter and intake right on top and easy to get to. It works fine now. Wow that could have cost a lot if I went to a transmission shop !!!
Change the oil- fill the tires - and drive it till it breaks-thats my idea cuz if you take it in for work you will pay more than the car is worth over the years.