Skip to content

Commit

Permalink
Change matrix_indicators to a switch statement
Browse files Browse the repository at this point in the history
Wrap if conditions for mousekeys in process_record_user
  • Loading branch information
Fae committed May 27, 2023
1 parent 2d910f8 commit 7f80e77
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions keyboards/kprepublic/bm40hsrgb/keymaps/coffee/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,21 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (!HAS_ANY_FLAGS(g_led_config.flags[pos], (LED_FLAG_MODIFIER | LED_FLAG_KEYLIGHT))) {continue;}
uint16_t KC = pgm_read_word(&((uint16_t*)keymaps)[(LAYER_SIZE * LAYER) + i]);

if (KC == KC_NO) {
RGB_MATRIX_INDICATOR_SET_COLOR(pos, 0, 0, 0 );
switch (KC) {
case KC_NO:
RGB_MATRIX_INDICATOR_SET_COLOR(pos, 0, 0, 0 );
break;

#ifdef DYNAMIC_MACRO_ENABLE
case MCR_SWT:
if (!MACRO1) { RGB_MATRIX_INDICATOR_SET_COLOR(pos, 0, BRIGHTNESS, BRIGHTNESS); }
break;

case MCR_REC:
if (RECORDING) { RGB_MATRIX_INDICATOR_SET_COLOR(pos, BRIGHTNESS, 0, 0); }
break;
#endif // DYNAMIC_MACRO_ENABLE
}

#ifdef DYNAMIC_MACRO_ENABLE
else if (KC == MCR_SWT) {
if (!MACRO1) {
RGB_MATRIX_INDICATOR_SET_COLOR(pos, 0, BRIGHTNESS, BRIGHTNESS);
}
} else if (KC == MCR_REC) {
if (RECORDING) {
RGB_MATRIX_INDICATOR_SET_COLOR(pos, BRIGHTNESS, 0, 0);
}
}
#endif // DYNAMIC_MACRO_ENABLE
}
return false;
}
Expand All @@ -139,7 +139,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif // DYNAMIC_MACRO_ENABLE

#ifdef MOUSEKEY_ENABLE
if (keycode == MS_ACL_U || keycode == MS_ACL_D) {
if ((keycode == MS_ACL_U) || (keycode == MS_ACL_D)) {
if (record->event.pressed) {
if ( (keycode == MS_ACL_U) && (current_accel < 2) ) { current_accel += 1; }
if ( (keycode == MS_ACL_D) && (current_accel > 0) ) { current_accel -= 1; }
Expand Down

0 comments on commit 7f80e77

Please sign in to comment.