Skip to content

Commit

Permalink
Optimizations
Browse files Browse the repository at this point in the history
Removed unused code, some optimizations (mostly for space).
  • Loading branch information
moutis authored Feb 25, 2022
1 parent 12551f0 commit 8e0e4da
Show file tree
Hide file tree
Showing 10 changed files with 927 additions and 294 deletions.
57 changes: 50 additions & 7 deletions moutis.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ user_config_t user_config;
uint8_t saved_mods = 0; // to pass state between process_record_user and matrix_scan_user
uint16_t record_keycode = 0; // the keykcode we poke at in process_record

uint16_t myKC_C = KC_C; // keycode for "C" (could be K if Japanese)
uint16_t myKC_L = KC_L; // keycode for "L" (could be R if Japanese)
uint16_t LBRC_key = KC_LBRC; // keycode for "["
uint16_t RBRC_key = KC_RBRC; // keycode for "]"
uint16_t linger_key = 0; // keycode for linger actions (ex. "Qu")
uint32_t linger_timer = 0; // time to hold a key before something else happens.
uint32_t state_reset_timer = 0; // time to leave a state active before shutting it down automatically.
bool appmenu_on = false; // state of windows-like app switcher
bool mods_held = false; // nood to remember how we entered the appmenu state
bool key_trap = false; // used for shift BS = del (right)

//Kinda klugy, prototyping things.
uint16_t myKC_C = KC_C; // keycode for "C" (could be K if Japanese mode)
uint16_t myKC_X = KC_X; // keycode for "X" (could be Z if Japanese mode)
uint16_t LBRC_key = KC_LBRC; // keycode for "["
uint16_t RBRC_key = KC_RBRC; // keycode for "]"

