Quad encoder acting funny

So I have a quad encoder on my bot and I’ve had it for a while and it’s been working fine. I’ve used the same code with some revisions without touching anything that has to do with sensor values. My quad encoder for some odd reason just started spitting out one of three variables: -2, -1, and 0. I recently changed the cortex but I tested all of the sensor and motor ports and they work just fine. Any help or suggestions would be greatly appreciated. Thank you!

These symptoms could be caused by dust getting inside and covering the optical grating. You can open it up and carefully wipe any dust from it. A loose or broken wire can also cause it to return invalid counts.

This is caused by one of the wires not having a proper connection. Could be unplugged, snipped or set to the wrong encoder port.