Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -r94c4f859bf5a6844089972b41fb60a8d6ebd0463 -r0a587d42b41c5d9a81f69b9c1ae526d4e23ceaa8 --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 94c4f859bf5a6844089972b41fb60a8d6ebd0463) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 0a587d42b41c5d9a81f69b9c1ae526d4e23ceaa8) @@ -87,7 +87,7 @@ static U32 lastTimeReservoirInUF; ///< Reservoir time in ultrafiltration from prior reservoir (in ms). static F32 volSpentUFML; ///< Ultrafiltration volume in milliliters. static DG_RESERVOIR_ID_T activeReservoir; ///< Active reservoir. -static F32 recirculationLevelPct; ///< Recirculation level in percent. +static OVERRIDE_F32_T recirculationLevelPct = { 0.0, 0.0, 0.0, 0 }; ///< Recirculation level in percent. static U32 reservoirSwitchStartTimeMS; ///< Reservoir switch start time in milliseconds. static S32 timeWaitToFillMS; ///< Time to wait to fill in milliseconds. static F32 targetFillFlowLPM; ///< Target fill flow in liters/minutes. @@ -145,7 +145,7 @@ lastTimeReservoirInUF = 0; volSpentUFML = 0.0F; activeReservoir = getDGActiveReservoir(); - recirculationLevelPct = 0.0F; + recirculationLevelPct.data = 0.0F; reservoirSwitchStartTimeMS = 0; timeWaitToFillMS = 0; targetFillFlowLPM = 0.0F; @@ -202,7 +202,7 @@ volSpentML += ( flowRateMLPerMS * msSinceLastVolumeCalc ); timeReservoirInUse++; // Check the recirculation level - recirculationLevelPct = volSpentML / (F32)prevTargetFillVolumeML[ getDGActiveReservoir() ]; + recirculationLevelPct.data = volSpentML / (F32)prevTargetFillVolumeML[ getDGActiveReservoir() ]; } // Update the reservoir start time @@ -452,7 +452,7 @@ data.activeReservoirUFVolML = volSpentUFML; data.activeReservoirVolSpentML = volSpentML; data.dilLevelPct = dilutionLevelPct * 100; - data.recircLevelPct = recirculationLevelPct * 100; + data.recircLevelPct = getF32OverrideValue( &recirculationLevelPct ) * 100; data.timeDepletionMS = timeDepleteMS; data.timeWaitFillMS = timeWaitToFillMS; data.tempRemoveTargetFillFlow = targetFillFlowLPM; @@ -593,13 +593,13 @@ // If the recirculation level has exceeded the max allowed, raise the alarm to stop using the active reservoir as it has been // diluted to much - if ( recirculationLevelPct >= getReservoirRecirculationMaxPercent() ) + if ( getF32OverrideValue( &recirculationLevelPct ) >= getReservoirRecirculationMaxPercent() ) { #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_RESERVOIRS_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) #endif { - SET_ALARM_WITH_1_F32_DATA( ALARM_ID_HD_ACTIVE_RESERVOIR_RECIRCULATION_OUT_OF_RANGE, recirculationLevelPct ) + SET_ALARM_WITH_1_F32_DATA( ALARM_ID_HD_ACTIVE_RESERVOIR_RECIRCULATION_OUT_OF_RANGE, getF32OverrideValue( &recirculationLevelPct ) ) } } @@ -738,4 +738,55 @@ return targetFillVolumeML; } + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + + +/*********************************************************************//** + * @brief + * The testSetRecirculationLevelPctOverride function overrides the recirculation + * percentage. + * @details Inputs: none + * @details Outputs: recirculationLevelPct + * @param value override percentage value with this + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetRecirculationLevelPctOverride( F32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + recirculationLevelPct.ovData = value; + recirculationLevelPct.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetRecirculationLevelPctOverride function resets the override of the + * recirculation percentage. + * @details Inputs: none + * @details Outputs: recirculationLevelPct + * @return TRUE if reset successful, FALSE if not + *************************************************************************/ +BOOL testResetRecirculationLevelPctOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + recirculationLevelPct.override = OVERRIDE_RESET; + recirculationLevelPct.ovData = recirculationLevelPct.ovInitData; + } + + return result; +} + /**@}*/