diff --git a/libraries/MySensors/MyConfig.h b/libraries/MySensors/MyConfig.h index 8991e99..31937f1 100644 --- a/libraries/MySensors/MyConfig.h +++ b/libraries/MySensors/MyConfig.h @@ -4,17 +4,39 @@ /*** * Configure Sensor Network */ -#define COMMDRIVER_NRF24 + +// pick ONE of these - other board layouts can be easily added this way +#define MYSENSORS_SENSOR +//#define MYSENSORS_SERIAL_GATEWAY +//#define MYSENSORS_ETHERNET_MQTT_GATEWAY + +#ifdef MYSENSORS_SENSOR +#define MYSENSORS_RF_NRF24 +#define RF24_CE_PIN 9 +#define RF24_CS_PIN 10 +#define RF24_PA_LEVEL RF24_PA_MAX +#endif -#ifdef COMMDRIVER_NRF24 +#ifdef MYSENSORS_SERIAL_GATEWAY +#define MYSENSORS_RF_NRF24 +#define RF24_CE_PIN 9 +#define RF24_CS_PIN 10 +#define RF24_PA_LEVEL RF24_PA_LOW +#endif + +#ifdef MYSENSORS_ETHERNET_MQTT_GATEWAY +#define MYSENSORS_RF_NRF24 +#define RF24_CE_PIN 5 +#define RF24_CS_PIN 6 +#define RF24_PA_LEVEL RF24_PA_LOW +#endif + +#ifdef MYSENSORS_RF_NRF24 #include "MyDriverNRF24.h" typedef class MyDriverNRF24 MyDriverClass; #define RF24_CHANNEL 76 //RF channel for the sensor net, 0-127 #define RF24_DATARATE RF24_250KBPS //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps -#define RF24_PA_LEVEL RF24_PA_MAX //Sensor PA Level == RF24_PA_MIN=-18dBm, RF24_PA_LOW=-12dBm, RF24_PA_HIGH=-6dBM, and RF24_PA_MAX=0dBm #define RF24_BASE_RADIO_ID ((uint64_t)0xA8A8E1FC00LL) // This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network. -#define RF24_CE_PIN 9 -#define RF24_CS_PIN 10 #endif /*** diff --git a/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino b/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino index 3c6c2c0..a52c49d 100644 --- a/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino +++ b/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino @@ -4,6 +4,10 @@ #include #include +#ifndef MYSENSORS_SENSOR +#error Please switch to MYSENSORS_SENSOR in MyConfig.h +#endif + #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected #define MAX_ATTACHED_DS18B20 16 unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) diff --git a/libraries/MySensors/examples/EthernetGateway/EthernetGateway.ino b/libraries/MySensors/examples/EthernetGateway/EthernetGateway.ino index da25fb7..a6ace27 100644 --- a/libraries/MySensors/examples/EthernetGateway/EthernetGateway.ino +++ b/libraries/MySensors/examples/EthernetGateway/EthernetGateway.ino @@ -56,6 +56,9 @@ #include #include "GatewayUtil.h" +#ifndef MYSENSORS_ETHERNET_MQTT_GATEWAY +#error Please switch to MYSENSORS_ETHERNET_MQTT_GATEWAY in MyConfig.h +#endif // Use this if you have attached a Ethernet ENC28J60 shields #include diff --git a/libraries/MySensors/examples/MQTTGateway/MQTTGateway.ino b/libraries/MySensors/examples/MQTTGateway/MQTTGateway.ino index 5526e68..219b4e2 100644 --- a/libraries/MySensors/examples/MQTTGateway/MQTTGateway.ino +++ b/libraries/MySensors/examples/MQTTGateway/MQTTGateway.ino @@ -62,6 +62,9 @@ http://forum.mysensors.org/topic/303/mqtt-broker-gateway #include #include "MyMQTT.h" +#ifndef MYSENSORS_ETHERNET_MQTT_GATEWAY +#error Please switch to MYSENSORS_ETHERNET_MQTT_GATEWAY in MyConfig.h +#endif #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled #define INCLUSION_MODE_PIN 3 // Digital pin used for inclusion mode button diff --git a/libraries/MySensors/examples/SerialGateway/SerialGateway.ino b/libraries/MySensors/examples/SerialGateway/SerialGateway.ino index 3ff423f..6ee18a4 100644 --- a/libraries/MySensors/examples/SerialGateway/SerialGateway.ino +++ b/libraries/MySensors/examples/SerialGateway/SerialGateway.ino @@ -20,7 +20,7 @@ * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly * - ERR (red) - fast blink on error during transmission error or recieve crc error */ - + #define NO_PORTB_PINCHANGES #include @@ -30,6 +30,9 @@ #include #include "GatewayUtil.h" +#ifndef MYSENSORS_SERIAL_GATEWAY +#error Please switch to MYSENSORS_SERIAL_GATEWAY in MyConfig.h +#endif #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled #define INCLUSION_MODE_PIN 3 // Digital pin used for inclusion mode button