BlueAndi / vscp-arduino

Very Simple Control Protocol (VSCP) Level 1 Library for the arduino IDE.
Other
14 stars 10 forks source link

Question not an Issue :) #8

Open michpro opened 1 month ago

michpro commented 1 month ago

Great library :) Do you have any example using decision matrix? Is it enough to send the corresponding values e.g. through the VSCP works program (with the corresponding mdf file of course) and in the program only handle the actions in the callback 'void actionExecute(unsigned char action, unsigned char par, vscp_RxMessage const * const msg)' or does something else need to be added?

BlueAndi commented 1 month ago

You need to configure the decision matrix itself. You can do this via code or via a tool. Don't forget to enable each decision matrix row otherwise its not considered. :-)

One decision matrix row looks like: https://github.com/BlueAndi/vscp-framework/blob/6c6e339a009bc2cddff1ce315198a8be0734a48a/src/vscp_dm.h#L135-L147

Via code:

void configureDM()
{
    vscp_dm_MatrixRow   rows[2];
    uint8_t*            data    = (uint8_t*)rows;

    /* Row 0 */
    rows[0].oaddr = ...
    rows[0].flags = ...
    rows[0].classMask = ...
    rows[0].classFilter = ...
    rows[0].typeMask = ...
    rows[0].typeFilter = ...
    rows[0].action = ...
    rows[0].actionPar= ...

    /* Row 1 */
    ...

    /* Write to persistent memory. */
    vscp_ps_writeDMMultiple(0, data, sizeof(rows));
}