Skip to content

Commit

Permalink
Remove some unnecessary variables and spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
plodah committed Aug 30, 2024
1 parent 6c164a6 commit 2bdd159
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 104 deletions.
17 changes: 13 additions & 4 deletions buildmykeyboards.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,28 @@ cd $qmkdir
#Small Dictionary
declare -a usesmalldict=(
"keebio/iris/keymaps/plodah"
"xiudi/xd60/rev3/keymaps/plodah"
"keychron/q1v1/iso_encoder"
"keychron/v2/iso_encoder"
"kprepublic/bm65hsrgb_iso/keymaps/plodah"
"xiudi/xd60/keymaps/plodah"
"ymdk/yd60mq/keymaps/plodah_jpn"
"ymdk/yd60mq/keymaps/plodah_spl"
"ymdk/yd60mq/keymaps/plodah_splbl"
)
qmk generate-autocorrect-data -o $plodir/autocorrect_data_s.h $plodir/dict-small.txt
if [[ -e $plodir/dict-small.txt && -e $plodir/autocorrect_data_s.h && $plodir/dict-small.txt -nt $plodir/autocorrect_data_s.h ]]; then
qmk generate-autocorrect-data -o $plodir/autocorrect_data_s.h $plodir/dict-small.txt
fi

for i in "${usesmalldict[@]}"
do
cp $plodir/autocorrect_data_s.h $usrdir/keyboards/$i/autocorrect_data.h
done
#rm $plodir/autocorrect_data_s.h $plodir/*.bak

