From ed0bbc22681681a16b7d45b05133c38a0b82006f Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Mon, 29 Mar 2021 18:01:20 -0400 Subject: formatting + file renames --- common/rawaccel-base.hpp | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 common/rawaccel-base.hpp (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp new file mode 100644 index 0000000..308a3fc --- /dev/null +++ b/common/rawaccel-base.hpp @@ -0,0 +1,64 @@ +#pragma once + +#include "vec2.h" + +namespace rawaccel { + using milliseconds = double; + + 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 { + 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; + double dpi = 1000; + double speed_cap = 0; + + vec2 argsv; + vec2d sens = { 1, 1 }; + vec2d dir_multipliers = {}; + domain_args dom_args = {}; + vec2d range_weights = { 1, 1 }; + milliseconds time_min = DEFAULT_TIME_MIN; + + wchar_t device_id[MAX_DEV_ID_LEN] = {}; + }; + +} -- cgit v1.2.3 From 5a0db3165d1ad050fd5e3f48d290f5ec7289a4f2 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:41:42 -0400 Subject: add jump type --- common/rawaccel-base.hpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index 308a3fc..ac60ff0 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -15,6 +15,7 @@ namespace rawaccel { enum class accel_mode { classic, + jump, natural, motivity, power, @@ -37,6 +38,7 @@ namespace rawaccel { double exponent = 0.05; double limit = 1.5; double midpoint = 5; + double smooth = 0.5; }; struct domain_args { -- cgit v1.2.3 From fa3ebfb1eb054ba88824a908c996094bb98e85c5 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Tue, 30 Mar 2021 18:27:02 -0400 Subject: refactor lut/motivity --- common/rawaccel-base.hpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index ac60ff0..6996164 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -13,19 +13,38 @@ namespace rawaccel { inline constexpr size_t MAX_DEV_ID_LEN = 200; + inline constexpr size_t LUT_CAPACITY = 1025; + enum class accel_mode { classic, jump, natural, - motivity, power, + motivity, noaccel }; + enum class table_mode { + off, + binlog, + linear + }; + + struct table_args { + table_mode mode = table_mode::off; + bool transfer = true; + unsigned char partitions = 2; + short num_elements = 8; + double start = 0; + double stop = 8; + }; + struct accel_args { accel_mode mode = accel_mode::noaccel; bool legacy = false; + table_args lut_args = {}; + double offset = 0; double cap = 1.5; double accel_classic = 0.005; -- cgit v1.2.3 From 98de0eaac2f6d780da8ff4ad9533dad10be40204 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Thu, 1 Apr 2021 18:15:50 -0400 Subject: add flag to negate device match --- common/rawaccel-base.hpp | 1 + 1 file changed, 1 insertion(+) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index 6996164..200c7d4 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -79,6 +79,7 @@ namespace rawaccel { vec2d range_weights = { 1, 1 }; milliseconds time_min = DEFAULT_TIME_MIN; + bool ignore = false; wchar_t device_id[MAX_DEV_ID_LEN] = {}; }; -- cgit v1.2.3 From e9866f27d78d9909fd4639cbd14a54b8ad5c2ec1 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Thu, 1 Apr 2021 18:33:00 -0400 Subject: driver - apply accel disregarding num packets add setting for max time threshold --- common/rawaccel-base.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index 200c7d4..ebc3f3e 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -5,9 +5,11 @@ namespace rawaccel { using milliseconds = double; + inline constexpr int POLL_RATE_MIN = 125; inline constexpr int POLL_RATE_MAX = 8000; inline constexpr milliseconds DEFAULT_TIME_MIN = 1000.0 / POLL_RATE_MAX / 2; + inline constexpr milliseconds DEFAULT_TIME_MAX = 1000.0 / POLL_RATE_MIN * 2; inline constexpr milliseconds WRITE_DELAY = 1000; @@ -77,7 +79,9 @@ namespace rawaccel { vec2d dir_multipliers = {}; domain_args dom_args = {}; vec2d range_weights = { 1, 1 }; + milliseconds time_min = DEFAULT_TIME_MIN; + milliseconds time_max = DEFAULT_TIME_MAX; bool ignore = false; wchar_t device_id[MAX_DEV_ID_LEN] = {}; -- cgit v1.2.3 From 31ffabf6f32ae14b6e2f6ce33763bf4ef1bff809 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Thu, 1 Apr 2021 19:40:19 -0400 Subject: make weights work in by component mode domain weights now applied under inf norm range weights now applied when equal --- common/rawaccel-base.hpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index ebc3f3e..a9da458 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -87,4 +87,10 @@ namespace rawaccel { wchar_t device_id[MAX_DEV_ID_LEN] = {}; }; + template + inline double apply_weighted(AccelFunc&& f, double x, double w) + { + return 1 + (f(x) - 1) * w; + } + } -- cgit v1.2.3 From 3751ac95831412dbdf9de9744c0ef59c34033d3d Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Thu, 1 Apr 2021 20:56:29 -0400 Subject: add minimum to complement speed cap important feature fixes some validation checks --- common/rawaccel-base.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index a9da458..9900aab 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -72,7 +72,8 @@ namespace rawaccel { double degrees_snap = 0; bool combine_mags = true; double dpi = 1000; - double speed_cap = 0; + double speed_min = 0; + double speed_max = 0; vec2 argsv; vec2d sens = { 1, 1 }; -- cgit v1.2.3 From 7c1f14845bc948e9ea25908e96099203d9433a69 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Tue, 6 Apr 2021 01:21:42 -0400 Subject: update wrapper + writer to handle lut grapher is building but applying options still broken for the most part --- common/rawaccel-base.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index 9900aab..d318db5 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -29,7 +29,8 @@ namespace rawaccel { enum class table_mode { off, binlog, - linear + linear, + arbitrary }; struct table_args { -- cgit v1.2.3 From 758de1d236f591de1d8b2fba4c58bfd8d5bbd26e Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 6 Apr 2021 18:04:28 -0700 Subject: Rename accelMotivity to growthRate --- common/rawaccel-base.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index d318db5..fc49a62 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -52,7 +52,7 @@ namespace rawaccel { double cap = 1.5; double accel_classic = 0.005; double accel_natural = 0.1; - double accel_motivity = 1; + double growth_rate = 1; double motivity = 1.5; double power = 2; double scale = 1; -- cgit v1.2.3 From 258fcd3bd236a787f07d7dac2049be524d86cb75 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 6 Apr 2021 23:11:20 -0700 Subject: Fix natural legacy algorithm, rename accelNatural to decayRate --- common/rawaccel-base.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index fc49a62..7dc1b96 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -51,7 +51,7 @@ namespace rawaccel { double offset = 0; double cap = 1.5; double accel_classic = 0.005; - double accel_natural = 0.1; + double decay_rate = 0.1; double growth_rate = 1; double motivity = 1.5; double power = 2; -- cgit v1.2.3 From 5e858b059436375ed1c17f7dc1b3e47a7e8e1d5d Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Wed, 7 Apr 2021 01:05:59 -0700 Subject: Add active value labels for gain switch --- common/rawaccel-base.hpp | 1 + 1 file changed, 1 insertion(+) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index 7dc1b96..6ce4468 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -23,6 +23,7 @@ namespace rawaccel { natural, power, motivity, + lookuptable, noaccel }; -- cgit v1.2.3 From c55d1bfd01147fa014ac07d4b03ef3cad8427ae6 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Thu, 8 Apr 2021 02:30:01 -0400 Subject: optimize a bit/refactor modify --- common/rawaccel-base.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index 6ce4468..dde56f5 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -17,6 +17,9 @@ namespace rawaccel { inline constexpr size_t LUT_CAPACITY = 1025; + inline constexpr double MAX_NORM = 16; + inline constexpr double PI = 3.14159265358979323846; + enum class accel_mode { classic, jump, @@ -79,7 +82,7 @@ namespace rawaccel { vec2 argsv; vec2d sens = { 1, 1 }; - vec2d dir_multipliers = {}; + vec2d dir_multipliers = { 1, 1 }; domain_args dom_args = {}; vec2d range_weights = { 1, 1 }; -- cgit v1.2.3 From 74ffcb8553795f4b50e544a1b2a0e53aec32a860 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Thu, 8 Apr 2021 21:48:17 -0400 Subject: make sizeof arbitrary close to others refactor constructor/fix conversions --- common/rawaccel-base.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index dde56f5..2f49ec0 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -15,7 +15,7 @@ namespace rawaccel { inline constexpr size_t MAX_DEV_ID_LEN = 200; - inline constexpr size_t LUT_CAPACITY = 1025; + inline constexpr size_t SPACED_LUT_CAPACITY = 1025; inline constexpr double MAX_NORM = 16; inline constexpr double PI = 3.14159265358979323846; -- cgit v1.2.3 From a6926be0e911b7b7637861866f41c3bca31a87a3 Mon Sep 17 00:00:00 2001 From: a1xd <68629610+a1xd@users.noreply.github.com> Date: Tue, 13 Apr 2021 23:59:21 -0400 Subject: move arbitrary input into settings separate arbitrary mode from spaced modes, arbitrary now deserializes from default settings file --- common/rawaccel-base.hpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'common/rawaccel-base.hpp') diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index 2f49ec0..c1b2db3 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -16,6 +16,7 @@ namespace rawaccel { inline constexpr size_t MAX_DEV_ID_LEN = 200; inline constexpr size_t SPACED_LUT_CAPACITY = 1025; + inline constexpr size_t ARB_LUT_CAPACITY = SPACED_LUT_CAPACITY / 4; inline constexpr double MAX_NORM = 16; inline constexpr double PI = 3.14159265358979323846; @@ -24,21 +25,20 @@ namespace rawaccel { classic, jump, natural, - power, motivity, - lookuptable, + power, + arb_lookup, noaccel }; - enum class table_mode { + enum class spaced_lut_mode { off, binlog, - linear, - arbitrary + linear }; - struct table_args { - table_mode mode = table_mode::off; + struct spaced_lut_args { + spaced_lut_mode mode = spaced_lut_mode::off; bool transfer = true; unsigned char partitions = 2; short num_elements = 8; @@ -46,12 +46,16 @@ namespace rawaccel { double stop = 8; }; + struct table_args { + bool velocity = true; + int length = 0; + vec2 data[ARB_LUT_CAPACITY] = {}; + }; + struct accel_args { accel_mode mode = accel_mode::noaccel; bool legacy = false; - table_args lut_args = {}; - double offset = 0; double cap = 1.5; double accel_classic = 0.005; @@ -65,6 +69,9 @@ namespace rawaccel { double limit = 1.5; double midpoint = 5; double smooth = 0.5; + + spaced_lut_args spaced_args; + table_args arb_args; }; struct domain_args { -- cgit v1.2.3