From 37ae638a7c0ff2703f7342405e9362b697c04346 Mon Sep 17 00:00:00 2001 From: staticssleever668 <64694940+staticssleever668@users.noreply.github.com> Date: Wed, 28 Apr 2021 17:17:15 +0300 Subject: [PATCH] steelseries: improve v1 LED breathing duration configuration SteelSeries mice using V1 driver don't support changing LED breathing duration precisely, so it was always locked on 5 seconds. Now we try to match desired duration with factory preset values: 3, 5 and 7 seconds. --- src/driver-steelseries.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/driver-steelseries.c b/src/driver-steelseries.c index db5679a8..53089010 100644 --- a/src/driver-steelseries.c +++ b/src/driver-steelseries.c @@ -615,7 +615,17 @@ steelseries_write_led_v1(struct ratbag_led *led) buf[2] = 0x01; break; case RATBAG_LED_BREATHING: - buf[2] = 0x03; /* 0x02: slow, 0x03: medium, 0x04: fast */ + /* 0x2/3/4 - speed (by eye it's 3, 5 and 7 seconds) */ + if (led->ms <= 3000) { + led->ms = 3000; + buf[2] = 0x04; + } else if (led->ms <= 5000) { + led->ms = 5000; + buf[2] = 0x03; + } else { + led->ms = 7000; + buf[2] = 0x02; + } break; case RATBAG_LED_CYCLE: /* Cycle mode is not supported on this version */