Configuration too big to persist. Dual Pico

The macros all display exactly as they should on the web config .

Trying to save config to device I get that message.

I’m using my own build which allows (until now) 110 Macros.

It was all good up to about 40 or so macros. It was rather tedious setting them up so I ended up editing a config file directly.

The 80 macros each resemble this snippet:

[
            [
                "0x000700e0",
                "0x00070014"
            ],
            [
                "0x000700e0",
                "0x00070027"
            ],
            [],
            [
                "0x000700e0",
                "0x00070025"
            ],
            [],
            [   "0x000700e0",
                "0x00070027"
            ]
        ]

Is there a limit somewhere in the source code that I can alter, or is it a hardware limitation of the PICO?

The persisted configuration size is limited to 4096 bytes. You can try changing PERSISTED_CONFIG_SIZE in CMakeLists.txt, but I haven’t tried it. Probably needs to be a multiple of 4096.

@jfedor Thanks, see below, I’ll try your suggestion if I hit the same problem again as I add functionality to my project.

I have got it working (without rebuilding) as follows:

I’ve shrunk the output of my macros, there were a lot of unnecessary keys. In the snippet I’ve shown, there’s a ‘nothing’ ([]) entry between two disimilar outputs - not necessary. There were 71 of those.

I also realised that 4 keys were not needed, only three. that alone is 160 less commands, so with the above I’ve removed 231 commands.

Thanks

Phil

@jfedor

The persisted configuration size is limited to 4096 bytes. You can try changing PERSISTED_CONFIG_SIZE in CMakeLists.txt

I have an issue when using

add_compile_definitions(PERSISTED_CONFIG_SIZE=16384) 

I am able to upload my huge macros while my hid remapper is connected. And the program is able to execute every macro. But when I replug the hid-remapper into my PC, the device disappears and the web console configuration tool can’t find it. Then I need to flash a ‘nuke_universal.uf2’ from rpi’s website and reflash my recompiled hid-remapper again. But replugging causes the same issue again, so I need to reflash ‘nuke_universal.uf2’ everytime.

Is there something we need to delay for the config to load fully? I think 16 KB is enough since pico has 2 MB of flash. Also, I noticed if I upload a smaller config via web tool, then replugging works, so this seems to be tied to a large json config. But to get past the “Configuration too big to persist” when uploading my big json file, increasing PERSISTED_CONFIG_SIZE=16384 was required.

I don’t know, maybe it’s hitting some other limit or running out of memory, though in theory it shouldn’t if the macros work after loading the configuration before you unplug. Share the JSON file if there’s no sensitive data inside.

Hi @jfedor,

Here is my config (wasn’t able to upload here since new user), massive-macros-hid-remapper-config.json - Pastebin.com

This is a “Scroll 3-Macro Cycler”.

  1. Open a notepad and scroll. It will cycle through 3 big strings.
  2. The right button will reset back to macro 1 on next scroll.
  3. Long pressing right button will send an ‘Enter’ key.

When done testing, replug from PC side, and see if hid remapper is not detected.

I’ve noticed this happens when the macro is too big. If we distribute the big string among more macros, then it may work. But I want each macro to have big strings.

Okay, I think I can see what’s going on.

Macros are actually limited to 255 entries in the configuration saved to flash (there’s one byte for macro length). However there is no such limit in memory and this is not enforced correctly when persisting the config to flash. As a result at some point when loading config from flash it starts reading garbage and tries to allocate too much memory and crashes.

(Your macros have like 900+ entries from what I can see.)

there’s one byte for macro length

Is it possible to make a code change?

And side question, is it possible to increase the number of registers to 64?