BlueAndi / vscp-arduino

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

Getting started with dumb nodes #4

Closed mathansen closed 1 year ago

mathansen commented 1 year ago

Hi Andreas,

first of all - congratulations to an amazing project! I stumbled upon your work while researching solutions to build a CAN-based "smart home" system for my camper van.

I managed to get the library (and the generic example) running on a Adafruit Feather M4 CAN Express board. I am able to send events by manually invoking functions like vscp_evt_information_sendButton or similar.

Now I am asking myself how to build a small PoC:

However, I don't have MDF files and I am a bit lost how to create them (and configure my boards to read them) or whether that would even be necessary. Perhaps it would be easier to hard-code an action to be triggered in node B. For that I need at least two things as far as I can tell:

  1. Mark the nodes as dumb via GUID bit 15. However, I wasn't able to figure out what value this bit would have to have exactly. Could you maybe provide an example for such a GUID?
  2. Hard-code the action callback, perhaps via manually setting up the decision matrix? Is there a way to configure the library to always invoke the action callback function even without a DM?

It has been a long time since I wrote any C/C++ code, so maybe that explains why I wasn't able to find the answers to these issues myself. I would appreciate any help you could provide.

Best, Mat

BlueAndi commented 1 year ago

Hi Mat,

thanks. Thanks goes to Ake (https://www.vscp.org) as VSCP author and maintainer as well. :-)

Dumb nodes are VSCP L2 nodes, not L1 and the bit itself is not part of the GUID, but of the L2 header. image

If you use this lib, its not a dumb node anyway. :-) Your node will provide access to standard registers, the DM and etc.

Usually you use another tool to configure the DM over CAN bus and use the MDF as information on which register address the DM can be found. But you can configure the DM hard coded as well by configuring it in the persistent memory:

#include <framework/core/vscp_dm.h>
#include <framework/core/vscp_ps.h>

...

void setup()
{
    /* Setup VSCP framework */
    ...

    vscp_dm_MatrixRow dmRows[VSCP_CONFIG_DM_ROWS];

    /* Configure your DM here ...*/

    /* Store only your configured DM rows ... the example shows it for row 0.  */
    vscp_ps_writeDMMultiple(0, (const uint8_t*)&dmRows[0], sizeof(vscp_dm_MatrixRow));

    ...
}

Bests Andreas