Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions libraries/MySensors/MyConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
***********************************/
Expand Down
4 changes: 2 additions & 2 deletions libraries/MySensors/core/MyInclusionMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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);
}
Expand Down
2 changes: 0 additions & 2 deletions libraries/MySensors/core/MyInclusionMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

#include "MySensorCore.h"

unsigned long inclusionStartTime;
bool inclusionMode;

extern bool gatewayTransportSend(MyMessage &message);

Expand Down
17 changes: 14 additions & 3 deletions libraries/MySensors/examples/GatewaySerial/GatewaySerial.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 <SPI.h>
#include <MySensor.h>
Expand Down
3 changes: 2 additions & 1 deletion libraries/MySensors/keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
MY_RS485_MAX_MESSAGE_LENGTH LITERAL1
MY_INCLUSION_BUTTON_EXTERNAL_PULLUP LITERAL1