Code correction / control mouse with encoder

Hello everybody, I have this code to simulate a gear head controlling PC mouse with electronique encoder. It's working not so bad, but I have some little problems. When the mouvement of encoders are to slow, the mouse don't move on the screen, I can't see any response.
Any ideo with the code to make it work great?
Thanks a lot

#include <Mouse.h>

float pulsesX, moveX,mouseX, lastPulsesX, XA_SIG=0, XB_SIG=1, pulsesY, moveY,mouseY, lastPulsesY, YA_SIG=0, YB_SIG=1;
int wheelsSpeed;
float panSpeed[4];
float tiltSpeed[4];
boolean buttonState, lastButtonState;

void setup(){
  attachInterrupt(1, XA_RISE, RISING); // Pin 2
  attachInterrupt(0, XB_RISE, RISING); // Pin 3
  attachInterrupt(2, YA_RISE, RISING); // Pin 0
  attachInterrupt(3, YB_RISE, RISING); // Pin 1
  pinMode (8, INPUT_PULLUP); // pushButton
  Mouse.begin();
  Serial.begin(115200);
  delay(20);
  Serial.println("Connected"); 

// Defining speed coeff to match Arrihead II
panSpeed[1] = 9.71;
panSpeed[2] = 5.1;
panSpeed[3] = 2.84;

tiltSpeed[1] = 12.45;
tiltSpeed[2] = 6.58;
tiltSpeed[3] = 3.38;

wheelsSpeed = 1; // Default speed when rebooting the arduino
}


void loop(){
 
buttonState=digitalRead(8); // Speed selection pushbutton

if ( buttonState != lastButtonState && buttonState == 0) {
  wheelsSpeed = wheelsSpeed +1;
  if (wheelsSpeed >= 4) {
    wheelsSpeed = 1;
  }
}

// Calculating wheels movement
moveX = lastPulsesX - pulsesX;
moveY = pulsesY - lastPulsesY;

// Mapping to the Arrihead speed
mouseX = moveX / panSpeed[wheelsSpeed];
mouseY = moveY / tiltSpeed[wheelsSpeed];

Mouse.move (mouseX, mouseY);


Serial.print("x");
Serial.print(wheelsSpeed);
Serial.print("y");
Serial.print(pulsesY);
Serial.println("end");

lastPulsesX = pulsesX; // Storing last value for X movement
lastPulsesY = pulsesY; // Storing last value for Y movement
lastButtonState = buttonState;

delay(10);

}


//X-Axis

void XA_RISE(){
 detachInterrupt(1);
 //delay(1);
 XA_SIG=1;
 
 if(XB_SIG==0)
 pulsesX++;//moving forward
 if(XB_SIG==1)
 pulsesX--;//moving reverse

 attachInterrupt(1, XA_FALL, FALLING);
}

void XA_FALL(){
  detachInterrupt(1);
  //delay(1);
 XA_SIG=0;
 
 if(XB_SIG==1)
 pulsesX++;//moving forward
 if(XB_SIG==0)
 pulsesX--;//moving reverse

 attachInterrupt(1, XA_RISE, RISING);  
}

void XB_RISE(){
 detachInterrupt(0);
 //delay(1);
 XB_SIG=1;
 
 if(XA_SIG==1)
 pulsesX++;//moving forward
 if(XA_SIG==0)
 pulsesX--;//moving reverse

 attachInterrupt(0, XB_FALL, FALLING);
}

void XB_FALL(){
 detachInterrupt(0);
 //delay(1);
 XB_SIG=0;
 
 if(XA_SIG==0)
 pulsesX++;//moving forward
 if(XA_SIG==1)
 pulsesX--;//moving reverse

 attachInterrupt(0, XB_RISE, RISING);
}

//Y-Axis

void YA_RISE(){
 detachInterrupt(2);
 //delay(1);
 YA_SIG=1;
 
 if(YB_SIG==0)
 pulsesY++;//moving forward
 if(YB_SIG==1)
 pulsesY--;//moving reverse


 attachInterrupt(2, YA_FALL, FALLING);
}

void YA_FALL(){
  detachInterrupt(2);
  //delay(1);
 YA_SIG=0;
 
 if(YB_SIG==1)
 pulsesY++;//moving forward
 if(YB_SIG==0)
 pulsesY--;//moving reverse

 attachInterrupt(2, YA_RISE, RISING);  
}

void YB_RISE(){
 detachInterrupt(3);
 //delay(1);
 YB_SIG=1;
 
 if(YA_SIG==1)
 pulsesY++;//moving forward
 if(YA_SIG==0)
 pulsesY--;//moving reverse

 attachInterrupt(3, YB_FALL, FALLING);
}

void YB_FALL(){
 detachInterrupt(3);
 //delay(1);
 YB_SIG=0;
 
 if(YA_SIG==0)
 pulsesY++;//moving forward
 if(YA_SIG==1)
 pulsesY--;//moving reverse

 attachInterrupt(3, YB_RISE, RISING);
}

Never use a float as a flag variable! A float is not guaranteed to keep an integer value exactly as you assigned it. So you should almost never use the == operator on floats.

The missing movement on screen is easily explained: Mouse.move expects integer values so any value below 1 is no movement. So if your encoder produces less pulses in 10ms than the panSpeed[] or tiltSpeed[] values you won't see any mouse movement.

Ok thanks, so concretely, what I have to change or delete or replace in code?
Have I to delete the whole line?

Thks again

No. Do you understand your code? You should change the types of XA_SIG, XB_SIG, YA_SIG and YB_SIG to bool or at least byte.
The rest of the variables on this line should be changed to integer types, maybe int32_t, better int16_t (for speed) but that depends on the actual hardware used, which I have no clue of.

But that doesn't solve your problem. To fix that you have to keep the fractional part of the movement for the next loop run.
So given you did above changes, you can add after the Mouse.move() line:

pulsesX += moveX - panSpeed[wheelsSpeed] * mouseX;
pulsesY += moveY - titleSpeed[wheelsSpeed] * mouseY;

That works because the compiler automatically removes the fractional part from the float if you assign it to an integer variable.

Ok thanks. I don't understand the code and try to learn for only 10 days... I used a leonardo board and small encoder Encodeur rotatif incrémental SEN0230

Sorry but I don't understand this part.

This project isn't ideal to learn the basics of programming. It might be a good idea to start with a tutorial to get familiar with the programming language and the Arduino environment.

You will as soon as you learned the basics of C++. If you don't understand the variable declaration or what variable types are for you cannot adapt the code yourself. This is not a free programming service or a programming academy. There are tons of tutorials on the Net but it's on you to invest the time to learn how the Arduino is programmed. We expect at least basic programming knowledge if we're presented with projects in this complexity.