aboutsummaryrefslogtreecommitdiff
path: root/hid-tmt300rs.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-07-26 10:01:15 +0300
committerGitHub <noreply@github.com>2022-07-26 10:01:15 +0300
commitb0cab03e4af15f5acb2d58f9e5bc8314a6a69816 (patch)
treebf6546f6dd6524677589a95a466d2334e3f523bb /hid-tmt300rs.c
parent9b1ae87e7be9924083aa6d150c44d8341361002c (diff)
parentf2950d23c24df162889df4553381262bfdcc6fc2 (diff)
downloadhid-tmff2-b0cab03e4af15f5acb2d58f9e5bc8314a6a69816.tar.gz
hid-tmff2-b0cab03e4af15f5acb2d58f9e5bc8314a6a69816.zip
Merge pull request #45 from Kimplul/direction
update direction
Diffstat (limited to 'hid-tmt300rs.c')
-rw-r--r--hid-tmt300rs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hid-tmt300rs.c b/hid-tmt300rs.c
index aee30d5..5120d4b 100644
--- a/hid-tmt300rs.c
+++ b/hid-tmt300rs.c
@@ -569,7 +569,7 @@ static int t300rs_update_constant(struct t300rs_device_entry *t300rs,
level = (constant.level * fixp_sin16(effect.direction * 360 / 0x10000)) / 0x7fff;
- if (constant.level != constant_old.level) {
+ if ((constant.level != constant_old.level) || (effect.direction != old.direction)) {
t300rs_fill_header(&packet_mod_constant->header, effect.id, 0x0a);
packet_mod_constant->level = cpu_to_le16(level);
@@ -634,7 +634,9 @@ static int t300rs_update_ramp(struct t300rs_device_entry *t300rs,
level = (top * fixp_sin16(effect.direction * 360 / 0x10000)) / 0x7fff;
- if (ramp.start_level != ramp_old.start_level || ramp.end_level != ramp_old.end_level) {
+ if ((ramp.start_level != ramp_old.start_level)
+ || (ramp.end_level != ramp_old.end_level)
+ || (effect.direction != old.direction)) {
t300rs_fill_header(&packet_mod_ramp->header, effect.id, 0x0e);
packet_mod_ramp->attribute = 0x03;
@@ -791,7 +793,8 @@ static int t300rs_update_periodic(struct t300rs_device_entry *t300rs,
magnitude = magnitude < 0 ? -magnitude : magnitude;
- if (periodic.magnitude != periodic_old.magnitude) {
+ if ((periodic.magnitude != periodic_old.magnitude)
+ || (effect.direction != old.direction)) {
t300rs_fill_header(&packet_mod_periodic->header, effect.id, 0x0e);
packet_mod_periodic->attribute = 0x01;