summaryrefslogtreecommitdiff
path: root/common/rawaccel-base.hpp
diff options
context:
space:
mode:
authora1xd <[email protected]>2021-08-28 01:19:18 -0400
committera1xd <[email protected]>2021-09-23 22:28:44 -0400
commit5b659e1cfbc4b8fbbd2f2bf41dc716929976c77d (patch)
tree4bffba32fa508494a268b6f53513fb3c7b1e3e5c /common/rawaccel-base.hpp
parentMerge pull request #107 from a1xd/1.5.0-fix (diff)
downloadrawaccel-5b659e1cfbc4b8fbbd2f2bf41dc716929976c77d.tar.xz
rawaccel-5b659e1cfbc4b8fbbd2f2bf41dc716929976c77d.zip
add per-device configuration
adds input and [in, out] cap for classic mode adds input cap for power mode change wrapper/input, now gets useful device names change (now dev specific) dpi to adjust sensitivity change y sensitivity to y/x ratio remove spaced LUTs grapher and convert do not build
Diffstat (limited to 'common/rawaccel-base.hpp')
-rw-r--r--common/rawaccel-base.hpp84
1 files changed, 34 insertions, 50 deletions
diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp
index c1b2db3..ce6c103 100644
--- a/common/rawaccel-base.hpp
+++ b/common/rawaccel-base.hpp
@@ -13,97 +13,81 @@ namespace rawaccel {
inline constexpr milliseconds WRITE_DELAY = 1000;
+ inline constexpr size_t POOL_SIZE = 1024 * 512;
+
inline constexpr size_t MAX_DEV_ID_LEN = 200;
+ inline constexpr size_t MAX_NAME_LEN = 256;
- inline constexpr size_t SPACED_LUT_CAPACITY = 1025;
- inline constexpr size_t ARB_LUT_CAPACITY = SPACED_LUT_CAPACITY / 4;
+ inline constexpr size_t LUT_RAW_DATA_CAPACITY = 258;
+ inline constexpr size_t LUT_POINTS_CAPACITY = LUT_RAW_DATA_CAPACITY / 2;
inline constexpr double MAX_NORM = 16;
inline constexpr double PI = 3.14159265358979323846;
+ inline constexpr bool LEGACY = 0;
+ inline constexpr bool GAIN = 1;
+
enum class accel_mode {
classic,
jump,
natural,
motivity,
power,
- arb_lookup,
+ lookup,
noaccel
};
- enum class spaced_lut_mode {
- off,
- binlog,
- linear
- };
-
- struct spaced_lut_args {
- spaced_lut_mode mode = spaced_lut_mode::off;
- bool transfer = true;
- unsigned char partitions = 2;
- short num_elements = 8;
- double start = 0;
- double stop = 8;
- };
-
- struct table_args {
- bool velocity = true;
- int length = 0;
- vec2<float> data[ARB_LUT_CAPACITY] = {};
+ enum class classic_cap_mode {
+ io, in, out
};
struct accel_args {
accel_mode mode = accel_mode::noaccel;
- bool legacy = false;
+ bool gain = 1;
double offset = 0;
- double cap = 1.5;
- double accel_classic = 0.005;
+ double acceleration = 0.005;
double decay_rate = 0.1;
double growth_rate = 1;
double motivity = 1.5;
- double power = 2;
+ double exponent_classic = 2;
double scale = 1;
double weight = 1;
- double exponent = 0.05;
+ double exponent_power = 0.05;
double limit = 1.5;
double midpoint = 5;
double smooth = 0.5;
+ vec2d cap = { 15, 1.5 };
+ classic_cap_mode cap_mode = classic_cap_mode::out;
- spaced_lut_args spaced_args;
- table_args arb_args;
+ int length = 0;
+ mutable float data[LUT_RAW_DATA_CAPACITY] = {};
};
- struct domain_args {
- vec2d domain_weights = { 1, 1 };
+
+ struct profile {
+ wchar_t name[MAX_NAME_LEN] = L"default";
+
+ bool whole = true;
double lp_norm = 2;
- };
+ vec2d domain_weights = { 1, 1 };
+ vec2d range_weights = { 1, 1 };
+
+ double sensitivity = 1;
+ double yx_sens_ratio = 1;
+
+ accel_args accel_x;
+ accel_args accel_y;
- struct settings {
- double degrees_rotation = 0;
- double degrees_snap = 0;
- bool combine_mags = true;
- double dpi = 1000;
double speed_min = 0;
double speed_max = 0;
- vec2<accel_args> argsv;
- vec2d sens = { 1, 1 };
vec2d dir_multipliers = { 1, 1 };
- domain_args dom_args = {};
- vec2d range_weights = { 1, 1 };
- milliseconds time_min = DEFAULT_TIME_MIN;
- milliseconds time_max = DEFAULT_TIME_MAX;
+ double degrees_rotation = 0;
- bool ignore = false;
- wchar_t device_id[MAX_DEV_ID_LEN] = {};
+ double degrees_snap = 0;
};
- template <typename AccelFunc>
- inline double apply_weighted(AccelFunc&& f, double x, double w)
- {
- return 1 + (f(x) - 1) * w;
- }
}