Please don't forget // to use code tags - the # button when composing.
The code looks OK at a first glance - compare result of digitalRead to LOW and HIGH, not to 0 and 1, since that is more readable and future-proof.
So your quadrature encoder has its own pull-ups does it? If not add this to the setup()
digitalWrite (CHA, HIGH) ; // turn on internal pull-ups
digitalWrite (CHB, HIGH) ;