Fixed so will compile both with and without underglow

pull/1583/merge
drashna 7 years ago committed by Jack Humbert
parent cb7255755b
commit 0f2a7b6210

@ -17,6 +17,8 @@
#define MOUS 2
#ifdef LAYER_UNDERGLOW_LIGHTING
bool has_layer_changed = true;
#define rgblight_set_teal rgblight_setrgb(0x00, 0xFF, 0xFF)
#define rgblight_set_red rgblight_setrgb(0xFF, 0x00, 0x00)
#define rgblight_set_blue rgblight_setrgb(0x00, 0xFF, 0x00);
@ -98,20 +100,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
void matrix_init_user(void) { // Runs boot tasks for keyboard
#ifdef LAYER_UNDERGLOW_LIGHTING
rgblight_set_teal;
#endif
};
void matrix_scan_user(void) {
static uint8_t old_layer = 0;
uint8_t new_layer = biton32(layer_state);
uint8_t modifiders = get_mods();
ergodox_board_led_off();
ergodox_right_led_1_off();
@ -119,6 +113,9 @@ void matrix_scan_user(void) {
ergodox_right_led_3_off();
#ifdef LAYER_UNDERGLOW_LIGHTING
static uint8_t old_layer = 0;
uint8_t modifiders = get_mods();
if ( modifiders & MODS_SHIFT_MASK) {
ergodox_right_led_1_on();
}
@ -128,7 +125,12 @@ void matrix_scan_user(void) {
if ( modifiders & MODS_ALT_MASK) {
ergodox_right_led_3_on();
}
if (old_layer != new_layer) {
has_layer_changed = true;
old_layer = new_layer;
}
if (has_layer_changed) {
switch (new_layer) {
case 1:
rgblight_set_red;
@ -155,9 +157,11 @@ void matrix_scan_user(void) {
rgblight_set_teal;
break;
}
}
has_layer_changed = false;
}
#else
switch (layer) {
switch (new_layer) {
case 1:
ergodox_right_led_1_on();
break;
@ -188,5 +192,4 @@ void matrix_scan_user(void) {
break;
}
#endif
old_layer = new_layer;
};

Loading…
Cancel
Save