mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 11:29:26 +00:00
[Keymap] Cleanup coffeeislife87 keymap and remove features (#21061)
Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Fae <faenkhauser@gmail.com>
This commit is contained in:
parent
3a3e5abac9
commit
c2ddd77e0d
@ -52,14 +52,6 @@
|
||||
# undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||
#endif
|
||||
|
||||
// If RGBLight is enabled
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
# define RGBLED_NUM RGB_MATRIX_LED_COUNT
|
||||
|
||||
# define RGBLIGHT_EFFECT_SNAKE
|
||||
# define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
#endif
|
||||
|
||||
// Feature disable
|
||||
#ifndef NO_PRINT
|
||||
# define NO_PRINT
|
||||
|
@ -4,16 +4,11 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum custom_keycodes {
|
||||
NULLKEY = SAFE_RANGE, // An empty key to start (and maybe end) the enum
|
||||
#ifdef DYNAMIC_MACRO_ENABLE
|
||||
MCR_PLY, // Macro play
|
||||
MCR_PLY = QK_USER, // Macro play
|
||||
MCR_REC, // Macro record
|
||||
MCR_SWT, // Swap active macro
|
||||
#endif
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
MS_ACL_U,
|
||||
MS_ACL_D,
|
||||
#endif
|
||||
MS_ACL_U, // Mouse speed up
|
||||
MS_ACL_D, // Mouse speed down
|
||||
};
|
||||
|
||||
enum layout_names {
|
||||
@ -36,16 +31,16 @@ static int current_accel = 0;
|
||||
|
||||
#ifdef DYNAMIC_MACRO_ENABLE
|
||||
// Macro 1 is = 1, Macro 2 = -1, No macro = 0
|
||||
static bool MACRO1 = true;
|
||||
static bool MACRO1 = true; // Determines whether or not we're using 1 or 2
|
||||
static bool RECORDING = false;
|
||||
|
||||
static uint16_t REC = DM_REC1;
|
||||
static uint16_t PLY = DM_PLY1;
|
||||
static uint16_t REC = DM_REC1; // Record either macro 1 or 2. Or stop recording
|
||||
static uint16_t PLY = DM_PLY1; // Play either macro 1 or macro 2
|
||||
|
||||
void dynamic_macro_record_start_user(int8_t direction) {
|
||||
REC = DM_RSTP;
|
||||
RECORDING = true;
|
||||
}
|
||||
|
||||
void dynamic_macro_record_end_user(int8_t direction) {
|
||||
RECORDING = false;
|
||||
}
|
||||
@ -53,7 +48,7 @@ static int current_accel = 0;
|
||||
#define MCR_PLY KC_NO
|
||||
#define MCR_REC KC_NO
|
||||
#define MCR_SWT KC_NO
|
||||
#endif
|
||||
#endif // DYNAMIC_MACRO_ENABLE
|
||||
|
||||
const uint16_t PROGMEM keymaps[_END][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[_MAIN] = LAYOUT_planck_mit(
|
||||
@ -84,54 +79,44 @@ const uint16_t PROGMEM keymaps[_END][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
#endif // MOUSEKEY_ENABLE
|
||||
};
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
|
||||
#define LAYER (get_highest_layer(layer_state))
|
||||
#define LAYER_SIZE (MATRIX_ROWS * MATRIX_COLS)
|
||||
#define CHECK_LED() \
|
||||
if ((i >= RGB_MATRIX_LED_COUNT) \
|
||||
|| ((g_led_config.flags[pos] == LED_FLAG_NONE) || (g_led_config.flags[pos] == LED_FLAG_UNDERGLOW))) \
|
||||
continue
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
#define BRIGHTNESS rgb_matrix_get_val()
|
||||
|
||||
#ifdef UNDERGLOW_DISABLE
|
||||
void keyboard_pre_init_user(void) {
|
||||
|
||||
for (int key_id = 0; key_id < RGB_MATRIX_LED_COUNT; key_id++ ) {
|
||||
if (g_led_config.flags[key_id] == LED_FLAG_UNDERGLOW) {
|
||||
g_led_config.flags[key_id] = LED_FLAG_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // UNDERGLOW_DISABLE
|
||||
|
||||
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
||||
if (LAYER != _MAIN) {
|
||||
|
||||
int DimmedMax = UINT8_MAX - (UINT8_MAX - rgb_matrix_config.hsv.v);
|
||||
if (LAYER == _MAIN) {return false;}
|
||||
|
||||
for (uint8_t i = led_min; i <= led_max; i++) {
|
||||
|
||||
uint8_t pos = ((uint8_t*)g_led_config.matrix_co)[i];
|
||||
|
||||
CHECK_LED(); // Check LED before moving on
|
||||
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) {
|
||||
switch (KC) {
|
||||
case KC_NO:
|
||||
RGB_MATRIX_INDICATOR_SET_COLOR(pos, 0, 0, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef DYNAMIC_MACRO_ENABLE
|
||||
else if (KC == MCR_SWT) {
|
||||
if (!MACRO1) {
|
||||
RGB_MATRIX_INDICATOR_SET_COLOR(pos, 0, DimmedMax, DimmedMax);
|
||||
}
|
||||
} else if (KC == MCR_REC) {
|
||||
if (RECORDING) {
|
||||
RGB_MATRIX_INDICATOR_SET_COLOR(pos, DimmedMax, 0, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
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
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -139,18 +124,17 @@ const uint16_t PROGMEM keymaps[_END][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
#endif
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
#ifdef DYNAMIC_MACRO_ENABLE
|
||||
if (keycode == MCR_REC) keycode = REC;
|
||||
if (keycode == MCR_PLY) keycode = PLY;
|
||||
if (keycode == MCR_REC) {keycode = REC;}
|
||||
if (keycode == MCR_PLY) {keycode = PLY;}
|
||||
if (!process_dynamic_macro(keycode, record)) {
|
||||
REC = (MACRO1 ? DM_REC1 : DM_REC2);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#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; }
|
||||
@ -159,7 +143,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
action_t mousekey_action = action_for_keycode(keycode);
|
||||
process_action(record, mousekey_action);
|
||||
}
|
||||
#endif
|
||||
#endif // MOUSEKEY_ENABLE
|
||||
|
||||
switch (keycode) {
|
||||
#ifdef DYNAMIC_MACRO_ENABLE
|
||||
@ -176,24 +160,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && defined(RGBLIGHT_ENABLE) // this only needs to be defined if both are enabled
|
||||
case RGB_TOG: // We can intercept this keycode ig? Cool :)
|
||||
if (record->event.pressed) {
|
||||
if (rgb_matrix_is_enabled()) {
|
||||
rgb_matrix_disable/*_noeeprom*/();
|
||||
rgblight_enable/*_noeeprom*/();
|
||||
} else if (rgblight_is_enabled()) {
|
||||
rgb_matrix_disable/*_noeeprom*/();
|
||||
rgblight_disable/*_noeeprom*/();
|
||||
} else {
|
||||
rgb_matrix_enable/*_noeeprom*/();
|
||||
rgblight_disable/*_noeeprom*/();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
#endif // DYNAMIC_MACRO_ENABLE
|
||||
|
||||
default:
|
||||
return true; //Process all other keycodes normally
|
||||
|
Loading…
Reference in New Issue
Block a user