Hi everybody!
I'm trying to program an Arduino Leonardo to automate grinding a silly Android game (not for getting onto a leaderboard, don't worry).
The Leonardo is acting as a HID Mouse. So the word "pointer" will signify the Mouse-Pointer-arrow-thingy, and not a C++ *pointer.
My goal is being able to point the cursor to multiple places on the screen and having the Leonardo repeatedly double click in all those places.
The problem I'm facing is Mouse accelereation. Because of Mouse Acceleration, it is very difficult to do precise, repeatable movements between points on the screen.
One possible solution I can think of would be to get from point to point in one single HID-Instruction (I don't know how this is really called), so that the Mouse driver only sees one input and doesn't trigger Acceleration. The problem is that as it is, you can only move a maximum of 127 units per instruction. I thought it may be possible to expand that.
According to the HID-Specification, the values for Logical_Minimum and Logical_Maximum can be freely chosen, as long as they fit in the given Report_Size.
I tried changing the corresponding lines in Mouse.cpp to
0x16, 0x00, 0x80, // LOGICAL_MINIMUM (-32768)
0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767)
0x75, 0x16, // REPORT_SIZE (16)
and the definition of
void Mouse_::move(signed char x, signed char y, signed char wheel)
to
void Mouse_::move(int16_t x, int16_t y, signed char wheel)
in both Mouse.cpp and Mouse.h
and while changing the minima and maxima had no effect whatsoever, changing the report_size to 16bit broke the functionality entirely, eg. no pointer movement at all. Bummer. But I feel this should theoretically be possible, no?
Now my question:
Is it possible to do larger pointer "leaps" than +/- 127 units? Or is there a better way to do what I need?
Any help is greatly appreciated! this whole HID-thing is new to me, and I'm finding it very interesting, but also incredibly overwhelming.
Best,
Bin