feat(storage): auto-detect layout changes and re-initialize storage#765
Open
Raymond8196 wants to merge 1 commit intoHaoboGu:mainfrom
Open
feat(storage): auto-detect layout changes and re-initialize storage#765Raymond8196 wants to merge 1 commit intoHaoboGu:mainfrom
Raymond8196 wants to merge 1 commit intoHaoboGu:mainfrom
Conversation
Binary Size Reportuse_config/nrf52832_bleDiffuse_config/nrf52840_bleDiffuse_config/nrf52840_ble_splitDiffCentral DiffPeripheral Diffuse_rust/nrf52840_ble_splitDiffCentral DiffPeripheral Diffuse_config/pi_pico_w_bleDiffuse_config/pi_pico_w_ble_splitDiffCentral DiffPeripheral Diffuse_rust/pi_pico_w_ble_splitDiffCentral DiffPeripheral Diffuse_config/rp2040Diffuse_config/rp2040_splitDiffCentral DiffPeripheral Diffuse_rust/rp2040_splitDiffCentral DiffPeripheral Diffuse_config/stm32f1Diffuse_config/stm32f4Diffuse_config/stm32h7Diff |
Owner
| This doesn't solve the issue. It's rare that the col/row/num_layer/num_encoder changes, what's more common is to update the keymap/config. Currently if the layout changes, the keyboard will auto re-initialize the storage and reboot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When users change layers, rows, cols, or encoder count in keyboard.toml and reflash, the old stored keymap in flash persists and causes incorrect behavior (e.g., Vial showing wrong layer count). Currently the only workaround is manually setting clear_storage = true for one flash cycle, which is error-prone and hard to discover.
This PR replaces the unused BUILD_HASH mechanism with a layout structure hash that automatically detects incompatible changes and re-initializes storage.
Changes
Design Decisions