diff options
Diffstat (limited to 'keyboards/moonlander/moonlander.c')
| -rw-r--r-- | keyboards/moonlander/moonlander.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/keyboards/moonlander/moonlander.c b/keyboards/moonlander/moonlander.c index 403e6aef8..39f61b5c4 100644 --- a/keyboards/moonlander/moonlander.c +++ b/keyboards/moonlander/moonlander.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Copyright 2020 ZSA Technology Labs, Inc <@zsa> | 1 | /* Copyright 2020 ZSA Technology Labs, Inc <@zsa> |
| 2 | * Copyright 2020 Jack Humbert <jack.humb@gmail.com> | 2 | * Copyright 2020 Jack Humbert <jack.humb@gmail.com> |
| 3 | * Copyright 2020 Drashna Jael're <drashna@live.com> | 3 | * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) |
| 4 | * | 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify | 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
| @@ -159,10 +159,10 @@ void keyboard_pre_init_kb(void) { | |||
| 159 | keyboard_pre_init_user(); | 159 | keyboard_pre_init_user(); |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | #ifdef ORYX_CONFIGURATOR | 162 | #if !defined(MOONLANDER_USER_LEDS) |
| 163 | layer_state_t layer_state_set_kb(layer_state_t state) { | 163 | layer_state_t layer_state_set_kb(layer_state_t state) { |
| 164 | state = layer_state_set_user(state); | 164 | state = layer_state_set_user(state); |
| 165 | if (is_launching) return state; | 165 | if (is_launching || !keyboard_config.led_level) return state; |
| 166 | 166 | ||
| 167 | ML_LED_1(false); | 167 | ML_LED_1(false); |
| 168 | ML_LED_2(false); | 168 | ML_LED_2(false); |
| @@ -415,6 +415,24 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | |||
| 415 | if (!record->event.pressed && !webusb_state.pairing) layer_state_set_kb(layer_state); | 415 | if (!record->event.pressed && !webusb_state.pairing) layer_state_set_kb(layer_state); |
| 416 | break; | 416 | break; |
| 417 | #endif | 417 | #endif |
| 418 | #if !defined(MOONLANDER_USER_LEDS) | ||
| 419 | case LED_LEVEL: | ||
| 420 | if (record->event.pressed) { | ||
| 421 | keyboard_config.led_level ^= 1; | ||
| 422 | eeconfig_update_kb(keyboard_config.raw); | ||
| 423 | if (keyboard_config.led_level) { | ||
| 424 | layer_state_set_kb(layer_state); | ||
| 425 | } else { | ||
| 426 | ML_LED_1(false); | ||
| 427 | ML_LED_2(false); | ||
| 428 | ML_LED_3(false); | ||
| 429 | ML_LED_4(false); | ||
| 430 | ML_LED_5(false); | ||
| 431 | ML_LED_6(false); | ||
| 432 | } | ||
| 433 | } | ||
| 434 | break; | ||
| 435 | #endif | ||
| 418 | #ifdef RGB_MATRIX_ENABLE | 436 | #ifdef RGB_MATRIX_ENABLE |
| 419 | case TOGGLE_LAYER_COLOR: | 437 | case TOGGLE_LAYER_COLOR: |
| 420 | if (record->event.pressed) { | 438 | if (record->event.pressed) { |
| @@ -449,6 +467,11 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | |||
| 449 | void matrix_init_kb(void) { | 467 | void matrix_init_kb(void) { |
| 450 | keyboard_config.raw = eeconfig_read_kb(); | 468 | keyboard_config.raw = eeconfig_read_kb(); |
| 451 | 469 | ||
| 470 | if (!keyboard_config.led_level && !keyboard_config.led_level_res) { | ||
| 471 | keyboard_config.led_level = true; | ||
| 472 | keyboard_config.led_level_res = 0b11; | ||
| 473 | eeconfig_update_kb(keyboard_config.raw); | ||
| 474 | } | ||
| 452 | #ifdef RGB_MATRIX_ENABLE | 475 | #ifdef RGB_MATRIX_ENABLE |
| 453 | if (keyboard_config.rgb_matrix_enable) { | 476 | if (keyboard_config.rgb_matrix_enable) { |
| 454 | rgb_matrix_set_flags(LED_FLAG_ALL); | 477 | rgb_matrix_set_flags(LED_FLAG_ALL); |
| @@ -461,6 +484,8 @@ void matrix_init_kb(void) { | |||
| 461 | void eeconfig_init_kb(void) { // EEPROM is getting reset! | 484 | void eeconfig_init_kb(void) { // EEPROM is getting reset! |
| 462 | keyboard_config.raw = 0; | 485 | keyboard_config.raw = 0; |
| 463 | keyboard_config.rgb_matrix_enable = true; | 486 | keyboard_config.rgb_matrix_enable = true; |
| 487 | keyboard_config.led_level = true; | ||
| 488 | keyboard_config.led_level_res = 0b11; | ||
| 464 | eeconfig_update_kb(keyboard_config.raw); | 489 | eeconfig_update_kb(keyboard_config.raw); |
| 465 | eeconfig_init_user(); | 490 | eeconfig_init_user(); |
| 466 | } | 491 | } |
