diff --git a/MyConfig.h b/MyConfig.h index 0aa451420..69dc901c0 100755 --- a/MyConfig.h +++ b/MyConfig.h @@ -1367,6 +1367,13 @@ #define MY_INCLUSION_BUTTON_PRESSED (LOW) #endif +/** + * @def MY_INCLUSION_INDICATION_HANDLER + * @brief Define to use own inclusion mode indication handler. + */ +//#define MY_INCLUSION_INDICATION_HANDLER + + /************************************** * Ethernet Gateway Transport Defaults ***************************************/ @@ -2341,6 +2348,7 @@ #define MY_DEBUG_VERBOSE_GATEWAY #define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP #define MY_INCLUSION_LED_PIN +#define MY_INCLUSION_INDICATION_HANDLER #define MY_GATEWAY_W5100 #define MY_GATEWAY_ENC28J60 #define MY_GATEWAY_ESP8266 diff --git a/core/MyInclusionMode.cpp b/core/MyInclusionMode.cpp index e55bf3a3e..9bf4ceabb 100644 --- a/core/MyInclusionMode.cpp +++ b/core/MyInclusionMode.cpp @@ -35,12 +35,10 @@ inline void inclusionInit() #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 - + inclusionModeSet(_inclusionMode); } - void inclusionModeSet(bool newMode) { if (newMode != _inclusionMode) { @@ -54,6 +52,7 @@ void inclusionModeSet(bool newMode) #if defined (MY_INCLUSION_LED_PIN) hwDigitalWrite(MY_INCLUSION_LED_PIN, _inclusionMode ? LED_ON : LED_OFF); #endif + inclusionModeIndication(_inclusionMode); } inline void inclusionProcess() @@ -70,3 +69,11 @@ inline void inclusionProcess() inclusionModeSet(false); } } + +#if !defined(MY_INCLUSION_INDICATION_HANDLER) +void inclusionModeIndication(bool newMode) +{ + // empty function, resolves AVR-specific GCC optimization bug (<5.5) if handler not used + // see here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77326 +} +#endif diff --git a/core/MyInclusionMode.h b/core/MyInclusionMode.h index 9f76341fc..60a932a9d 100644 --- a/core/MyInclusionMode.h +++ b/core/MyInclusionMode.h @@ -29,5 +29,9 @@ void inclusionInit(); void inclusionModeSet(bool newMode); void inclusionProcess(); +/** + * Allow user to define their own inclusion mode indication handler. + */ +void inclusionModeIndication(bool mode); #endif diff --git a/keywords.txt b/keywords.txt index d63941799..a52af63c2 100755 --- a/keywords.txt +++ b/keywords.txt @@ -98,6 +98,7 @@ MY_INCLUSION_BUTTON_FEATURE LITERAL1 MY_INCLUSION_MODE_BUTTON_PIN LITERAL1 MY_INCLUSION_MODE_DURATION LITERAL1 MY_INCLUSION_LED_PIN LITERAL1 +MY_INCLUSION_INDICATION_HANDLER LITERAL1 MY_OTA_FIRMWARE_FEATURE LITERAL1 MY_OTA_FLASH_SS LITERAL1 MY_OTA_FLASH_JDECID LITERAL1