help please with FSX

i am using Quadrature library with 6 rotary encoder and another 5 with mcp23017 via i2c bus to send some command to change the value of some control in FSX. In serial monitor everything work just fine but when connected to FSX programe and when i turn rotary encoder that is connected to mcp23017 for 1 or 2 time then everything freeze and my mega become unresponsive any idea what happen or am i using too much encoder for a single board

PS when my sketch have only 2 encoder on mcp23017 everything work fine so total right now i can use 8 encoder in total but i need 3 more any suggestion

rotary_for_fsx.ino (8.76 KB)