Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 -r0931b50383943421f0c0b85dcda738bb8b006a16 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 0931b50383943421f0c0b85dcda738bb8b006a16) @@ -99,6 +99,7 @@ // DG Dialysate flow rate static F32 dgDialysateFlowRateMlMin = 0.0; ///< Latest dialysate flow rate reported by the DG. +static BOOL dgDialysateFlowDataFreshFlag = FALSE; ///< Flag to signal the execDialInFlowMonitor() to process fresh flow rate data // Reservoir data static DG_RESERVOIR_ID_T dgActiveReservoir = DG_RESERVOIR_2; ///< Latest active reservoir reported by the DG. @@ -135,7 +136,7 @@ dgTrimmerTempSet = 0.0; dgActiveReservoirSet = DG_RESERVOIR_2; dgReservoirFillVolumeTargetSet = 0; - dgReservoirDrainVolumeTargetSet = 0; + dgReservoirDrainVolumeTargetSet = 0; // initialize load cell weights for ( i = 0; i < NUM_OF_LOAD_CELLS; i++ ) @@ -429,18 +430,35 @@ /*********************************************************************//** * @brief - * The getDGDialysateFlowRateMlMin function gets the latest dialysate flow + * The getDGDialysateFlowRateLMin function gets the latest dialysate flow * rate reported by the DG. * @details Inputs: dgDialysateFlowRateMlMin * @details Outputs: none - * @return Latest dialysate flow rate reported by DG. + * @return Latest dialysate flow rate (in L/min) reported by DG. *************************************************************************/ -F32 getDGDialysateFlowRateMlMin( void ) +F32 getDGDialysateFlowRateLMin( void ) { F32 result = dgDialysateFlowRateMlMin; return result; } + +/*********************************************************************//** + * @brief + * The getDialysateFlowDataFreshFlag function returns a flag to indicate + * if the dialysate flow rate data reported by the DG is fresh or stale data. + * @details Inputs: dgDialysateFlowDataFreshFlag + * @details Outputs: dgDialysateFlowDataFreshFlag + * @return T/F flag to indicate fresh/stale status of dialysate flow data. + *************************************************************************/ +BOOL getDialysateFlowDataFreshFlag( void ) +{ + BOOL result = dgDialysateFlowDataFreshFlag; + + dgDialysateFlowDataFreshFlag = FALSE; + + return result; +} /*********************************************************************//** * @brief @@ -616,19 +634,19 @@ /*********************************************************************//** * @brief - * The setDialysateFlowData function sets the latest dialysate flow data - * reported by the DG. + * The setDialysateFlowData function sets the latest dialysate flow rate + * and its freshness status. The dialysate flow data is reported by the DG. * @details Inputs: none * @details Outputs: dgDialysateFlowRateMlMin - * @param flowRate latest dialysate flow rate (LPM) reported by DG + * @param flowRate latest dialysate flow rate (mL/min) reported by DG * @return none *************************************************************************/ void setDialysateFlowData( F32 flowRate ) { dgDialysateFlowRateMlMin = flowRate; - filterDialInFlowReadings( flowRate * (F32)ML_PER_LITER ); + dgDialysateFlowDataFreshFlag = TRUE; } - + /*********************************************************************//** * @brief * The setNewLoadCellReadings function sets the latest DG reservoir load cell