#Large Dictionary
qmk generate-autocorrect-data -o $plodir/autocorrect_data.h $plodir/dict-large.txt
rm $plodir/autocorrect_data_s.h $plodir/*.bak
if [[ -e $plodir/dict-large.txt && -e $plodir/autocorrect_data.h && $plodir/dict-large.txt -nt $plodir/autocorrect_data.h ]]; then
qmk generate-autocorrect-data -o $plodir/autocorrect_data.h $plodir/dict-large.txt
fi

#compilationdb
declare -a compilationdbs=(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include QMK_KEYBOARD_H


/* THIS FILE WAS GENERATED!
*
* This file was generated by qmk json2c. You may or may not want to
Expand Down
3 changes: 1 addition & 2 deletions users/plodah/functions/autocorrect.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
uint16_t autocorrect_indicator_timer = 0;
HSV curhsv;
HSV indhsv;
uint8_t useval;

#ifndef PLODAH_AUTOCORRECT_INDICATOR_DURATION
# define PLODAH_AUTOCORRECT_INDICATOR_DURATION 200
Expand Down Expand Up @@ -67,7 +66,7 @@
bool process_autocorrect_user(uint16_t *keycode, keyrecord_t *record, uint8_t *typo_buffer_size, uint8_t *mods) {
# if defined(PLODAH_BORING_LAYER)
if( get_highest_layer(layer_state) == PLODAH_BORING_LAYER){
return false;
return false;
}
# endif // defined(PLODAH_BORING_LAYER)
return true;
Expand Down
125 changes: 59 additions & 66 deletions users/plodah/functions/combos.c
Original file line number Diff line number Diff line change
@@ -1,78 +1,71 @@
#pragma once

#if ! defined(IS_MOUSE)
//===========================//
// COMMON COMBOS //
//===========================//
const uint16_t PROGMEM pl_combo_qa[] = {KC_Q , KC_A, COMBO_END};
const uint16_t PROGMEM pl_combo_bsz[] = {KC_NUBS, KC_Z, COMBO_END};
const uint16_t PROGMEM pl_combo_zx[] = {KC_Z , KC_X, COMBO_END};
const uint16_t PROGMEM pl_combo_xc[] = {KC_X , KC_C, COMBO_END};
const uint16_t PROGMEM pl_combo_cv[] = {KC_C , KC_V, COMBO_END};
const uint16_t PROGMEM pl_combo_xcv[] = {KC_X , KC_C , KC_V, COMBO_END};
const uint16_t PROGMEM pl_combo_tabq[] = {KC_TAB , KC_Q , COMBO_END};
const uint16_t PROGMEM pl_combo_tabw[] = {KC_TAB , KC_W , COMBO_END};
//===========================//
// COMMON COMBOS //
//===========================//
const uint16_t PROGMEM pl_combo_qa[] = {KC_Q , KC_A, COMBO_END};
const uint16_t PROGMEM pl_combo_bsz[] = {KC_NUBS, KC_Z, COMBO_END};
const uint16_t PROGMEM pl_combo_zx[] = {KC_Z , KC_X, COMBO_END};
const uint16_t PROGMEM pl_combo_xc[] = {KC_X , KC_C, COMBO_END};
const uint16_t PROGMEM pl_combo_cv[] = {KC_C , KC_V, COMBO_END};
const uint16_t PROGMEM pl_combo_xcv[] = {KC_X , KC_C , KC_V, COMBO_END};
const uint16_t PROGMEM pl_combo_tabq[] = {KC_TAB , KC_Q , COMBO_END};
const uint16_t PROGMEM pl_combo_tabw[] = {KC_TAB , KC_W , COMBO_END};

//===========================//
// COMBOS FOR DYNAMIC MACROS //
//===========================//
//===========================//
// COMBOS FOR DYNAMIC MACROS //
//===========================//
# if defined(DYNAMIC_MACRO_ENABLE)
const uint16_t PROGMEM pl_combo_12[] = {KC_1 , KC_2, COMBO_END};
const uint16_t PROGMEM pl_combo_13[] = {KC_1 , KC_3, COMBO_END};
const uint16_t PROGMEM pl_combo_qw[] = {KC_Q , KC_W, COMBO_END};
const uint16_t PROGMEM pl_combo_qe[] = {KC_Q , KC_E, COMBO_END};
const uint16_t PROGMEM pl_combo_3e[] = {KC_3 , KC_E, COMBO_END};
# endif //DYNAMIC_MACRO_ENABLE

combo_t key_combos[] = {
COMBO(pl_combo_qa, C(KC_A)),
COMBO(pl_combo_bsz, C(KC_Z)),
COMBO(pl_combo_zx, C(KC_X)),
COMBO(pl_combo_xc, C(KC_C)),
COMBO(pl_combo_cv, C(KC_V)),
COMBO(pl_combo_xcv, C(S(KC_V))),
COMBO(pl_combo_tabq, PL_ALTSTAB),
COMBO(pl_combo_tabw, PL_ALTTAB),
# if defined(DYNAMIC_MACRO_ENABLE)
const uint16_t PROGMEM pl_combo_12[] = {KC_1 , KC_2, COMBO_END};
const uint16_t PROGMEM pl_combo_13[] = {KC_1 , KC_3, COMBO_END};
const uint16_t PROGMEM pl_combo_qw[] = {KC_Q , KC_W, COMBO_END};
const uint16_t PROGMEM pl_combo_qe[] = {KC_Q , KC_E, COMBO_END};
const uint16_t PROGMEM pl_combo_3e[] = {KC_3 , KC_E, COMBO_END};
COMBO(pl_combo_12, DM_PLY1),
COMBO(pl_combo_13, DM_REC1),
COMBO(pl_combo_qw, DM_PLY2),
COMBO(pl_combo_qe, DM_REC2),
COMBO(pl_combo_3e, DM_RSTP),
# endif //DYNAMIC_MACRO_ENABLE
};

combo_t key_combos[] = {
COMBO(pl_combo_qa, C(KC_A)),
COMBO(pl_combo_bsz, C(KC_Z)),
COMBO(pl_combo_zx, C(KC_X)),
COMBO(pl_combo_xc, C(KC_C)),
COMBO(pl_combo_cv, C(KC_V)),
COMBO(pl_combo_xcv, C(S(KC_V))),
COMBO(pl_combo_tabq, PL_ALTSTAB),
COMBO(pl_combo_tabw, PL_ALTTAB),
# if defined(DYNAMIC_MACRO_ENABLE)
COMBO(pl_combo_12, DM_PLY1),
COMBO(pl_combo_13, DM_REC1),
COMBO(pl_combo_qw, DM_PLY2),
COMBO(pl_combo_qe, DM_REC2),
COMBO(pl_combo_3e, DM_RSTP),
# endif //DYNAMIC_MACRO_ENABLE
};

//===========================//
// MOUSE COMBOS //
//===========================//
//===========================//
// MOUSE COMBOS //
//===========================//
#else // ! defined(IS_MOUSE)
const uint16_t PROGMEM pl_combo_ms12[] = {KC_BTN1 , KC_BTN2, COMBO_END};
const uint16_t PROGMEM pl_combo_ms14[] = {KC_BTN1 , KC_BTN4, COMBO_END};
const uint16_t PROGMEM pl_combo_ms24[] = {KC_BTN2 , KC_BTN4, COMBO_END};
const uint16_t PROGMEM pl_combo_ms15[] = {KC_BTN1 , KC_BTN5, COMBO_END};
const uint16_t PROGMEM pl_combo_ms25[] = {KC_BTN2 , KC_BTN5, COMBO_END};
const uint16_t PROGMEM pl_combo_ms12[] = {KC_BTN1 , KC_BTN2, COMBO_END};
const uint16_t PROGMEM pl_combo_ms14[] = {KC_BTN1 , KC_BTN4, COMBO_END};
const uint16_t PROGMEM pl_combo_ms24[] = {KC_BTN2 , KC_BTN4, COMBO_END};
const uint16_t PROGMEM pl_combo_ms15[] = {KC_BTN1 , KC_BTN5, COMBO_END};
const uint16_t PROGMEM pl_combo_ms25[] = {KC_BTN2 , KC_BTN5, COMBO_END};

combo_t key_combos[] = {
COMBO(pl_combo_ms12, DRAG_SCROLL),
COMBO(pl_combo_ms14, DRAG_SCROLL),
COMBO(pl_combo_ms24, DRAG_SCROLL),
COMBO(pl_combo_ms15, C(KC_C)),
COMBO(pl_combo_ms25, C(KC_V)),
};
combo_t key_combos[] = {
COMBO(pl_combo_ms12, DRAG_SCROLL),
COMBO(pl_combo_ms14, DRAG_SCROLL),
COMBO(pl_combo_ms24, DRAG_SCROLL),
COMBO(pl_combo_ms15, C(KC_C)),
COMBO(pl_combo_ms25, C(KC_V)),
};
#endif // ! defined(IS_MOUSE)
#ifdef PLODAH_BORING_LAYER
void plodah_layerchange_comboactions(layer_state_t state){
switch (get_highest_layer(state)) {
case PLODAH_BORING_LAYER:
if(is_combo_enabled()){
combo_disable();
}
break;
default:
if(! is_combo_enabled()){
combo_enable();
}
break;

bool combo_should_trigger(uint16_t combo_index, combo_t *combo, uint16_t keycode, keyrecord_t *record) {
# if defined(PLODAH_BORING_LAYER )
if(layer_state_is(PLODAH_BORING_LAYER)){
return false;
}
# endif // PLODAH_BORING_LAYER
return true;
}
#endif // PLODAH_BORING_LAYER
34 changes: 15 additions & 19 deletions users/plodah/functions/mods_on_knob.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#pragma once
uint8_t current_layer;
uint8_t mod_state;

void enc_prs_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
current_layer = get_highest_layer(layer_state);
mod_state = get_mods();

if (ctl_pressed && alt_pressed && sft_pressed) {
Expand Down Expand Up @@ -43,18 +41,18 @@ void enc_prs_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
register_mods(mod_state);
}
else if (
((current_layer + PLODAH_LAYEROFFSET) % 2 == 1)
((get_highest_layer(layer_state) + PLODAH_LAYEROFFSET) % 2 == 1)
# if defined(PLODAH_BORING_LAYER)
&& (current_layer != PLODAH_BORING_LAYER)
&& (get_highest_layer(layer_state) != PLODAH_BORING_LAYER)
# endif // PLODAH_BORING_LAYER
) {
rgb_matrix_toggle();
}
else if (
((current_layer + PLODAH_LAYEROFFSET) % 2 == 0)
&& (current_layer != 0)
((get_highest_layer(layer_state) + PLODAH_LAYEROFFSET) % 2 == 0)
&& (get_highest_layer(layer_state) != 0)
# if defined(PLODAH_BORING_LAYER)
&& (current_layer != PLODAH_BORING_LAYER)
&& (get_highest_layer(layer_state) != PLODAH_BORING_LAYER)
# endif // PLODAH_BORING_LAYER
) {
rgb_matrix_toggle();
Expand All @@ -67,7 +65,6 @@ void enc_prs_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
}

void enc_ccw_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
current_layer = get_highest_layer(layer_state);
mod_state = get_mods();

if (ctl_pressed && alt_pressed && sft_pressed) {
Expand Down Expand Up @@ -104,18 +101,18 @@ void enc_ccw_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
register_mods(mod_state);
}
else if (
((current_layer + PLODAH_LAYEROFFSET) % 2 == 1)
((get_highest_layer(layer_state) + PLODAH_LAYEROFFSET) % 2 == 1)
# if defined(PLODAH_BORING_LAYER)
&& (current_layer != PLODAH_BORING_LAYER)
&& (get_highest_layer(layer_state) != PLODAH_BORING_LAYER)
# endif // PLODAH_BORING_LAYER
) {
rgb_matrix_decrease_sat();
}
else if (
((current_layer + PLODAH_LAYEROFFSET) % 2 == 0)
&& (current_layer != 0)
((get_highest_layer(layer_state) + PLODAH_LAYEROFFSET) % 2 == 0)
&& (get_highest_layer(layer_state) != 0)
# if defined(PLODAH_BORING_LAYER)
&& (current_layer != PLODAH_BORING_LAYER)
&& (get_highest_layer(layer_state) != PLODAH_BORING_LAYER)
# endif // PLODAH_BORING_LAYER
) {
rgb_matrix_decrease_val();
Expand All @@ -128,7 +125,6 @@ void enc_ccw_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
}

void enc_cw_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
current_layer = get_highest_layer(layer_state);
mod_state = get_mods();

if (ctl_pressed && alt_pressed && sft_pressed) {
Expand Down Expand Up @@ -165,18 +161,18 @@ void enc_cw_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
register_mods(mod_state);
}
else if (
((current_layer + PLODAH_LAYEROFFSET) % 2 == 1)
((get_highest_layer(layer_state) + PLODAH_LAYEROFFSET) % 2 == 1)
# if defined(PLODAH_BORING_LAYER)
&& (current_layer != PLODAH_BORING_LAYER)
&& (get_highest_layer(layer_state) != PLODAH_BORING_LAYER)
# endif // PLODAH_BORING_LAYER
) {
rgb_matrix_increase_sat();
}
else if (
((current_layer + PLODAH_LAYEROFFSET) % 2 == 0)
&& (current_layer != 0)
((get_highest_layer(layer_state) + PLODAH_LAYEROFFSET) % 2 == 0)
&& (get_highest_layer(layer_state) != 0)
# if defined(PLODAH_BORING_LAYER)
&& (current_layer != PLODAH_BORING_LAYER)
&& (get_highest_layer(layer_state) != PLODAH_BORING_LAYER)
# endif // PLODAH_BORING_LAYER
) {
rgb_matrix_increase_val();
Expand Down
12 changes: 0 additions & 12 deletions users/plodah/plodah.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,6 @@
# include "functions/combos.c"
#endif // COMBO_ENABLE

//========================//
// LAYER CHANGE //
//========================//
#if defined(PLODAH_BORING_LAYER )
layer_state_t layer_state_set_user(layer_state_t state) {
# if defined(PLODAH_BORING_LAYER )
plodah_layerchange_comboactions(state);
# endif // PLODAH_BORING_LAYER
return state;
}
#endif // PLODAH_BORING_LAYER

//==============================//
// KEYCHRON DIPSWITCH //
//==============================//
Expand Down

0 comments on commit 2bdd159

Please sign in to comment.