diff --git a/Upstream/Inc/build_config.h b/Upstream/Inc/build_config.h index 08a24c2..7ffc957 100644 --- a/Upstream/Inc/build_config.h +++ b/Upstream/Inc/build_config.h @@ -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. //----------------------------------------------------------- diff --git a/Upstream/Src/upstream_hid_botdetect.c b/Upstream/Src/upstream_hid_botdetect.c index 2fe61a2..e71f7ec 100644 --- a/Upstream/Src/upstream_hid_botdetect.c +++ b/Upstream/Src/upstream_hid_botdetect.c @@ -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