Rely on introspection to handle OOB access. (#21247)
This commit is contained in:
parent
88d9b7ee31
commit
6c7c5889ca
|
@ -152,22 +152,13 @@ void dynamic_keymap_reset(void) {
|
|||
for (int layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++) {
|
||||
for (int row = 0; row < MATRIX_ROWS; row++) {
|
||||
for (int column = 0; column < MATRIX_COLS; column++) {
|
||||
if (layer < keymap_layer_count()) {
|
||||
dynamic_keymap_set_keycode(layer, row, column, keycode_at_keymap_location_raw(layer, row, column));
|
||||
} else {
|
||||
dynamic_keymap_set_keycode(layer, row, column, KC_TRANSPARENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef ENCODER_MAP_ENABLE
|
||||
for (int encoder = 0; encoder < NUM_ENCODERS; encoder++) {
|
||||
if (layer < encodermap_layer_count()) {
|
||||
dynamic_keymap_set_encoder(layer, encoder, true, keycode_at_encodermap_location_raw(layer, encoder, true));
|
||||
dynamic_keymap_set_encoder(layer, encoder, false, keycode_at_encodermap_location_raw(layer, encoder, false));
|
||||
} else {
|
||||
dynamic_keymap_set_encoder(layer, encoder, true, KC_TRANSPARENT);
|
||||
dynamic_keymap_set_encoder(layer, encoder, false, KC_TRANSPARENT);
|
||||
}
|
||||
}
|
||||
#endif // ENCODER_MAP_ENABLE
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue