UltimateHackingKeyboard / firmware

Ultimate Hacking Keyboard firmware
Other
420 stars 66 forks source link

maximum number of variables = 536935944 ?? -- weird errors when saving complex configs #798

Open mhantsch opened 2 months ago

mhantsch commented 2 months ago

After changing my config a few times, when I saved it, I got this error:

Error at hrm-auto 1/1/8: Too many variables. Can't allocate more than 536935944 variables:
> 1 | [setVar hrm_active 1](https://github.com/UltimateHackingKeyboard/firmware/issues/new#/macro/13?actionIndex=0&lineNr=1&columnNr=8&inlineEdit=true)
>   |        ^

Even after deleting what I had previously added, and re-saving the config, I kept getting errors about exceeding the number of variables. But I had reverted the change, and also my previous change did not add new variables, just reuse (setVar) one of them in some new macros.

Clearly something has been corrupted in memory, as the arbitrary large number in the error message does not make any sense.

I was only able to get the keyboard to work normally again by power cycling it. After that, it behaved normally again. When I tried loading that same config again into the UHK (Save from Agent), the keyboard went dark (LED) and did not react at all. After another power cycle it came back up with that new config loaded, and it worked fine.

I am wondering if some memory corruption is going on during Save. I also experience the problem that while the config is being updated, and variables are cleared, currently running macros seem to continue to run with all sorts of strange side effects (undefined variables, error messages popping up for arguably unrelated code...). Something is awkward.

Sorry I can't pinpoint this better. I've spent an hour or so trying to find a specific cause, but it's not consistent.