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
This commit is contained in:
M1118
2018-04-15 09:13:12 +01:00
committed by Alex Shepherd
parent 0fbe2a13d1
commit ba3264bd87
2 changed files with 10 additions and 1 deletions

View File

@@ -927,10 +927,18 @@ void processServiceModeOperation( DCC_MSG * pDccMsg )
#endif #endif
void resetServiceModeTimer(uint8_t inServiceMode) void resetServiceModeTimer(uint8_t inServiceMode)
{ {
if (notifyServiceMode && inServiceMode != DccProcState.inServiceMode)
{
notifyServiceMode(inServiceMode);
}
// Set the Service Mode // Set the Service Mode
DccProcState.inServiceMode = inServiceMode ; DccProcState.inServiceMode = inServiceMode ;
DccProcState.LastServiceModeMillis = inServiceMode ? millis() : 0 ; DccProcState.LastServiceModeMillis = inServiceMode ? millis() : 0 ;
if (notifyServiceMode && inServiceMode != DccProcState.inServiceMode)
{
notifyServiceMode(inServiceMode);
}
} }
void clearDccProcState(uint8_t inServiceMode) void clearDccProcState(uint8_t inServiceMode)

View File

@@ -669,6 +669,7 @@ extern void notifyCVResetFactoryDefault(void) __attribute__ ((weak));
* None * None
*/ */
extern void notifyCVAck(void) __attribute__ ((weak)); extern void notifyCVAck(void) __attribute__ ((weak));
extern void notifyServiceMode(bool) __attribute__ ((weak));
#if defined (__cplusplus) #if defined (__cplusplus)
} }