Skip to content

inSketch

dario edited this page Apr 2, 2017 · 3 revisions

inSketch Configuration Mode

The inSketch mode allow to define some configuration parameters directly into the sketch, overwriting the ones defined in the relevant configuration files, this method is used to define the configuration files. Generally the options that change node by node are available as inSketch, this gives the freedom to have the configuration settings directly into the sketch without have to change files at every node compiled.

Parameters that has yet an inSketch option are defined as #ifndef parametername_INSKETCH as example from ethCfg.h

#ifndef MAC_INSKETCH
uint8_t MAC_ADDRESS[] = {0x1A, 0xA6, 0x49, 0x6B, 0x00, 0x01};
#define AUTO_MAC         1
#define MAC_DEBUG        0
#endif	

So, including #define MAC_INSKETCH at top of your sketch will prevent the compiler to include whatever has been defined in ethCfg.h and the definition in your sketch will be used instead.

Your sketch will looks like

#define MAC_INSKETCH
uint8_t MAC_ADDRESS[] = {0x1A, 0xA6, 0x49, 0x6B, 0x00, 0xAA};
#define AUTO_MAC         0
#define MAC_DEBUG        0

Add more parameters to inSketch

If you would add more parameters to inSketch you need to identify that one into the relevant configuration file and use the statement to remove it at compilation time

#ifndef(parametername_INSKETCH)
...
#endif

As example, if you would move to inSketch the VNET_DEBUG parameter from vNetCfg.h is just required to change is as:

#ifndef VNET_DEBUG_INSKETCH
#  define VNET_DEBUG  0
#endif

So, including in the sketch

#define  VNET_DEBUG_INSKETCH

the #define from vNetCfg.h is automatically excluded and in the sketch you can define

#  define VNET_DEBUG  1

to enable the debug.

Clone this wiki locally