For example, the total number of key actions available to macros defined in Via can be increased from about 150 to use most of the free flash memory, using emulated EEPROM memory (or possibly be limited by the RAM (used to back the emulated EEPROM memory)).
On the Keychron V5, this increased the total number of key actions to about 2,300 key actions by changing the default 2 KB to 20 KB. The maximum is about 8,000 key actions for this keyboard, depending on the configuration of QMK.
There doesn’t seem to be an inherent limit to the number of key actions per macros (other than the total number of key actions). I have tested it with one of my standard (and heavily used) macros with 220 key actions.
Note: For this to work on newer Keychron keyboards, including the K Pro series, it requires newer source code, January 2024 or later, currently in Git branch “wireless_playground“ in Keychron’s fork of the official QMK repository. Newer Keychron keyboards include Q1 Max, Q2 Max, Q3 Max, Q5 Max, Q6 Max, Q8 Max, K1 Max, K3 Max, K5 Max, K7 Max, V1 Max, V2 Max, V5 Max, Q60 Max, Q65 Max, Q13 Pro, K1 Pro, K2 Pro, K3 Pro, K4 Pro, K5 Pro, K6 Pro, K7 Pro, K8 Pro, K9 Pro, K10 Pro, K11 Pro, K12 Pro, K13 Pro, K14 Pro, K15 Pro, Q1 Pro, Q2 Pro, Q3 Pro, Q4 Pro, Q5 Pro, Q6 Pro, Q8 Pro, Q10 Pro, Q13 Pro, and Q14 Pro.
How-to
In file config.h, change
#define WEAR_LEVELING_LOGICAL_SIZE 2048
to:
#define WEAR_LEVELING_LOGICAL_SIZE 20480
Then recompile and flash the QMK firmware.
This increases the total (emulated) EEPROM size tenfold. The number of key actions available in Via changes even more than tenfold (as there is a fixed overhead due to EEPROM memory used for other purposes in QMK). Approximately 13 times more key actions are available after the change compared to the default values.
How does it work?
Instead of being restricted to the very limited size of physical EEPROM memory, EEPROM memory can instead be emulated by using the free flash memory not used by the QMK firmware. This is a feature built into QMK.
On a Keychron V5, there is typically, depending on compile-time configuration, etc., about 70 KB left for this purpose. In fact, the microcontroller in Keychron V5 doesn’t have any onboard EEPROM, so EEPROM memory must be emulated in flash memory.
There is a reserved size for this use of the free flash memory, but it can be increased as described above. But note that, due to internal limitations in QMK, the maximum size of the emulated EEPROM for use by Via is 65535 bytes (see source file quantum/dynamic_keymap.c).
But they are still crippled
For instance, mouse actions (say, right click) are not supported in macros. Such macros must be defined in C code in QMK. Or a hack must be applied.
There are only 16 macros and it is not possible to give them a name to remember what they do. This must be documented somewhere else, e.g., in a text document (and updated whenever the Via macros are changed or extended).
Though it is actually quite simple to increase the number of macros from the default 16. It just isn’t documented anywhere (perhaps only in an indirect sense). It is essentially adding this line in config.h (to increase the number of macros in Via to 40):
#define DYNAMIC_KEYMAP_MACRO_COUNT 42