dstroy0 / InputHandler

Arduino input handler
https://dstroy0.github.io/InputHandler/
GNU General Public License v3.0
1 stars 0 forks source link

dynamic alloc #27

Closed dstroy0 closed 2 years ago

dstroy0 commented 2 years ago

allocate _data_pointers_ dynamically

since we're doing checks on Parameters for every addCommand already, it would make sense to size this pointer array there

it should be a minimum size of 1(root command) + (greatest Parameters subcommands value) + (greatest number of arguments expected <= UI_MAX_ARGS)

it is not being allocated correctly currently: char *_data_pointers_[UI_MAX_ARGS + 1]; ///< token_buffer pointers

is theoretically insufficient if we allow for root command + max allowed subcommands + max allowed arguments

dstroy0 commented 2 years ago

dynamic ptr alloc achieved, ptr alloc and first init in begin(), reinit NULL every readCommandFromBuffer()

dstroy0 commented 2 years ago

down to 267 bytes global with no output buffer

dstroy0 commented 2 years ago

there are a few variable length array complaints on the rp2040

dstroy0 commented 2 years ago

looks like any warnings have been resolved, closing