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

Use fresh_install and keymap_all.h now generates a function, sval_ini… #81

Open
wants to merge 1 commit into
base: vial
Choose a base branch
from

Conversation

captdeaf
Copy link

So there's one hook where we can figure out if it's a fresh install or not: via_init_kb(), on a fresh flashing of the hardware, has an invalid via_eeprom.

I've modified Keybard's keymap_all.h to generate a function, sval_init_defaults(), which is called to repopulate everything other than the keymaps. It works for macros, tap dances, combos, and key overrides.

Even if I need to add more features to keymap_all.h, sval_init_defaults() should handle it without any further changes to vial-qmk.

@captdeaf
Copy link
Author

captdeaf commented Oct 29, 2024

This is what keymap_all.h looks like to accompany this patch:

const uint16_t PROGMEM keymaps[DYNAMIC_KEYMAP_LAYER_COUNT][MATRIX_ROWS][MATRIX_COLS] = {

    [0] = LAYOUT(...),
    ...
}

void sval_init_defaults(void) {

uint8_t sval_macros[] = {104,101,108,108,111,32,116,104,101,114,101,0,1,5,19,4,1,4,46,2,120,109, ...};
dynamic_keymap_macro_set_buffer(0, 143, sval_macros);

vial_tap_dance_entry_t td = (vial_tap_dance_entry_t) {0, 0, 0, 0, 0};
td = (vial_tap_dance_entry_t) {1, 24, 18, 14, 200};
dynamic_keymap_set_tap_dance(0, &td);
td = (vial_tap_dance_entry_t) {20992, 21025, 0, 0, 300};
dynamic_keymap_set_tap_dance(1, &td);

vial_combo_entry_t cmb = (vial_combo_entry_t) {{0, 0, 0, 0}, 0};
cmb = (vial_combo_entry_t) {{22,4,7,8}, 9};
dynamic_keymap_set_combo(0, &cmb);

vial_key_override_entry_t ko = (vial_key_override_entry_t) {0};
ko = (vial_key_override_entry_t) {8,8,65535,0,0,17,135};
dynamic_keymap_set_key_override(0, &ko);

}

@captdeaf captdeaf force-pushed the keymap-all-complete branch from 5adb685 to 0a8b4d3 Compare November 10, 2024 17:52
@ilc
Copy link
Collaborator

ilc commented Nov 11, 2024

Code looks harmless. Just need to test that it works.

@captdeaf
Copy link
Author

Current version of keybard at https://captdeaf.github.io/keybard generates the appropriate keymap_all.h

To use it:

  1. Merge this PR.
  2. Connect to keybard, select MENU->Dev options->Download keymap_all.h
  3. Put keybard's keymap_all.h alongside keymap_support.c
  4. Compile as normal.
  5. Witness your keymap being the same after you flash it =).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants