Why should I call detachInterrupt at the start of an interrupt service routine?

Why should I call detachInterrupt at the start of an interrupt service routine?

To understand the explanation below, please consider this example sketch. This sketch is used to debounce a rotary encoder: (Original is sourced from the Arduino Step by Step Your Complete Guide Github repository) //Original sketch: https://bigdanzblog.wordpress.com/2014/08/16/using-a-ky040-rotary-encoder-with-arduino/ //Modified by Peter Dalmaris, July 2015 const int PinCLK=2; // Used for generating interrupts using CLK signal const int […]