Shop OBEX P1 Docs P2 Docs Learn Events
Help with mouse driver problem. — Parallax Forums

Help with mouse driver problem.

mynet43mynet43 Posts: 644
edited 2012-10-14 07:31 in Propeller 1
I've been using the mouse driver from the OBEX, mouse.spin. It has what looks like a minor bug, that is causing me problems.

Here is the case I'm working with:
x0=y0=3680
xmax=ymax=106320
mouse_x=55707
mouse_y=49898

I initialize it by the following two lines of code:
mouse.bound_limits(x0, y0, 0, xmax, ymax, 0)
mouse.bound_scales(32, 32, 0)

As a test case, I set the mouse position using:
mouse.bound_preset(mouse_x, mouse_y)
with the values above.

I then retrieve the mouse position using:
mx := mouse.bound_x
my := mouse.bound_y

The problem is, that the values I get back do not always match exactly what are put in.

For instance, in this case, for X, I put in 55707. I get back mx = 55706.

For my purposes I need the exact value returned, since I'm using it to drive an XY table on an electron microscope and it makes a big difference. When this happens, I interpret it as a mouse movement, and move the table when I shouldn't :(

Does someone understand the mouse.spin code well enough to provide me with a correction to make this deterministic? I suspect it's just a rounding problem.

Thank you for your help and support.

Jim
Sign In or Register to comment.