diff --git a/MyConfig.h b/MyConfig.h index e1dbdb3..598b686 100644 --- a/MyConfig.h +++ b/MyConfig.h @@ -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 diff --git a/core/MyInclusionMode.cpp b/core/MyInclusionMode.cpp index 9aa0145..0b50621 100644 --- a/core/MyInclusionMode.cpp +++ b/core/MyInclusionMode.cpp @@ -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()