Document MyConfig.h
This commit is contained in:
@@ -22,6 +22,11 @@
|
|||||||
#define MyConfig_h
|
#define MyConfig_h
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************
|
||||||
|
* Serial and debug options
|
||||||
|
***********************************/
|
||||||
|
|
||||||
// Enables this in sketch to show debug prints. This option will add a lot to the size of the
|
// Enables this in sketch to show debug prints. This option will add a lot to the size of the
|
||||||
// final sketch but is helpful to see what is actually is happening during development
|
// final sketch but is helpful to see what is actually is happening during development
|
||||||
//#define MY_DEBUG
|
//#define MY_DEBUG
|
||||||
@@ -34,11 +39,21 @@
|
|||||||
#undef MY_DEBUG
|
#undef MY_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Serial output baud rate (for debug prints and serial gateway)
|
// Serial output baud rate (debug prints and serial gateway speed)
|
||||||
#ifndef MY_BAUD_RATE
|
#ifndef MY_BAUD_RATE
|
||||||
#define MY_BAUD_RATE 115200
|
#define MY_BAUD_RATE 115200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**********************************
|
||||||
|
* Radio selection and modes
|
||||||
|
***********************************/
|
||||||
|
|
||||||
|
// Selecting radio transport is optional (for a gateway node).
|
||||||
|
|
||||||
|
//#define MY_RADIO_NRF24
|
||||||
|
//#define MY_RADIO_RFM69
|
||||||
|
|
||||||
|
|
||||||
// Node id defaults to AUTO (tries to fetch id from controller)
|
// Node id defaults to AUTO (tries to fetch id from controller)
|
||||||
#ifndef MY_NODE_ID
|
#ifndef MY_NODE_ID
|
||||||
#define MY_NODE_ID AUTO
|
#define MY_NODE_ID AUTO
|
||||||
@@ -57,7 +72,7 @@
|
|||||||
***********************************/
|
***********************************/
|
||||||
|
|
||||||
// Enable MY_OTA_FIRMWARE_FEATURE in sketch to allow safe over-the-air firmware updates.
|
// Enable MY_OTA_FIRMWARE_FEATURE in sketch to allow safe over-the-air firmware updates.
|
||||||
// This feature requires external flash and the DualOptiBoot bootloader.
|
// This feature requires external flash and the DualOptiBoot boot-loader.
|
||||||
// Note: You can still have OTA FW updates without external flash but it
|
// Note: You can still have OTA FW updates without external flash but it
|
||||||
// requires the MYSBootloader and disabled MY_OTA_FIRMWARE_FEATURE
|
// requires the MYSBootloader and disabled MY_OTA_FIRMWARE_FEATURE
|
||||||
//#define MY_OTA_FIRMWARE_FEATURE
|
//#define MY_OTA_FIRMWARE_FEATURE
|
||||||
@@ -174,22 +189,22 @@
|
|||||||
* NRF24L01 Driver Defaults
|
* NRF24L01 Driver Defaults
|
||||||
***********************************/
|
***********************************/
|
||||||
#ifndef MY_RF24_CE_PIN
|
#ifndef MY_RF24_CE_PIN
|
||||||
#define MY_RF24_CE_PIN 9
|
#define MY_RF24_CE_PIN 9
|
||||||
#endif
|
#endif
|
||||||
#ifndef MY_RF24_CS_PIN
|
#ifndef MY_RF24_CS_PIN
|
||||||
#define MY_RF24_CS_PIN 10
|
#define MY_RF24_CS_PIN 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MY_RF24_PA_LEVEL
|
#ifndef MY_RF24_PA_LEVEL
|
||||||
#define MY_RF24_PA_LEVEL RF24_PA_MAX
|
#define MY_RF24_PA_LEVEL RF24_PA_MAX
|
||||||
#endif
|
#endif
|
||||||
// RF channel for the sensor net, 0-127
|
// RF channel for the sensor net, 0-127
|
||||||
#ifndef MY_RF24_CHANNEL
|
#ifndef MY_RF24_CHANNEL
|
||||||
#define MY_RF24_CHANNEL 76
|
#define MY_RF24_CHANNEL 76
|
||||||
#endif
|
#endif
|
||||||
//RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
|
//RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
|
||||||
#ifndef MY_RF24_DATARATE
|
#ifndef MY_RF24_DATARATE
|
||||||
#define MY_RF24_DATARATE RF24_250KBPS
|
#define MY_RF24_DATARATE RF24_250KBPS
|
||||||
#endif
|
#endif
|
||||||
// This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network.
|
// This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network.
|
||||||
#ifndef MY_RF24_BASE_RADIO_ID
|
#ifndef MY_RF24_BASE_RADIO_ID
|
||||||
@@ -246,11 +261,26 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**************************************
|
/**************************************
|
||||||
* Gateway Transport Ethernet Defaults
|
* Ethernet Gateway Transport Defaults
|
||||||
***************************************/
|
***************************************/
|
||||||
// Enable to use DHCP for getting IP address. If not defined, static IP is expected
|
|
||||||
//#define MY_IP_ADDRESS_VIA_DHCP
|
|
||||||
|
|
||||||
|
// The gateway options available
|
||||||
|
//#define MY_GATEWAY_W5100
|
||||||
|
//#define MY_GATEWAY_ENC28J60
|
||||||
|
//#define MY_GATEWAY_ESP8266
|
||||||
|
|
||||||
|
// The port to open on controller or gateway
|
||||||
|
#ifndef MY_PORT
|
||||||
|
#define MY_PORT 5003
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Static ip address of gateway (if this is disabled, DHCP will be used)
|
||||||
|
//#define MY_IP_ADDRESS 192,168,178,66
|
||||||
|
|
||||||
|
// Enables UDP mode for Ethernet gateway (W5100)
|
||||||
|
//#define MY_USE_UDP
|
||||||
|
|
||||||
|
// DHCP, default renewal setting
|
||||||
#ifndef MY_IP_RENEWAL_INTERVAL
|
#ifndef MY_IP_RENEWAL_INTERVAL
|
||||||
#define MY_IP_RENEWAL_INTERVAL 60000
|
#define MY_IP_RENEWAL_INTERVAL 60000
|
||||||
#endif
|
#endif
|
||||||
@@ -258,7 +288,9 @@
|
|||||||
#ifndef MY_MAC_ADDRESS
|
#ifndef MY_MAC_ADDRESS
|
||||||
#define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
#define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
#endif
|
#endif
|
||||||
// Enable to use UDP instead of plain Ethernet
|
|
||||||
//#define MY_USE_UDP
|
// Controller ip-address, if this is defined, gateway will act as a client trying to contact controller on MY_PORT.
|
||||||
|
// If MY_CONTROLLER_IP_ADDRESS is left un-defined, gateway acts as server allowing incoming connections.
|
||||||
|
//#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -35,8 +35,6 @@
|
|||||||
#define MY_NODE_TYPE "sensor"
|
#define MY_NODE_TYPE "sensor"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// CORE
|
|
||||||
|
|
||||||
|
|
||||||
// HARDWARE
|
// HARDWARE
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
@@ -184,14 +182,17 @@
|
|||||||
extern void setup();
|
extern void setup();
|
||||||
extern void loop();
|
extern void loop();
|
||||||
|
|
||||||
// Initialize library and call sketch functions
|
#include <Arduino.h>
|
||||||
|
// Initialize library and handle sketch functions like we want to
|
||||||
int main() {
|
int main() {
|
||||||
begin();
|
init(); // Init Arduino
|
||||||
setup();
|
begin(); // Startup MySensors library
|
||||||
|
setup(); // Call sketch setup
|
||||||
while(1) {
|
while(1) {
|
||||||
// We handle incoming message processing here
|
process(); // Process incoming data
|
||||||
process();
|
loop(); // Call sketch loop
|
||||||
loop();
|
if (serialEventRun) serialEventRun();
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -64,8 +64,8 @@
|
|||||||
|
|
||||||
|
|
||||||
// Enable gateway type
|
// Enable gateway type
|
||||||
//#define MY_GATEWAY_W5100
|
|
||||||
#define MY_GATEWAY_ENC28J60
|
|
||||||
|
|
||||||
// Set default gateway protocol (http://www.mysensors.org/download/serial_api_15)
|
// Set default gateway protocol (http://www.mysensors.org/download/serial_api_15)
|
||||||
#define MY_GATEWAY_PROTOCOL_DEFAULT
|
#define MY_GATEWAY_PROTOCOL_DEFAULT
|
||||||
|
|||||||
@@ -28,14 +28,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//#define MY_DEBUG
|
//#define MY_DEBUG
|
||||||
|
|
||||||
|
#define MY_RADIO_NRF24 // MY_RADIO_RFM69
|
||||||
|
|
||||||
//#define MY_SOFTSPI
|
//#define MY_SOFTSPI
|
||||||
//#define MY_OTA_FIRMWARE_FEATURE
|
//#define MY_OTA_FIRMWARE_FEATURE
|
||||||
|
|
||||||
#define MY_SIGNING_SOFT
|
//#define MY_SIGNING_SOFT
|
||||||
|
//#define MY_REPEATER_FEATURE
|
||||||
|
|
||||||
// #define MY_GATEWAY_SERIAL // REMOVE-ME
|
// #define MY_GATEWAY_SERIAL // REMOVE-ME
|
||||||
// #define MY_GATEWAY_PROTOCOL_DEFAULT // REMOVE-ME
|
// #define MY_GATEWAY_PROTOCOL_DEFAULT // REMOVE-ME
|
||||||
#define MY_RADIO_NRF24 // MY_RADIO_RFM69
|
|
||||||
|
|
||||||
#include <MySensor.h>
|
#include <MySensor.h>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user