Unexplainable int behavior in encoder/LED project
Here:

CRGB leds[NUM_LEDS];


you are defining an array of NUM_LEDS objects of the CRGB type.
Valid indices for this array range from 0 to NUM_LEDS-1.

Here:

for (int i = 0; i &lt;= NUM_LEDS; i++) {
  leds[i].setRGB( r, g, b );
}


you are accessing the array elements at indices 0 to NUM_LEDS. The
last iteration is an out-of-bounds access, which is causing memory
corruption. You should instead write

for (int i = 0; i &lt; NUM_LEDS; i++) ...