diff --git a/NmraDcc.cpp b/NmraDcc.cpp index 7523820..2dfb294 100644 --- a/NmraDcc.cpp +++ b/NmraDcc.cpp @@ -940,10 +940,18 @@ void processServiceModeOperation( DCC_MSG * pDccMsg ) ///////////////////////////////////////////////////////////////////////// void resetServiceModeTimer(uint8_t inServiceMode) { + if (notifyServiceMode && inServiceMode != DccProcState.inServiceMode) + { + notifyServiceMode(inServiceMode); + } // Set the Service Mode DccProcState.inServiceMode = inServiceMode ; DccProcState.LastServiceModeMillis = inServiceMode ? millis() : 0 ; + if (notifyServiceMode && inServiceMode != DccProcState.inServiceMode) + { + notifyServiceMode(inServiceMode); + } } ///////////////////////////////////////////////////////////////////////// @@ -1395,4 +1403,4 @@ uint8_t NmraDcc::process() } return 0 ; -}; \ No newline at end of file +}; diff --git a/NmraDcc.h b/NmraDcc.h index 991a5f1..42e12ae 100644 --- a/NmraDcc.h +++ b/NmraDcc.h @@ -671,6 +671,10 @@ extern void notifyCVResetFactoryDefault(void) __attribute__ ((weak)); * None */ extern void notifyCVAck(void) __attribute__ ((weak)); +extern void notifyServiceMode(bool) __attribute__ ((weak)); + +// Deprecated, only for backward compatibility with version 1.4.2. Don't use in new designs +extern void notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State ) __attribute__ ((weak)); // Deprecated, only for backward compatibility with version 1.4.2. Don't use in new designs extern void notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State ) __attribute__ ((weak));