-
-
Notifications
You must be signed in to change notification settings - Fork 39.9k
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
Allow QMK to save a single default layers in the full range of 0-31 #22933
Conversation
Thank you for your contribution! |
d59ad16
to
f3f1748
Compare
Rebased on develop after merge of #23436 which implemented all the keymap cleanup changes; what remains of this PR is much smaller and focused on the primary goal of changing how eeconfig saves the default layer information. I'm not sure if EECONFIG_MAGIC_NUMBER should decremented once per breaking changes release, or if it is decremented anytime a change is made to eeconfig storage implementation (in which case I would need to add in another decrement). |
There's a bit of debate internally as to whether or not we should reshuffle the |
Thank you for your contribution! |
Thank you for your contribution! |
#if defined(DEFAULT_LAYER_BITMASK_ENABLE) | ||
default_layer_state = (layer_state_t)1 << 0; | ||
#else | ||
default_layer_state = 0; | ||
#endif | ||
eeprom_update_byte(EECONFIG_DEFAULT_LAYER, default_layer_state); |
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.
Setting the global default_layer_state
to zero would be incorrect as its expected to be a bitmask of enabled layers, and should probably look more like...
#if defined(DEFAULT_LAYER_BITMASK_ENABLE) | |
default_layer_state = (layer_state_t)1 << 0; | |
#else | |
default_layer_state = 0; | |
#endif | |
eeprom_update_byte(EECONFIG_DEFAULT_LAYER, default_layer_state); | |
default_layer_state = (layer_state_t)1 << 0; | |
#if defined(DEFAULT_LAYER_BITMASK_ENABLE) | |
eeprom_update_byte(EECONFIG_DEFAULT_LAYER, default_layer_state); | |
#else | |
eeprom_update_byte(EECONFIG_DEFAULT_LAYER, 0); | |
#endif |
Description
Currently QMK saves the default layer persistently through EECONFIG as an 8-bit wide bit field which allows for saving multiple simultaneous default layers, but only for layers 0 through 7. This PR adds the ability to save the default layer as a value instead of a bit field, so that layers 0 through 31 can be the default layer, subject to the constraint that there is only one default layer selected at a time.
Pull request #21881 is written to allow default layers in the range from 0 to 31, but that is currently not possible with the existing implementation. Functions like
set_single_persistent_default_layer
indicate that the more common use case is a single default layer. There are no instances of multiple default layers being saved in the QMK repository, but there is awareness of one instance of multiple default layers being used in the recently removed user code.This PR changes the default/presumed paradigm to a single default layer, and the original bit field method can be the re-enabled with
#define DEFAULT_LAYER_BITMASK_ENABLE
. If desired, I can update the PR to preserve the original implementation by default instead.Additionally:
All bespoke implementations that save default layers by callingRemoved from this PR, was implemented in Tidy up default layer handling in keymaps #23436eeconfig_update_default_layer
to set a single layer have been replaced with API calls toset_single_persistent_default_layer
EECONFIG magic number has been decrementedNo longer decremented as a decrement has already been performed for this breaking chances cycleTypes of Changes
Issues Fixed or Closed by This PR
Checklist