From 16dc4df3d438142ae378c9c6983585d06e0c6a33 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Mon, 29 Mar 2021 17:14:49 -0400 Subject: refactor common/settings only driver compiles remove accel-base types merge linear + classic move gain cap logic into classic impl, cap is now set in terms of output use cap/limit to determine negation remove weight, add replacement for power mode only remove legacy offset option remove naturalgain mode add legacy mode flag naturalgain -> natural natural -> natural + legacy flag add dpi setting and more accel args + defaults (prep for ips mode) replace output speed cap with input cap --- common/rawaccel-settings.h | 50 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) (limited to 'common/rawaccel-settings.h') diff --git a/common/rawaccel-settings.h b/common/rawaccel-settings.h index dedef6d..308a3fc 100644 --- a/common/rawaccel-settings.h +++ b/common/rawaccel-settings.h @@ -1,34 +1,64 @@ #pragma once #include "vec2.h" -#include "accel-base.hpp" - -#define MAX_DEV_ID_LEN 200 namespace rawaccel { - using milliseconds = double; - inline constexpr int MAX_POLL_RATE_KHZ = 8; - inline constexpr milliseconds DEFAULT_TIME_MIN = 1.0 / MAX_POLL_RATE_KHZ * 0.8; + inline constexpr int POLL_RATE_MAX = 8000; + + inline constexpr milliseconds DEFAULT_TIME_MIN = 1000.0 / POLL_RATE_MAX / 2; + inline constexpr milliseconds WRITE_DELAY = 1000; + inline constexpr size_t MAX_DEV_ID_LEN = 200; + enum class accel_mode { - linear, classic, natural, naturalgain, power, motivity, noaccel + classic, + natural, + motivity, + power, + noaccel + }; + + struct accel_args { + accel_mode mode = accel_mode::noaccel; + bool legacy = false; + + double offset = 0; + double cap = 1.5; + double accel_classic = 0.005; + double accel_natural = 0.1; + double accel_motivity = 1; + double motivity = 1.5; + double power = 2; + double scale = 1; + double weight = 1; + double exponent = 0.05; + double limit = 1.5; + double midpoint = 5; + }; + + struct domain_args { + vec2d domain_weights = { 1, 1 }; + double lp_norm = 2; }; struct settings { double degrees_rotation = 0; double degrees_snap = 0; bool combine_mags = true; - vec2 modes = { accel_mode::noaccel, accel_mode::noaccel }; + double dpi = 1000; + double speed_cap = 0; + vec2 argsv; vec2d sens = { 1, 1 }; vec2d dir_multipliers = {}; - domain_args domain_args = {}; + domain_args dom_args = {}; vec2d range_weights = { 1, 1 }; milliseconds time_min = DEFAULT_TIME_MIN; - wchar_t device_id[MAX_DEV_ID_LEN] = {0}; + + wchar_t device_id[MAX_DEV_ID_LEN] = {}; }; } -- cgit v1.2.3