diff --git a/libraries/MySensors/MyConfig.h b/libraries/MySensors/MyConfig.h index 736b11d..1d3a019 100644 --- a/libraries/MySensors/MyConfig.h +++ b/libraries/MySensors/MyConfig.h @@ -187,6 +187,12 @@ #define MY_INCLUSION_MODE_DURATION 60 #endif +#if defined(MY_INCLUSION_BUTTON_EXTERNAL_PULLUP) +#define MY_INCLUSION_BUTTON_PRESSED HIGH +#else +#define MY_INCLUSION_BUTTON_PRESSED LOW +#endif + /********************************** * Message Signing Settings ***********************************/ diff --git a/libraries/MySensors/core/MyInclusionMode.cpp b/libraries/MySensors/core/MyInclusionMode.cpp index 604983a..d1a0721 100644 --- a/libraries/MySensors/core/MyInclusionMode.cpp +++ b/libraries/MySensors/core/MyInclusionMode.cpp @@ -34,7 +34,7 @@ inline void inclusionInit() { void inclusionModeSet(boolean newMode) { - if (newMode != inclusionMode) { + if (newMode != _inclusionMode) { _inclusionMode = newMode; // Send back mode change to controller gatewayTransportSend(buildGw(_msg, I_INCLUSION_MODE).set(_inclusionMode?1:0)); @@ -46,7 +46,7 @@ void inclusionModeSet(boolean newMode) { inline void inclusionProcess() { #ifdef MY_INCLUSION_BUTTON_FEATURE - if (!inclusionMode && digitalRead(MY_INCLUSION_MODE_BUTTON_PIN) == LOW) { + if (!_inclusionMode && digitalRead(MY_INCLUSION_MODE_BUTTON_PIN) == MY_INCLUSION_BUTTON_PRESSED) { // Start inclusion mode inclusionModeSet(true); } diff --git a/libraries/MySensors/core/MyInclusionMode.h b/libraries/MySensors/core/MyInclusionMode.h index 03ac12b..dfa0936 100644 --- a/libraries/MySensors/core/MyInclusionMode.h +++ b/libraries/MySensors/core/MyInclusionMode.h @@ -22,8 +22,6 @@ #include "MySensorCore.h" -unsigned long inclusionStartTime; -bool inclusionMode; extern bool gatewayTransportSend(MyMessage &message); diff --git a/libraries/MySensors/examples/GatewaySerial/GatewaySerial.ino b/libraries/MySensors/examples/GatewaySerial/GatewaySerial.ino index 57b8d22..9eee4e8 100644 --- a/libraries/MySensors/examples/GatewaySerial/GatewaySerial.ino +++ b/libraries/MySensors/examples/GatewaySerial/GatewaySerial.ino @@ -44,6 +44,10 @@ #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 +// Set LOW transmit power level as default, if you have an amplified NRF-module and +// power your radio separately with a good regulator you can turn up PA level. +#define MY_RF24_PA_LEVEL RF24_PA_LOW + // Enable serial gateway #define MY_GATEWAY_SERIAL @@ -52,18 +56,25 @@ // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 +// Inverses the behavior of leds +//#define MY_WITH_LEDS_BLINKING_INVERSE + // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway #define MY_INCLUSION_BUTTON_FEATURE + +// Inverses behavior of inclusion button (if using external pullup) +//#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP + // Set inclusion mode duration (in seconds) #define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button #define MY_INCLUSION_MODE_BUTTON_PIN 3 -#define MY_DEFAULT_ERR_LED_PIN 7 // Error led pin -#define MY_DEFAULT_RX_LED_PIN 8 // Receive led pin -#define MY_DEFAULT_TX_LED_PIN 9 // the PCB, on board LED +#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin +#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin +#define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED #include #include diff --git a/libraries/MySensors/keywords.txt b/libraries/MySensors/keywords.txt index 522dbd5..531ea1e 100644 --- a/libraries/MySensors/keywords.txt +++ b/libraries/MySensors/keywords.txt @@ -98,4 +98,5 @@ MY_IP_SUBNET_ADDRESS LITERAL1 MY_W5100_SPI_EN LITERAL1 MY_RS485 LITERAL1 MY_RS485_BAUD_RATE LITERAL1 -MY_RS485_MAX_MESSAGE_LENGTH LITERAL1 \ No newline at end of file +MY_RS485_MAX_MESSAGE_LENGTH LITERAL1 +MY_INCLUSION_BUTTON_EXTERNAL_PULLUP LITERAL1 \ No newline at end of file