aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-01 21:27:31 +0100
committerGitHub <noreply@github.com>2024-07-01 21:27:31 +0100
commit58b0d47857e62bc55655cd5098241557bcc147f8 (patch)
treea28dc1176a5e131f190652ce34cb4f5bd0215f48
parent7237249d7d28bd754fa6d42e8697e7442b34c539 (diff)
parent1822d84478003130a5280f7c0b52e6924108311f (diff)
downloadhid-tmff2-58b0d47857e62bc55655cd5098241557bcc147f8.tar.gz
hid-tmff2-58b0d47857e62bc55655cd5098241557bcc147f8.zip
Merge pull request #109 from MmAaXx500/playingdelay
Consider the delay to determine the length of the effect
-rw-r--r--src/hid-tmff2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hid-tmff2.c b/src/hid-tmff2.c
index 0149d99..3b51445 100644
--- a/src/hid-tmff2.c
+++ b/src/hid-tmff2.c
@@ -292,7 +292,7 @@ static void tmff2_work_handler(struct work_struct *w)
struct tmff2_effect_state *state;
int max_count = 0, effect_id;
unsigned long time_now;
- __u16 effect_length;
+ __u16 effect_delay, effect_length;
if (!tmff2)
@@ -304,9 +304,10 @@ static void tmff2_work_handler(struct work_struct *w)
time_now = JIFFIES2MS(jiffies);
state = &tmff2->states[effect_id];
+ effect_delay = state->effect.replay.delay;
effect_length = state->effect.replay.length;
if (test_bit(FF_EFFECT_PLAYING, &state->flags) && effect_length) {
- if ((time_now - state->start_time) >= effect_length * state->count) {
+ if ((time_now - state->start_time) >= (effect_delay + effect_length) * state->count) {
__clear_bit(FF_EFFECT_PLAYING, &state->flags);
__clear_bit(FF_EFFECT_QUEUE_UPDATE, &state->flags);