Index: firmware/App/Modes/Rinseback.c =================================================================== diff -u -ra2a882ee989ef142887cd54a0f8311addaca812d -rc65ad0538ff99c3e13d7d7866ac15e38a1ef6002 --- firmware/App/Modes/Rinseback.c (.../Rinseback.c) (revision a2a882ee989ef142887cd54a0f8311addaca812d) +++ firmware/App/Modes/Rinseback.c (.../Rinseback.c) (revision c65ad0538ff99c3e13d7d7866ac15e38a1ef6002) @@ -49,7 +49,7 @@ static const F32 MIN_RINSEBACK_SAFETY_VOLUME_ML = ( TARGET_RINSEBACK_VOLUME_ML * 0.8 ); /// Interval at which rinseback progress is to be published to UI. -static const U32 RINSEBACK_DATA_PUBLISH_INTERVAL = ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ); +#define RINSEBACK_DATA_PUBLISH_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) /// Maximum time allowed for rinseback operation until full volume is delivered. Timer is reset whenever BP is running. static const U32 MAX_RINSEBACK_TIME = ( 5 * SEC_PER_MIN * ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ); /// Maximum time allowed for each additional rinseback volume delivery. @@ -71,6 +71,8 @@ static U32 rinsebackLastMotorCount; ///< The last BP motor encoder count read for independent rinseback volume check. static U32 rinsebackAdditionalTimerCtr; ///< Timer counter for duration of an additional rinseback delivery. static U32 rinsebackPublishTimerCtr; ///< Timer counter for determining interval for rinseback status to be published. +/// Interval (in task intervals) at which to publish rinseback data to CAN bus. +static OVERRIDE_U32_T rinsebackPublishInterval = { RINSEBACK_DATA_PUBLISH_INTERVAL, RINSEBACK_DATA_PUBLISH_INTERVAL, RINSEBACK_DATA_PUBLISH_INTERVAL, 0 }; static BOOL startRinsebackRequested; ///< Flag indicates user requesting rinseback start (confirming saline bag move to arterial line end). static BOOL incrRinsebackFlowRateRequested; ///< Flag indicates user requesting rinseback flow rate be increased. @@ -111,6 +113,7 @@ static BOOL handleEndTreatmentUserAction( REQUEST_REJECT_REASON_CODE_T *rejReason ); static void publishRinsebackData( void ); +static U32 getPublishRinsebackInterval( void ); /*********************************************************************//** * @brief @@ -972,7 +975,7 @@ *************************************************************************/ static void publishRinsebackData( void ) { - if ( ++rinsebackPublishTimerCtr >= RINSEBACK_DATA_PUBLISH_INTERVAL ) + if ( ++rinsebackPublishTimerCtr >= getPublishRinsebackInterval() ) { RINSEBACK_DATA_PAYLOAD_T data; U32 timeout = MAX_RINSEBACK_TIME / ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ); @@ -1002,7 +1005,27 @@ } } +/*********************************************************************//** + * @brief + * The getPublishRinsebackInterval function gets the rinseback data + * publication interval. + * @details Inputs: rinsebackPublishInterval + * @details Outputs: none + * @return the current rinseback publication interval (in task intervals). + *************************************************************************/ +static U32 getPublishRinsebackInterval( void ) +{ + U32 result = rinsebackPublishInterval.data; + if ( OVERRIDE_KEY == rinsebackPublishInterval.override ) + { + result = rinsebackPublishInterval.ovData; + } + + return result; +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -1098,4 +1121,51 @@ return result; } +/*********************************************************************//** + * @brief + * The testSetRinsebackPublishIntervalOverride function sets the override of the + * rinseback data publication interval. + * @details Inputs: none + * @details Outputs: rinsebackPublishInterval + * @param ms milliseconds between rinseback broadcasts + * @return TRUE if override set successful, FALSE if not + *************************************************************************/ +BOOL testSetRinsebackPublishIntervalOverride( U32 ms ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + U32 intvl = ms / TASK_GENERAL_INTERVAL; + + result = TRUE; + rinsebackPublishInterval.ovData = intvl; + rinsebackPublishInterval.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetRinsebackPublishIntervalOverride function resets the override of the + * rinseback data publication interval. + * @details Inputs: none + * @details Outputs: rinsebackPublishInterval + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetRinsebackPublishIntervalOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + rinsebackPublishInterval.override = OVERRIDE_RESET; + rinsebackPublishInterval.ovData = rinsebackPublishInterval.ovInitData; + } + + return result; +} + /**@}*/