It was you well commented code that allowed the mistake to be found.
Keep up the good work!

And be sure to read the section of the data sheet I pointed to to see why the analog settings did not cause the problem... This time