From ba3264bd8772b62fecf5358e00bb362ebd9b46aa Mon Sep 17 00:00:00 2001 From: M1118 Date: Sun, 15 Apr 2018 09:13:12 +0100 Subject: [PATCH] Addition of notifyServceMode call to allow decoders to turn off high current outputs (#14) * Add notification for entering and leaving service mode to allow the decoder to swithc off high current outputs * Add notification for entering and leaving service mode to allow the decoder to swithc off high current outputs --- NmraDcc.cpp | 10 +++++++++- NmraDcc.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NmraDcc.cpp b/NmraDcc.cpp index 5fef252..1a86292 100644 --- a/NmraDcc.cpp +++ b/NmraDcc.cpp @@ -927,10 +927,18 @@ void processServiceModeOperation( DCC_MSG * pDccMsg ) #endif 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); + } } void clearDccProcState(uint8_t inServiceMode) @@ -1428,4 +1436,4 @@ uint8_t NmraDcc::process() } return 0 ; -}; \ No newline at end of file +}; diff --git a/NmraDcc.h b/NmraDcc.h index 3f5d17b..b1ecf1e 100644 --- a/NmraDcc.h +++ b/NmraDcc.h @@ -669,6 +669,7 @@ extern void notifyCVResetFactoryDefault(void) __attribute__ ((weak)); * None */ extern void notifyCVAck(void) __attribute__ ((weak)); +extern void notifyServiceMode(bool) __attribute__ ((weak)); #if defined (__cplusplus) }