Reset mouse velocity history on each movement

USG_1.0
Robert Fisk 7 years ago
parent 3d91aa2115
commit d6f66e67bd

@ -44,7 +44,7 @@
//-----------------------------------------------------------
//Adjust these thresholds first to tune mouse bot detection. Lower values = more sensitive
#define MOUSE_BOTDETECT_JUMP_VELOCITY_THRESHOLD 20 //Varies by mouse. Most short jumps are <= 10 velocity
#define MOUSE_BOTDETECT_LOCKOUT_CONSTANT_ACCEL_LIMIT 30 //10 is ok for most mice. But some mice (or users!) generate longer sequences.
#define MOUSE_BOTDETECT_LOCKOUT_CONSTANT_ACCEL_LIMIT 20 //10 is ok for most mice. But some mice (or users!) generate longer sequences.
#define MOUSE_BOTDETECT_LOCKOUT_CONSTANT_ACCEL_CREDIT 40 //Non-constant-acceleration movements can build a credit that will be used before hitting the ACCEL_COUNT limit above. Handy for mice or users that exhibit constant velocity characteristics mid-movement.
//-----------------------------------------------------------

@ -407,7 +407,11 @@ void Upstream_HID_BotDetectMouse(uint8_t* mouseInData)
//Did the mouse stop moving?
if ((now - LastMouseMoveTime) > ((MOUSE_BOTDETECT_MOVEMENT_STOP_PERIODS * HID_FS_BINTERVAL) - (HID_FS_BINTERVAL / 2)))
{
//Constant acceleration detection
//Reset constant acceleration detection state
for (i = 0; i < MOUSE_BOTDETECT_VELOCITY_HISTORY_SIZE; i++)
{
MouseVelocityHistory[i] = 0;
}
ConstantAccelerationCounter = 0;
//Jump detection

Loading…
Cancel
Save