Interrupt issue

Sorry, you are correct and I did not fully examine your code.
You are expecting 16 teeth plus one missing tooth on a gear. Is it a 17 tooth gear?
Paul