#ifdef RGBLIGHT_ENABLE
int RGB_current_mode;
#endif
Expand All @@ -43,10 +45,12 @@ void keyboard_post_init_user(void) {

#ifdef OLED_DRIVER_ENABLE
oled_clear();
if (user_config.OSIndex) {
switch (user_config.OSIndex) {
case OS_Mac:
oled_set_cursor(oled_max_chars() - 3, 0);
oled_write_P(PSTR("WIN"), false);
} else {
break;
case OS_Win:
oled_set_cursor(oled_max_chars() - 3, 0);
oled_write_P(PSTR("MAC"), false);
}
Expand All @@ -58,7 +62,7 @@ void keyboard_post_init_user(void) {
uint32_t layer_state_set_user(uint32_t layer_state) {

/*
Someday, when OLED is omportant again, rewrite to
Someday, when OLED is important again, rewrite to
display Host Keyboard Layer Status using a table of layer names
*/

Expand All @@ -68,6 +72,45 @@ uint32_t layer_state_set_user(uint32_t layer_state) {
oled_write_P (layer_name[get_highest_layer(layer_state)]);
}
#endif


#ifdef RGBLIGHT_ENABLE
switch (biton32(layer_state)) {
case L_PUNCT:
rgblight_sethsv_noeeprom(213, 255, 128);
break;
case L_FN_NUM:
rgblight_sethsv_noeeprom(64, 255, 128);
break;
case L_NUMPAD:
rgblight_sethsv_noeeprom(85, 255, 128);
break;
case L_NAV:
rgblight_sethsv_noeeprom(128, 255, 128);
break;
case L_MEDIA_KBD:
rgblight_sethsv_noeeprom(0, 255, 128);
break;
default: // for any other layers, or the default layer
rgblight_reload_from_eeprom();
/*
switch (biton32(default_layer_state)) {
case L_HDBRONZE:
rgblight_sethsv_noeeprom(12, 228, 228);
break;
case L_HDGOLD:
rgblight_sethsv_noeeprom(36, 240, 240);
break;
case L_QWERTY:
rgblight_sethsv_noeeprom(HSV_AZURE);
break;
}
*/
break;
}
#endif // RGBLIGHT_ENABLE


return layer_state;
}

Expand Down
12 changes: 8 additions & 4 deletions moutis.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ extern rgblight_config_t rgblight_config;
#endif


enum OS_Platform { // Used for platform support via SemKeys
OS_Mac,
OS_Win,
OS_count
};

void matrix_scan_user_process_combo(void);

Expand All @@ -64,8 +69,8 @@ enum my_layers {
L_HDGOLD,
L_QWERTY, //
L_PUNCT,
L_LANG_NUM,
L_FN,
L_FN_NUM,
L_NUMPAD,
L_NAV,
// L_SYMBOLS,
L_MEDIA_KBD
Expand Down Expand Up @@ -110,9 +115,7 @@ enum my_layers {
SK_SDQL, // ’ ** Left double quote UNICODE?
SK_SDQR, // ’ ** Right double quote UNICODE?
SemKeys_COUNT, // end of non-glyph SemKeys
// HD_DQUO, // Do we need our own unshifted shift symbols
HD_AdaptKeyToggle,
HD_HASH, // to avoid the QMK 14.1 bug on not-split boards?
HD_L_Bronze, // KC to switch default layout
// HD_L_Silver,
// HD_L_Platinum,
Expand Down Expand Up @@ -163,3 +166,4 @@ enum my_layers {
#define register_linger_key(kc) register_code16(kc);
#define unregister_linger_key(kc) unregister_code16(kc);
*/

17 changes: 8 additions & 9 deletions moutis_COMBO_hd.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ enum my_combos {
// HC_Thg, // treat as θ (for Neu-tx a.k.a Gold)
HC_Sh, // TYPE "sh"
// HC_Shs, // TYPE "sh" (for Neu-nx a.k.a Silver)
HC_Whg, // treat as digraph 'WH'
HC_Wh, // treat as digraph 'WH'
HC_Whg, // treat as digraph 'WH' (for Neu-tx/rx a.k.a Gold/Titanium)

// Pronoun combos. KEEP these together!

Expand Down Expand Up @@ -92,7 +92,7 @@ enum my_combos {
HC_thereg_5gram, // "there" #7 for Gold/Neu
HC_their_5gram, // "their" #6
// HC_theirg_5gram, // "their" #6 for Gold/Neu
HC_this_4gram, // TYPE "this" #8
// HC_this_4gram, // TYPE "this" #8
HC_here_4gram, // TYPE "here" #9
HC_hereg_4gram, // TYPE "here" #9 for Gold/Neu
HC_whereg_5gram, // TYPE "where"
Expand All @@ -111,8 +111,6 @@ enum my_combos {
HC_oughg_4gram, // TYPE "ough" #25



HC_TYPE_JAPAN, // TYPE "Japan" and hold for "ese"

HC_CAPW, // CAPS WORD for all others
FC_CAPS, // CAPS LOCK (others)
Expand All @@ -133,7 +131,7 @@ enum my_combos {
// may repeat if appropriate. (tap_code vs register_code)
//
PC_STAB, // Shift-<tab>
PC_TGNM, // TOGGLE NUM LAYER
PC_TGNM, // TOGGLE NUMLCK on numpad layer
PC_DASH, // – on number layer (keypad)
PC_TILD, // ˜
PC_ELIP, // …
Expand All @@ -156,9 +154,10 @@ enum my_combos {
PC_CLR,
PC_AC,

MYMACRO,
HC_TYPE_ENGLISH, // TYPE "English" and hold for "End of times in 2020"
HC_TYPE_JAPAN, // TYPE "Japan" and hold for "ese"

// HC_2DQUO, // "|" insertion point between double quotes
// HC_2DQUO, // "|" insertion point between double quotes

HC_ACUT, // ´ acute
HC_CIRC, // ˆ circumflex
Expand Down Expand Up @@ -186,9 +185,9 @@ enum my_combos {
FC_SCLP, // Screen Capture Selection to clipboard

HC_ENT,
// HC_ENTg,
HC_ENTg,
HC_SPC,
// HC_SPCg,
HC_SPCg,
HC_CLOZ,
// HC_CLOZg,
HC_QUIT,
Expand Down
Loading

0 comments on commit 8e0e4da

Please sign in to comment.