Problem with Mouse!

Hey, iv connected a Mouse and wrote a program that draws on my LCD.

Everything works fine, the only problem is that the mouse moves easy in -x and -y directions but i need to move the Mouse fast and much more far to move the cursor in +x and +y positions.

Does anyone have an idea what the problem could be?

Here is a part of the Code:

        void usbHost_MouseConnected(UsbHost sender, GHI.Premium.USBHost.USBH_Mouse mouse)
//          Debug.Print("Maus verbunden");
//          Debug.Print("ID: " + mouse.ID + ", Interface: " +
//                                mouse.INTERFACE_INDEX + ", Type: " + mouse.TYPE);

            mouse.MouseDown += new USBH_MouseEventHandler(mouse_MouseDown);
            mouse.MouseUp += new USBH_MouseEventHandler(mouse_MouseUp);
            mouse.MouseWheel += new USBH_MouseEventHandler(mouse_MouseWheel);
            mouse.MouseMove += new USBH_MouseEventHandler(mouse_MouseMove);

            mouse.SetCursor(xmax / 2, ymax / 2);
            mouse.SetCursorBounds(0, xmax, 0, ymax);

            this.mouse = mouse; 

        void mouse_MouseMove(USBH_Mouse sender, USBH_MouseEventArgs args)
//          Debug.Print(mouse.Cursor.X.ToString() + ", " + mouse.Cursor.Y.ToString());
            display.SimpleGraphics.SetPixel(Colors.Red, (uint)mouse.Cursor.X, (uint)mouse.Cursor.Y);

Sorry i’m new here didn’t know i have to do that,
but do you have an idea what the problem could be?

Okey, i did that but it doesn’t change anything,
the cursor moves with normal mouse movements in - Positions (left and up) but i need a fast mouse movement to move it in + positions (right and down)

I tried a different mouse aswell, but its still the same problem :frowning:

Slow Movements to the right and down are not doing anything… i need to move the mouse fast.

Sounds like a bug to me. But you can work around it ( I think).
Try adjusting the Cursor yourself based on the information in DeltaPosition of the USBH_MouseEventArgs inside your move handler.

I think mice have different resolutions. Some are more accurate but the change is little. In windows you can set the speed but not in NETMF.

Is there a way to read the raw mouse values? If so then you can use that and multiply it with whatever speed you want.

@ andre.m: I’m using the Spider Starter Kit

@ Architect:
if i use them like this:

display.SimpleGraphics.SetPixel(Colors.Red, (uint)args.DeltaPosition.X, (uint)args.DeltaPosition.Y);

the Cursor moves back instantly to the upper left Corner as soon as any movement is detected.

        void mouse_MouseMove(USBH_Mouse sender, USBH_MouseEventArgs args)
            int newx = mouse.Cursor.X + args.DeltaPosition.X;
            int newy = mouse.Cursor.Y + args.DeltaPosition.Y;

            display.SimpleGraphics.SetPixel(Colors.Red, (uint)newx, (uint)newy);

this works fine, but still with the same problem.

What if you do int newx = mouse.Cursor.X + args.DeltaPosition.X * 4;

@ Gus: That just moves it quicker, but just in -x direktions,
the problem is that i need to move the mouse fast in +x/y directions so a move is detected at all.

@ andre.m: RLP, i think that’s a bit to hard for me at this time, and changing a driver… :D,
just got my spider yesterday, and i’m complete new to this.

Did you add *4 to your second line, to the y? You need this on both sides. This will move it 4 times faster

This from the documentation:

Each connected Mouse holds information about the current pressed buttons and the current position.

The position can be obtained as a Delta Position (Relative) in an event or as a Cursor associated with it (Absolute). The default Delta Position changes from -512 to +512. This can be changed by calling Scale().
For Cursor position, by default, is from 0 to 512 for X and Y. This can be changed as well. Changing the scale for certain cursor bounds will have the affect of changing cursor speed.

Dela position of the mouse or the state of the buttons are sent as events to the user.

For this device, there is an internal thread that maintains the device events. The thread priority is set to the highest settings but the user is able to change this thread priority to optimize the program performance. [/quote]

I wonder if by changing the bounds you have affected the speed since the scale is not changed.

Edit: Try not changing the bounds and see if speed issue is still there

@ Gus: yes i did on both lines, still doesn’t help.
it seems to me that the mouse move event it not called when i don’t move the mouse quickly to right or down.
It is however, no matter how slow i move the mouse to the left or up.

@ Architect: even when i don’t set the bounds, its still the same issue.

Here is the Problem shown in a short video.

Looks like the USB drivers is not polling the mouse fast enough. We will look into this but to be honest this is a low priority items when compared to other tasks we have now.

@ Gus: of course, i understand its not on the top of the to do list :wink:

its just strange that it works perfect in the - directions and doesn’t in the +…

Thanks anyway for your support guys.