Skip to content

Commit 467b7e0

Browse files
authored
Add MY_INCLUSION_LED_PIN (#1030)
Thanks to @TokTias for this idea and a starting point for the code. This PR replaces #1029
1 parent d9059d7 commit 467b7e0

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

MyConfig.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,15 @@
12821282
#undef MY_INCLUSION_BUTTON_FEATURE
12831283
#endif
12841284

1285+
/**
1286+
* @def MY_INCLUSION_LED_PIN
1287+
* @brief Enables an inclusion mode LED indicator on the gateway device.
1288+
*
1289+
* With this defined, inclusion mode status (on or off) is indicated by the LED.
1290+
* This feature obeys @ref MY_WITH_LEDS_BLINKING_INVERSE
1291+
*/
1292+
//#define MY_INCLUSION_LED_PIN (7)
1293+
12851294
/**
12861295
* @def MY_INCLUSION_MODE_BUTTON_PIN
12871296
* @brief The default input pin used for the inclusion mode button.
@@ -1927,6 +1936,7 @@
19271936
// GW
19281937
#define MY_DEBUG_VERBOSE_GATEWAY
19291938
#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
1939+
#define MY_INCLUSION_LED_PIN
19301940
#define MY_GATEWAY_W5100
19311941
#define MY_GATEWAY_ENC28J60
19321942
#define MY_GATEWAY_ESP8266

core/MyInclusionMode.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ inline void inclusionInit()
3333
hwPinMode(MY_INCLUSION_MODE_BUTTON_PIN, INPUT);
3434
hwDigitalWrite(MY_INCLUSION_MODE_BUTTON_PIN, HIGH);
3535
#endif
36+
#if defined (MY_INCLUSION_LED_PIN)
37+
// Setup LED pin that indicates inclusion mode
38+
hwPinMode(MY_INCLUSION_LED_PIN, OUTPUT);
39+
hwDigitalWrite(MY_INCLUSION_LED_PIN, LED_OFF);
40+
#endif
3641

3742
}
3843

@@ -47,6 +52,9 @@ void inclusionModeSet(bool newMode)
4752
_inclusionStartTime = hwMillis();
4853
}
4954
}
55+
#if defined (MY_INCLUSION_LED_PIN)
56+
hwDigitalWrite(MY_INCLUSION_LED_PIN, _inclusionMode ? LED_ON : LED_OFF);
57+
#endif
5058
}
5159

5260
inline void inclusionProcess()

0 commit comments

Comments
 (0)