Skip to content

Commit f7f177f

Browse files
committed
Add setting MY_INCLUSION_INDICATION_HANDLER
for own handler of inclusion mode similar to MY_INDICATION_HANDLER
1 parent 63182de commit f7f177f

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

MyConfig.h

100755100644
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,13 @@
14161416
#define MY_INCLUSION_BUTTON_PRESSED (LOW)
14171417
#endif
14181418

1419+
/**
1420+
* @def MY_INCLUSION_INDICATION_HANDLER
1421+
* @brief Define to use own inclusion indication handler.
1422+
*/
1423+
//#define MY_INCLUSION_INDICATION_HANDLER
1424+
1425+
14191426
/**************************************
14201427
* Ethernet Gateway Transport Defaults
14211428
***************************************/
@@ -2446,6 +2453,7 @@
24462453
#define MY_DEBUG_VERBOSE_GATEWAY
24472454
#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
24482455
#define MY_INCLUSION_LED_PIN
2456+
#define MY_INCLUSION_INDICATION_HANDLER
24492457
#define MY_GATEWAY_W5100
24502458
#define MY_GATEWAY_ENC28J60
24512459
#define MY_GATEWAY_ESP8266

core/MyInclusionMode.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,10 @@ inline void inclusionInit()
3535
#if defined (MY_INCLUSION_LED_PIN)
3636
// Setup LED pin that indicates inclusion mode
3737
hwPinMode(MY_INCLUSION_LED_PIN, OUTPUT);
38-
hwDigitalWrite(MY_INCLUSION_LED_PIN, LED_OFF);
3938
#endif
40-
39+
inclusionModeSet(_inclusionMode);
4140
}
4241

43-
4442
void inclusionModeSet(bool newMode)
4543
{
4644
if (newMode != _inclusionMode) {
@@ -54,6 +52,7 @@ void inclusionModeSet(bool newMode)
5452
#if defined (MY_INCLUSION_LED_PIN)
5553
hwDigitalWrite(MY_INCLUSION_LED_PIN, _inclusionMode ? LED_ON : LED_OFF);
5654
#endif
55+
inclusionModeIndication(_inclusionMode);
5756
}
5857

5958
inline void inclusionProcess()
@@ -70,3 +69,11 @@ inline void inclusionProcess()
7069
inclusionModeSet(false);
7170
}
7271
}
72+
73+
#if !defined(MY_INCLUSION_INDICATION_HANDLER)
74+
void inclusionModeIndication(bool newMode)
75+
{
76+
// empty function, resolves AVR-specific GCC optimization bug (<5.5) if handler not used
77+
// see here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77326
78+
}
79+
#endif

core/MyInclusionMode.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,9 @@ void inclusionInit();
2929
void inclusionModeSet(bool newMode);
3030
void inclusionProcess();
3131

32+
/**
33+
* Allow user to define their own inclusion mode indication handler.
34+
*/
35+
void inclusionModeIndication(bool mode);
3236

3337
#endif

0 commit comments

Comments
 (0)