Add support for more LED modes

This commit is contained in:
dokutan 2021-01-21 17:54:58 +01:00
parent 2f05bc5920
commit 00ba433c84
10 changed files with 43 additions and 13 deletions

View file

@ -60,3 +60,23 @@ The settings are read in 3 parts:
1. led settings
2. macros
3. button mappping
### LED modes
The LED mode is specified by two bytes.
byte1 % 8:
- 0: off
- 1: decode byte2
- 2: wave (multicolor)
- 3: reactive_button (static color, new color on button press, not in the official software)
- 4: random (random flashing with random colors, scrollwheel and logo separately, not in the official software)
- 5: wave (same as 2)
- 6: alternating (flashing of scrollwheel and logo separately, multicolor)
- 7: reactive
byte2 (only relevant when byte1 == 1):
- 0: breathing (single color)
- 1: breathing_rainbow (not in the official software)
- 2: static
- 8: rainbow
- 16: flashing

View file

@ -5,7 +5,7 @@
[profile1]
# led mode:
# breathing, rainbow, static, wave, alternating, reactive, flashing, off
# breathing, breathing_rainbow, rainbow, static, wave, alternating, reactive, reactive_button, flashing, off, random
lightmode=static
# led color
color=50ff00

View file

@ -5,7 +5,7 @@
[profile1]
# led mode:
# breathing, rainbow, static, wave, alternating, reactive, flashing, off
# breathing, breathing_rainbow, rainbow, static, wave, alternating, reactive, reactive_button, flashing, off, random
lightmode=static
# led color
color=50ff00

View file

@ -5,7 +5,7 @@
[profile1]
# led mode:
# breathing, rainbow, static, wave, alternating, reactive, flashing, off
# breathing, breathing_rainbow, rainbow, static, wave, alternating, reactive, reactive_button, flashing, off, random
lightmode=static
# led color
color=50ff00

View file

@ -5,7 +5,7 @@
[profile1]
# led mode:
# breathing, rainbow, static, wave, alternating, reactive, flashing, off
# breathing, breathing_rainbow, rainbow, static, wave, alternating, reactive, reactive_button, flashing, off, random
lightmode=static
# led color
color=50ff00

View file

@ -5,7 +5,7 @@
[profile1]
# led mode:
# breathing, rainbow, static, wave, alternating, reactive, flashing, off
# breathing, breathing_rainbow, rainbow, static, wave, alternating, reactive, reactive_button, flashing, off, random
lightmode=static
# led color
color=50ff00

View file

@ -5,7 +5,7 @@
[profile1]
# led mode:
# breathing, rainbow, static, wave, alternating, reactive, flashing, off
# breathing, breathing_rainbow, rainbow, static, wave, alternating, reactive, reactive_button, flashing, off, random
lightmode=static
# led color
color=50ff00

View file

@ -308,13 +308,16 @@ std::map< rd_mouse::rd_report_rate, std::string > rd_mouse::_c_report_rate_strin
std::map< std::array<uint8_t, 2>, rd_mouse::rd_lightmode > rd_mouse::_c_lightmode_values = {
{ {0x00, 0x00}, rd_mouse::lightmode_off },
{ {0x01, 0x01}, rd_mouse::lightmode_breathing_rainbow },
{ {0x01, 0x02}, rd_mouse::lightmode_static },
{ {0x01, 0x04}, rd_mouse::lightmode_breathing },
{ {0x01, 0x08}, rd_mouse::lightmode_rainbow },
{ {0x01, 0x02}, rd_mouse::lightmode_static },
{ {0x01, 0x10}, rd_mouse::lightmode_flashing },
{ {0x02, 0x00}, rd_mouse::lightmode_wave },
{ {0x03, 0x00}, rd_mouse::lightmode_reactive_button },
{ {0x04, 0x00}, rd_mouse::lightmode_random },
{ {0x06, 0x00}, rd_mouse::lightmode_alternating },
{ {0x07, 0x00}, rd_mouse::lightmode_reactive },
{ {0x01, 0x10}, rd_mouse::lightmode_flashing }
{ {0x07, 0x00}, rd_mouse::lightmode_reactive }
};
std::map< rd_mouse::rd_lightmode, std::string > rd_mouse::_c_lightmode_strings = {
@ -325,5 +328,8 @@ std::map< rd_mouse::rd_lightmode, std::string > rd_mouse::_c_lightmode_strings =
{ rd_mouse::lightmode_wave, "wave" },
{ rd_mouse::lightmode_alternating, "alternating" },
{ rd_mouse::lightmode_reactive, "reactive" },
{ rd_mouse::lightmode_flashing, "flashing" }
{ rd_mouse::lightmode_flashing, "flashing" },
{ rd_mouse::lightmode_breathing_rainbow, "breathing_rainbow" },
{ rd_mouse::lightmode_reactive_button, "reactive_button" },
{ rd_mouse::lightmode_random, "random" }
};

View file

@ -917,9 +917,10 @@ int rd_mouse::_i_decode_lightmode( std::array<uint8_t, 2>& lightmode_bytes, std:
if( return_value != 0 ){
std::stringstream conversion_stream;
conversion_stream << "unknown, please report as bug: ";
conversion_stream << std::hex << (int)lightmode_bytes.at(0) << " ";
conversion_stream << std::hex << (int)lightmode_bytes.at(1) << std::dec;
conversion_stream << "unknown, please report as bug: " << std::setfill('0');
conversion_stream << std::hex << std::setw(2) << (int)lightmode_bytes[0] << " ";
conversion_stream << std::hex << std::setw(2) << (int)lightmode_bytes[1];
conversion_stream << std::setfill(' ') << std::setw(0) << std::dec;
lightmode_string = conversion_stream.str();
}

View file

@ -66,6 +66,9 @@ class rd_mouse{
lightmode_reactive,
lightmode_flashing,
lightmode_off,
lightmode_random,
lightmode_reactive_button,
lightmode_breathing_rainbow
};
/// The available USB report rates (polling rates)