1
0
mirror of https://github.com/MatMoul/g810-led.git synced 2024-12-22 17:06:10 +00:00

Add ripple and off effects

NOTE: Ripple effect (0x05) seems to have a conflict with an unadvertised
"stars"-like effect for the G410 and G810. Did not explore setting
timing for the G410/G810 effect, but is likely contrasted greatly with
the timing of the new Ripple effect. GHub limits ripple timing between
20ms and 200ms, but actual values are arbitrary and were tested up to
5000ms. Ideally should be kept within the 20-200ms range for best feel
of the effect. Logo does not honor the effect, and GHub simply sets to
the default "Logitech Blue".

Signed-off-by: Kevin Pearson <kevin.pearson@ortmanconsulting.com>
This commit is contained in:
Kevin Pearson 2019-09-26 08:50:46 -04:00
parent 1a26bf7e64
commit b938bf6c1d
2 changed files with 27 additions and 3 deletions

View File

@ -739,12 +739,15 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part,
break;
case NativeEffectGroup::cycle:
case NativeEffectGroup::waves:
case NativeEffectGroup::ripple:
if (! setGroupKeys(
LedKeyboard::KeyGroup::indicators,
LedKeyboard::Color({0xff, 0xff, 0xff}))
) return false;
if (! commit()) return false;
break;
default:
break;
}
return (
setNativeEffect(effect, LedKeyboard::NativeEffectPart::keys, period, color, storage) &&
@ -810,6 +813,19 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part,
switch (part) {
case NativeEffectPart::keys:
data[4] = 0x01;
//Seems to conflict with a star-like effect on G410 and G810
switch (effect) {
case NativeEffect::ripple:
//Adjust periodicity
data[9]=0x00;
data[10]=period.count() >> 8 & 0xff;;
data[11]=period.count() & 0xff;
data[12]=0x00;
break;
default:
break;
}
break;
case NativeEffectPart::logo:
data[4] = 0x00;
@ -827,6 +843,10 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part,
case NativeEffect::cycle:
data[5]=0x02;
break;
case NativeEffect::ripple:
case NativeEffect::off:
data[5]=0x00;
break;
default:
data[5]=0x01;
break;

View File

@ -79,19 +79,23 @@ class LedKeyboard {
color
};
enum class NativeEffectGroup : uint8_t {
color = 0x01,
off,
color,
breathing,
cycle,
waves
waves,
ripple
};
enum class NativeEffect : uint16_t {
off,
color = static_cast<uint16_t>(NativeEffectGroup::color) << 8,
breathing = static_cast<uint16_t>(NativeEffectGroup::breathing) << 8,
cycle = static_cast<uint16_t>(NativeEffectGroup::cycle) << 8,
waves = static_cast<uint16_t>(NativeEffectGroup::waves) << 8,
hwave,
vwave,
cwave
cwave,
ripple = static_cast<uint16_t>(NativeEffectGroup::ripple) << 8
};
enum class NativeEffectPart : uint8_t {
all = 0xff,