Performance optimization: Repaint leds only if needed.