diff options
Diffstat (limited to 'common')
| -rw-r--r-- | common/rawaccel-base.hpp | 4 | ||||
| -rw-r--r-- | common/rawaccel-validate.hpp | 4 |
2 files changed, 8 insertions, 0 deletions
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] = {}; diff --git a/common/rawaccel-validate.hpp b/common/rawaccel-validate.hpp index b9ee2af..a02324b 100644 --- a/common/rawaccel-validate.hpp +++ b/common/rawaccel-validate.hpp @@ -162,6 +162,10 @@ namespace rawaccel { error("minimum time"" must be positive"); } + if (args.time_max < args.time_min) { + error("max time is less than min time"); + } + return ret; } |