aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-07-12 19:14:10 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-07-12 19:14:10 +0300
commitf2950d23c24df162889df4553381262bfdcc6fc2 (patch)
treef86e929a9c3adace1028ef459d9fec031b5e4490
parent162a1f666c71eb5584ed6dae26b957f9405d33bc (diff)
downloadhid-tmff2-f2950d23c24df162889df4553381262bfdcc6fc2.tar.gz
hid-tmff2-f2950d23c24df162889df4553381262bfdcc6fc2.zip
update direction
-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;