Closed p-h-a-i-l closed 5 years ago
I think we should go further. The params array could be an array of pointers 256 long. This index could be the code? Then setParamVariable could take a pointer to PARAMSTAT? And still a non-breaking change :).
Unrelated aside: I also think we could/should collect similar 'codes' together under one code, and use the new content passing to break it out further; so command become like a tree... e.g.
{ 0x04, NULL, NULL, UI_NONE, &Position, sizeof(Position), PARAM_RW, fn_Position },
{ 0x05, NULL, NULL, UI_NONE, &PositionIncr, sizeof(PositionIncr), PARAM_RW, fn_PositionIncr },
{ 0x06, NULL, NULL, UI_NONE, &PosnData, sizeof(PosnData), PARAM_RW, fn_preWriteClear },
{ 0x07, NULL, NULL, UI_NONE, &RawPosition, sizeof(RawPosition), PARAM_RW, fn_RawPosition },
could be replace by a single subcmd or 'code', where the first byte of READ/WRITE message determines which of the 4 it's doing? This would be a breaking change only if we remove the old codes right away...
Done my bit - see prs for ascii protocol :). now completely divorced in terms of dependence on main repo!
mods in this repo kept to ascii_protocol.c (mostly). mods in main repo basically a single new file and a couple of calls in main to init... Functions and inits can be moved out of the single file to where the things they refer to are in time, but for the moment, kept it simple.
Ok, my task is clear :)
Remove dependencies of submodule, add functions and variables at runtime. Also see https://github.com/bipropellant/bipropellant-hoverboard-firmware/pull/25.
Just did some entries so you get the idea.
Let me know what you think, not yet a complete solution, since I didn't look at ascii protocol..