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:
10
NmraDcc.cpp
10
NmraDcc.cpp
@@ -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)
|
||||||
@@ -1428,4 +1436,4 @@ uint8_t NmraDcc::process()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0 ;
|
return 0 ;
|
||||||
};
|
};
|
||||||
|
@@ -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)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user