-
-
Notifications
You must be signed in to change notification settings - Fork 40.5k
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
Keymap config ram #18373
Keymap config ram #18373
Conversation
55c3115
to
6bcf1aa
Compare
You need to select |
sigprof: sorry. I just rebased to the latest develop. |
@@ -47,7 +47,9 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) { | |||
case MAGIC_TOGGLE_CONTROL_CAPSLOCK: | |||
case MAGIC_SWAP_ESCAPE_CAPSLOCK ... MAGIC_TOGGLE_ESCAPE_CAPSLOCK: | |||
/* keymap config */ | |||
#ifndef KEYMAP_CONFIG_RAM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be better in the eeconfig_(read/update)_keymap function itself, since there are other places that these functions are called (bootmagic used to be one place, but the steno keycode in the planck, for instance).
quantum/keycode_config.c
Outdated
@@ -16,7 +16,9 @@ | |||
|
|||
#include "keycode_config.h" | |||
|
|||
extern keymap_config_t keymap_config; | |||
#ifdef KEYMAP_CONFIG_RAM | |||
keymap_config_t keymap_config; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the magic.c declaration isn't changed, this will error out on complication, I think.
After good night sleep, I realized the changes to keycode_config.c is not needed for this PR purpose. (Though I still think it is redundant.) I will force squashed patch for easier review. |
If KEYMAP_CONFIG_RAM is defined, keymap_config is stored as a non-persistent global variable on RAM instead of a persistent global variable on EEPROM. So for every power-on, we can reset the keymap_config settings to its default values. Signed-off-by: Osamu Aoki <[email protected]>
708f5f4
to
14d07ce
Compare
This is now a single file patch with 4 lines: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, just removing the EEPROM operations from process_magic()
does not fix the problem completely, because keymap_config
also contains flags used by other features, and some other code also can call eeconfig_update_keymap()
:
autocorrect_enable()
,autocorrect_disable()
,autocorrect_toggle()
;oneshot_set()
,oneshot_enable()
,oneshot_disable()
,oneshot_toggle()
.
Also keeping the nkro
flag persistent could be useful.
So if the intent here is “force the power-on state of the magic keycode modifications to be off”, this may need to be done inside eeconfig_read_keymap()
and eeconfig_update_keymap()
instead (if we keep the current EEPROM layout).
Thank you for your contribution! |
Thank you for your contribution! |
Provide an optional feature to keymap_config data to be non-persistent.
This means keyboard always turn on to its default map without surprize of swapped keys but you still retain capability to swap via quantum keycode.
Description
This is an implementation of my comment posted as
#18353 (comment)
Instead of storing the keymap_config struct in eeprom, this enables user to select storing it in RAM if KEYMAP_CONFIG_RAM is defined.
The QMK behavior doesn't change for existing keyboards.
Types of Changes
Issues Fixed or Closed by This PR
No more surprise for some swapped keys. At least, power-on reset them all.
Checklist