OpenBK7231T_App icon indicating copy to clipboard operation
OpenBK7231T_App copied to clipboard

Rework pins and roles

Open MaxineMuster opened this issue 1 year ago • 0 comments

Actually properties of a role are in different files and places, mainly this two: typedef enum ioRole_e in file "new_pins.h" const char* htmlPinRoleNames[] in file "new_html.c"

This definition now also "hard-codes" the properties

  • "number of channels" used by a role ("computed" by PIN_IOR_NofChan())
  • the functionality of a role (e.g. IS_PIN_DHT_ROLE())

(this can be discussed, I think its easier to code this than to add another condition to the code "calculating" it)

The idea of this PR is to bring all together in one file, (hopefully) making it easier to maintain or e.g. add a new sensor (role) to the code.

Therefore I introduced the file "pins_and_roles.h":

It holds all of the above properties of a role.

It also contains some macros, to generate the needed enum to match the actual implementation (every role is an int corresponding to an enum entry ) and an array of strut for the name of the role (in HTTP page) plus number of channels and functionality.

To be tested is the function of "getommands.js" - I'm not sure, if/how I can test if docs are build correctly...

MaxineMuster avatar Oct 03 '24 15:10 MaxineMuster