Add shift-to-invert to remaining directional RGB_* keycode pairs (#7484)

* Add shift-to-invert to remaining directional RGB_* keycode pairs

RGB_MODE_FORWARD / RGB_MODE_REVERSE invert their functions when shift is held.
This change adds the same capabilities to the remaining directional RGB_*
keycode pairs.  This improves consistency and provides full RGB control in a
keymap containing only one keycode from each pair.

* remove redundant variable

* fix typo

* Fix more typos

Flyspell is on now I swear!
This commit is contained in:
Manna Harbour 2019-11-29 09:00:29 +11:00 committed by Joel Challis
parent 2048df8832
commit f9521ffa21
4 changed files with 79 additions and 43 deletions

View file

@ -173,16 +173,20 @@ As mentioned earlier, the center of the keyboard by default is expected to be `{
All RGB keycodes are currently shared with the RGBLIGHT system: All RGB keycodes are currently shared with the RGBLIGHT system:
* `RGB_TOG` - toggle |Key |Aliases |Description |
* `RGB_MOD` - cycle through modes |-------------------|----------|--------------------------------------------------------------------------------------|
* `RGB_HUI` - increase hue |`RGB_TOG` | |Toggle RGB lighting on or off |
* `RGB_HUD` - decrease hue |`RGB_MODE_FORWARD` |`RGB_MOD` |Cycle through modes, reverse direction when Shift is held |
* `RGB_SAI` - increase saturation |`RGB_MODE_REVERSE` |`RGB_RMOD`|Cycle through modes in reverse, forward direction when Shift is held |
* `RGB_SAD` - decrease saturation |`RGB_HUI` | |Increase hue, decrease hue when Shift is held |
* `RGB_VAI` - increase value |`RGB_HUD` | |Decrease hue, increase hue when Shift is held |
* `RGB_VAD` - decrease value |`RGB_SAI` | |Increase saturation, decrease saturation when Shift is held |
* `RGB_SPI` - increase speed effect (no EEPROM support) |`RGB_SAD` | |Decrease saturation, increase saturation when Shift is held |
* `RGB_SPD` - decrease speed effect (no EEPROM support) |`RGB_VAI` | |Increase value (brightness), decrease value when Shift is held |
|`RGB_VAD` | |Decrease value (brightness), increase value when Shift is held |
|`RGB_SPI` | |Increase effect speed (does not support eeprom yet), decrease speed when Shift is held|
|`RGB_SPD` | |Decrease effect speed (does not support eeprom yet), increase speed when Shift is held|
* `RGB_MODE_*` keycodes will generally work, but are not currently mapped to the correct effects for the RGB Matrix system * `RGB_MODE_*` keycodes will generally work, but are not currently mapped to the correct effects for the RGB Matrix system
## RGB Matrix Effects ## RGB Matrix Effects

View file

@ -48,12 +48,12 @@ Changing the **Value** sets the overall brightness.<br>
|`RGB_TOG` | |Toggle RGB lighting on or off | |`RGB_TOG` | |Toggle RGB lighting on or off |
|`RGB_MODE_FORWARD` |`RGB_MOD` |Cycle through modes, reverse direction when Shift is held | |`RGB_MODE_FORWARD` |`RGB_MOD` |Cycle through modes, reverse direction when Shift is held |
|`RGB_MODE_REVERSE` |`RGB_RMOD`|Cycle through modes in reverse, forward direction when Shift is held| |`RGB_MODE_REVERSE` |`RGB_RMOD`|Cycle through modes in reverse, forward direction when Shift is held|
|`RGB_HUI` | |Increase hue | |`RGB_HUI` | |Increase hue, decrease hue when Shift is held |
|`RGB_HUD` | |Decrease hue | |`RGB_HUD` | |Decrease hue, increase hue when Shift is held |
|`RGB_SAI` | |Increase saturation | |`RGB_SAI` | |Increase saturation, decrease saturation when Shift is held |
|`RGB_SAD` | |Decrease saturation | |`RGB_SAD` | |Decrease saturation, increase saturation when Shift is held |
|`RGB_VAI` | |Increase value (brightness) | |`RGB_VAI` | |Increase value (brightness), decrease value when Shift is held |
|`RGB_VAD` | |Decrease value (brightness) | |`RGB_VAD` | |Decrease value (brightness), increase value when Shift is held |
|`RGB_MODE_PLAIN` |`RGB_M_P `|Static (no animation) mode | |`RGB_MODE_PLAIN` |`RGB_M_P `|Static (no animation) mode |
|`RGB_MODE_BREATHE` |`RGB_M_B` |Breathing animation mode | |`RGB_MODE_BREATHE` |`RGB_M_B` |Breathing animation mode |
|`RGB_MODE_RAINBOW` |`RGB_M_R` |Rainbow animation mode | |`RGB_MODE_RAINBOW` |`RGB_M_R` |Rainbow animation mode |

View file

@ -389,12 +389,12 @@ This is a reference only. Each group of keys links to the page documenting their
|`RGB_TOG` | |Toggle RGB lighting on or off | |`RGB_TOG` | |Toggle RGB lighting on or off |
|`RGB_MODE_FORWARD` |`RGB_MOD` |Cycle through modes, reverse direction when Shift is held | |`RGB_MODE_FORWARD` |`RGB_MOD` |Cycle through modes, reverse direction when Shift is held |
|`RGB_MODE_REVERSE` |`RGB_RMOD`|Cycle through modes in reverse, forward direction when Shift is held| |`RGB_MODE_REVERSE` |`RGB_RMOD`|Cycle through modes in reverse, forward direction when Shift is held|
|`RGB_HUI` | |Increase hue | |`RGB_HUI` | |Increase hue, decrease hue when Shift is held |
|`RGB_HUD` | |Decrease hue | |`RGB_HUD` | |Decrease hue, increase hue when Shift is held |
|`RGB_SAI` | |Increase saturation | |`RGB_SAI` | |Increase saturation, decrease saturation when Shift is held |
|`RGB_SAD` | |Decrease saturation | |`RGB_SAD` | |Decrease saturation, increase saturation when Shift is held |
|`RGB_VAI` | |Increase value (brightness) | |`RGB_VAI` | |Increase value (brightness), decrease value when Shift is held |
|`RGB_VAD` | |Decrease value (brightness) | |`RGB_VAD` | |Decrease value (brightness), increase value when Shift is held |
|`RGB_MODE_PLAIN` |`RGB_M_P `|Static (no animation) mode | |`RGB_MODE_PLAIN` |`RGB_M_P `|Static (no animation) mode |
|`RGB_MODE_BREATHE` |`RGB_M_B` |Breathing animation mode | |`RGB_MODE_BREATHE` |`RGB_M_B` |Breathing animation mode |
|`RGB_MODE_RAINBOW` |`RGB_M_R` |Rainbow animation mode | |`RGB_MODE_RAINBOW` |`RGB_M_R` |Rainbow animation mode |
@ -407,19 +407,19 @@ This is a reference only. Each group of keys links to the page documenting their
## [RGB Matrix Lighting](feature_rgb_matrix.md) ## [RGB Matrix Lighting](feature_rgb_matrix.md)
|Key |Aliases |Description | |Key |Aliases |Description |
|-------------------|----------|--------------------------------------------------------------------| |-------------------|----------|--------------------------------------------------------------------------------------|
|`RGB_TOG` | |Toggle RGB lighting on or off | |`RGB_TOG` | |Toggle RGB lighting on or off |
|`RGB_MODE_FORWARD` |`RGB_MOD` |Cycle through modes, reverse direction when Shift is held | |`RGB_MODE_FORWARD` |`RGB_MOD` |Cycle through modes, reverse direction when Shift is held |
|`RGB_MODE_REVERSE` |`RGB_RMOD`|Cycle through modes in reverse, forward direction when Shift is held| |`RGB_MODE_REVERSE` |`RGB_RMOD`|Cycle through modes in reverse, forward direction when Shift is held |
|`RGB_HUI` | |Increase hue | |`RGB_HUI` | |Increase hue, decrease hue when Shift is held |
|`RGB_HUD` | |Decrease hue | |`RGB_HUD` | |Decrease hue, increase hue when Shift is held |
|`RGB_SAI` | |Increase saturation | |`RGB_SAI` | |Increase saturation, decrease saturation when Shift is held |
|`RGB_SAD` | |Decrease saturation | |`RGB_SAD` | |Decrease saturation, increase saturation when Shift is held |
|`RGB_VAI` | |Increase value (brightness) | |`RGB_VAI` | |Increase value (brightness), decrease value when Shift is held |
|`RGB_VAD` | |Decrease value (brightness) | |`RGB_VAD` | |Decrease value (brightness), increase value when Shift is held |
|`RGB_SPI` | |Increase effect speed (does no support eeprom yet) | |`RGB_SPI` | |Increase effect speed (does not support eeprom yet), decrease speed when Shift is held|
|`RGB_SPD` | |Decrease effect speed (does no support eeprom yet) | |`RGB_SPD` | |Decrease effect speed (does not support eeprom yet), increase speed when Shift is held|
## [Thermal Printer](feature_thermal_printer.md) ## [Thermal Printer](feature_thermal_printer.md)

View file

@ -346,28 +346,60 @@ bool process_record_quantum(keyrecord_t *record) {
} }
return false; return false;
case RGB_HUI: case RGB_HUI:
rgblight_increase_hue(); if (shifted) {
rgblight_decrease_hue();
} else {
rgblight_increase_hue();
}
return false; return false;
case RGB_HUD: case RGB_HUD:
rgblight_decrease_hue(); if (shifted) {
rgblight_increase_hue();
} else {
rgblight_decrease_hue();
}
return false; return false;
case RGB_SAI: case RGB_SAI:
rgblight_increase_sat(); if (shifted) {
rgblight_decrease_sat();
} else {
rgblight_increase_sat();
}
return false; return false;
case RGB_SAD: case RGB_SAD:
rgblight_decrease_sat(); if (shifted) {
rgblight_increase_sat();
} else {
rgblight_decrease_sat();
}
return false; return false;
case RGB_VAI: case RGB_VAI:
rgblight_increase_val(); if (shifted) {
rgblight_decrease_val();
} else {
rgblight_increase_val();
}
return false; return false;
case RGB_VAD: case RGB_VAD:
rgblight_decrease_val(); if (shifted) {
rgblight_increase_val();
} else {
rgblight_decrease_val();
}
return false; return false;
case RGB_SPI: case RGB_SPI:
rgblight_increase_speed(); if (shifted) {
rgblight_decrease_speed();
} else {
rgblight_increase_speed();
}
return false; return false;
case RGB_SPD: case RGB_SPD:
rgblight_decrease_speed(); if (shifted) {
rgblight_increase_speed();
} else {
rgblight_decrease_speed();
}
return false; return false;
case RGB_MODE_PLAIN: case RGB_MODE_PLAIN:
rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT); rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT);