Add MY_INCLUSION_LED_PIN (#1030)

Thanks to @TokTias for this idea and a starting point for the code.

This PR replaces https://github.com/mysensors/MySensors/pull/1029
This commit is contained in:
Mikael Falkvidd
2018-01-23 10:26:01 +01:00
committed by GitHub
parent d9059d7bd5
commit 467b7e000a
2 changed files with 18 additions and 0 deletions
+10
View File
@@ -1282,6 +1282,15 @@
#undef MY_INCLUSION_BUTTON_FEATURE
#endif
/**
* @def MY_INCLUSION_LED_PIN
* @brief Enables an inclusion mode LED indicator on the gateway device.
*
* With this defined, inclusion mode status (on or off) is indicated by the LED.
* This feature obeys @ref MY_WITH_LEDS_BLINKING_INVERSE
*/
//#define MY_INCLUSION_LED_PIN (7)
/**
* @def MY_INCLUSION_MODE_BUTTON_PIN
* @brief The default input pin used for the inclusion mode button.
@@ -1927,6 +1936,7 @@
// GW
#define MY_DEBUG_VERBOSE_GATEWAY
#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
#define MY_INCLUSION_LED_PIN
#define MY_GATEWAY_W5100
#define MY_GATEWAY_ENC28J60
#define MY_GATEWAY_ESP8266
+8
View File
@@ -33,6 +33,11 @@ inline void inclusionInit()
hwPinMode(MY_INCLUSION_MODE_BUTTON_PIN, INPUT);
hwDigitalWrite(MY_INCLUSION_MODE_BUTTON_PIN, HIGH);
#endif
#if defined (MY_INCLUSION_LED_PIN)
// Setup LED pin that indicates inclusion mode
hwPinMode(MY_INCLUSION_LED_PIN, OUTPUT);
hwDigitalWrite(MY_INCLUSION_LED_PIN, LED_OFF);
#endif
}
@@ -47,6 +52,9 @@ void inclusionModeSet(bool newMode)
_inclusionStartTime = hwMillis();
}
}
#if defined (MY_INCLUSION_LED_PIN)
hwDigitalWrite(MY_INCLUSION_LED_PIN, _inclusionMode ? LED_ON : LED_OFF);
#endif
}
inline void inclusionProcess()