Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make qmk_settings respect AUTO_SHIFT definitions. #225

Open
wants to merge 1 commit into
base: vial
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions builddefs/common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ endif

ifeq ($(strip $(QMK_SETTINGS)), yes)
AUTO_SHIFT_ENABLE := yes
AUTO_SHIFT_DISABLED_AT_STARTUP := yes
SRC += $(QUANTUM_DIR)/qmk_settings.c
OPT_DEFS += -DQMK_SETTINGS \
-DAUTO_SHIFT_NO_SETUP -DAUTO_SHIFT_REPEAT_PER_KEY -DAUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY \
Expand Down
25 changes: 24 additions & 1 deletion quantum/qmk_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,30 @@ void qmk_settings_init(void) {

void qmk_settings_reset(void) {
QS.grave_esc_override = 0;
QS.auto_shift = 0;
QS.auto_shift = (
0
#ifndef AUTO_SHIFT_DISABLED_AT_STARTUP
| _QS_auto_shift_enable_bit
#endif
#ifdef AUTO_SHIFT_MODIFIERS
| _QS_auto_shift_modifiers_bit
#endif
#ifdef NO_AUTO_SHIFT_SPECIAL
| _QS_auto_shift_no_auto_shift_special_bit
#endif
#ifdef NO_AUTO_SHIFT_NUMERIC
| _QS_auto_shift_no_auto_shift_numeric_bit
#endif
#ifdef NO_AUTO_SHIFT_ALPHA
| _QS_auto_shift_no_auto_shift_alpha_bit
#endif
#ifdef AUTO_SHIFT_REPEAT
| _QS_auto_shift_repeat_bit
#endif
#ifdef AUTO_SHIFT_NO_AUTO_REPEAT
| _QS_auto_shift_no_auto_repeat_bit
#endif
);
QS.auto_shift_timeout = AUTO_SHIFT_TIMEOUT;
QS.osk_tap_toggle = ONESHOT_TAP_TOGGLE;
QS.osk_timeout = ONESHOT_TIMEOUT;
Expand Down
22 changes: 15 additions & 7 deletions quantum/qmk_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,21 @@ extern qmk_settings_t QS;
#define QS_grave_esc_shift_override (QS.grave_esc_override & 8)

/* Auto shift */
#define QS_auto_shift_enable (QS.auto_shift & 1)
#define QS_auto_shift_modifiers (QS.auto_shift & 2)
#define QS_auto_shift_no_auto_shift_special (QS.auto_shift & 4)
#define QS_auto_shift_no_auto_shift_numeric (QS.auto_shift & 8)
#define QS_auto_shift_no_auto_shift_alpha (QS.auto_shift & 16)
#define QS_auto_shift_repeat (QS.auto_shift & 32)
#define QS_auto_shift_no_auto_repeat (QS.auto_shift & 64)
#define _QS_auto_shift_enable_bit 1
#define _QS_auto_shift_modifiers_bit 2
#define _QS_auto_shift_no_auto_shift_special_bit 4
#define _QS_auto_shift_no_auto_shift_numeric_bit 8
#define _QS_auto_shift_no_auto_shift_alpha_bit 16
#define _QS_auto_shift_repeat_bit 32
#define _QS_auto_shift_no_auto_repeat_bit 64

#define QS_auto_shift_enable (QS.auto_shift & _QS_auto_shift_enable_bit)
#define QS_auto_shift_modifiers (QS.auto_shift & _QS_auto_shift_modifiers_bit)
#define QS_auto_shift_no_auto_shift_special (QS.auto_shift & _QS_auto_shift_no_auto_shift_special_bit)
#define QS_auto_shift_no_auto_shift_numeric (QS.auto_shift & _QS_auto_shift_no_auto_shift_numeric_bit)
#define QS_auto_shift_no_auto_shift_alpha (QS.auto_shift & _QS_auto_shift_no_auto_shift_alpha_bit)
#define QS_auto_shift_repeat (QS.auto_shift & _QS_auto_shift_no_auto_repeat_bit)
#define QS_auto_shift_no_auto_repeat (QS.auto_shift & _QS_auto_shift_no_auto_repeat_bit)

/* One Shot Keys */
#define QS_oneshot_tap_toggle (QS.osk_tap_toggle)
Expand Down