Proposal - MySensors Network Configuration

Henrik and others,

We’re looking for feedback on making it easier for users to centralize the configuration of the MySensors network configuration (e.g. RF24 Channel, etc.). What if we were to add an include file called MySensorsNetConfig.h that lives in either the Arduino/libraries/MySensors or Arduino/libraries/MySensors/examples and defines the following parameters for centralized change.

/***
 *  Configure Sensor Network RF parameters
 **/
#define RF24_CHANNEL=76			//Which RF channel to communicate on, 0-127
#define RF24_DATARATE=RF24_2MBPS	//RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
#define RF24_PA_LEVEL=RF24_PA_MAX	//RF24_PA_MIN=-18dBm, RF24_PA_LOW=-12dBm, RF24_PA_MED=-6dBM, and RF24_PA_HIGH=0dBm

/***
 *  Enable/disable debug logging
 **/
//#define DEBUG

Every sketch compiled and uploaded would use this file and hence configuration parameters so users would not have to override the constructors or begin methods in each sketch. Changing the channel would be as simple as editing the MySensorsNetConfig.h to use a different channel, re-upload each sketch.

Thoughts? Value? Better mechanism? Location for the include file?

Are there any other configuration parameters that people would like to centralize?

I really like the idea!

We could just give it the simple name: “/libraries/MySensors/Config.h”

And the begin declaration in Sensor.h would look something like this:

void begin(uint8_t radioId=AUTO, rf24_pa_dbm_e paLevel=RF24_PA_LEVEL, uint8_t channel=RF24_CHANNEL, rf24_datarate_e dataRate=RF24_DATARATE);
We're looking for feedback on making it easier for users to centralize the configuration of the MySensors network configuration (e.g. RF24 Channel, etc.).

That would be great ! Please do so.

Ok, thanks for the feedback. I will implement it and pass it to Henrik for review/feedback/commit.

Done. I just submitted the pull request to Henrik for code inspection and merge into the MySensors repo.

Pull Request merged. Thanks!

(must remember to update documentation accordingly)

Thanks Henrik - you’re fast! It’s pretty late for you; are you going to get any sleep?