The Mouse.move() function does not transition from + direction to - direction

So I am trying to program a micro arduino to simulate a HID usb mouse and keyboard and the mouse aspect isn't working according to plan. I can move the mouse cursor up and down and from side to side, however, when I transition from moving in +x direction to -x direction, the cursor moves maybe a handful of pixels and then when i send the same command again, it works fine.. almost like it needs a warmup and stretch out or something haha.

Sample commands:

  1. mouse x 100> (the mouse moves 100 pixels to the right (+x direction));
  2. mouse y 100> (mouse moves 100 pixels downward (-y direction));
  3. mouse x -100> (mouse should move 100 pixels to the left but instead moves maybe 3 to 5 pixels to the left instead of 100);
  4. mouse x -100> (now the mouse moves the full 100 pixels to the left)
  5. mouse y -100> (mouse moves 100 pixels upward);

And the same thing happens if i decide to transition from +y direction to -y direction.

I have attached my code. Thanks for any/all help!

USB_Keyboard_Emulator.ino (4.57 KB)

  Serial.flush();                 //clears out the buffer

Which buffer? It is USELESS to flush the outgoing buffer of the Serial instance when you are not using the Serial instance.

  String function = arg[1];
  function.reserve(4);

Do you have a clue what reserve() does? It does not appear that you do.

What is your serial output tell you is happening? What is the serial data coming from/going to, and how do you see it?