diff options
| author | a1xd <[email protected]> | 2021-04-01 18:33:00 -0400 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-04-01 18:33:00 -0400 |
| commit | e9866f27d78d9909fd4639cbd14a54b8ad5c2ec1 (patch) | |
| tree | 1254f1db0dfd39d76c20a1907380ecbb60f86ab4 /driver | |
| parent | add flag to negate device match (diff) | |
| download | rawaccel-e9866f27d78d9909fd4639cbd14a54b8ad5c2ec1.tar.xz rawaccel-e9866f27d78d9909fd4639cbd14a54b8ad5c2ec1.zip | |
driver - apply accel disregarding num packets
add setting for max time threshold
Diffstat (limited to 'driver')
| -rw-r--r-- | driver/driver.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/driver/driver.cpp b/driver/driver.cpp index ec340ea..a7fe3b6 100644 --- a/driver/driver.cpp +++ b/driver/driver.cpp @@ -60,9 +60,18 @@ Arguments: bool(wcsncmp(devExt->dev_id, global.args.device_id, ra::MAX_DEV_ID_LEN)); if (any && rel_move && dev_match) { - // if IO is backed up to the point where we get more than 1 packet here - // then applying accel is pointless as we can't get an accurate timing - bool enable_accel = num_packets == 1; + milliseconds time; + + if (global.args.time_min == global.args.time_max) { + time = global.args.time_min; + } + else { + counter_t now = KeQueryPerformanceCounter(NULL).QuadPart; + counter_t ticks = now - devExt->counter; + devExt->counter = now; + milliseconds t = ticks * global.tick_interval / num_packets; + time = ra::clampsd(t, global.args.time_min, global.args.time_max); + } auto it = InputDataStart; do { @@ -72,22 +81,7 @@ Arguments: static_cast<double>(it->LastY) }; - global.modifier.apply_rotation(input); - global.modifier.apply_angle_snap(input); - - if (enable_accel) { - auto time_supplier = [=] { - counter_t now = KeQueryPerformanceCounter(NULL).QuadPart; - counter_t ticks = now - devExt->counter; - devExt->counter = now; - milliseconds time = ticks * global.tick_interval; - return ra::clampsd(time, global.args.time_min, 100); - }; - - global.modifier.apply_acceleration(input, time_supplier); - } - - global.modifier.apply_sensitivity(input); + global.modifier.modify(input, time); double carried_result_x = input.x + devExt->carry.x; double carried_result_y = input.y + devExt->carry.y; |