mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-26 02:17:38 +06:00
Update on/off toggle behaviour for RGB LEDs
This commit is contained in:
parent
d281cd5c40
commit
0b7df9f2ef
|
@ -65,7 +65,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint8_t current_level = 2;
|
uint8_t current_level = 2;
|
||||||
uint8_t prev_current_level = 2;
|
|
||||||
int is_on = 0;
|
int is_on = 0;
|
||||||
|
|
||||||
enum macro_id {
|
enum macro_id {
|
||||||
|
@ -89,13 +88,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
|
||||||
case RGB_LEVEL_DOWN:
|
case RGB_LEVEL_DOWN:
|
||||||
if (event.pressed && current_level > 0) {
|
if (event.pressed && current_level > 0) {
|
||||||
current_level--;
|
current_level--;
|
||||||
prev_current_level--;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RGB_LEVEL_UP:
|
case RGB_LEVEL_UP:
|
||||||
if (event.pressed && current_level < MAX_BRIGHTNESS_IOS) {
|
if (event.pressed && current_level < MAX_BRIGHTNESS_IOS) {
|
||||||
current_level++;
|
current_level++;
|
||||||
prev_current_level++;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -121,8 +118,8 @@ void user_setrgb(uint8_t r, uint8_t g, uint8_t b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
if (is_on) {
|
if (!is_on) {
|
||||||
current_level = prev_current_level;
|
current_level = 2;
|
||||||
user_setrgb(0xFF, 0xFF, 0xFF);
|
user_setrgb(0xFF, 0xFF, 0xFF);
|
||||||
} else {
|
} else {
|
||||||
current_level = 0;
|
current_level = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user