max4elektroda wrote:So my idea is to put this all together in one place - maybe an array of a struct containing all information in one place.
That will be quite some work to implement and change all functions using this.
But it would mean there is only one place to maintain.
It really took a very long time to finally find an approach to maintain the actual (good) approach to store a pins role as char, using "enum ioRole_e" to define them.
So you always have to define a "parallel" implementation (regarding the index) e.g. to hold the names used in HTML code.
I finally found a way to generate the enum from a file containing the other information/properties, too.
So in PR#1378 is a first implementation:
The enum is not directly present as code, but generated by a macro
All information present is generated from the original sources, so it should be consistent.
My "test" was to compare the resulting web-page (var r = ...).
This var is generated by use of "enum", the HTML-name and th number of channels and is equal (exept the one fix I made that "BL0937SEL_n" also needs "0" channels (it was defined for 1 before).
So, I'm quite sure the code works as expected now, but would be glad to get some feedback. Maybe you find the approach only stupid, think this can be made much smarter...
And there is on thing I don't know how to check:
The documentation is generated by "getcommands.js" - I tried change this, too, but how to check?!?