Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -ra3a01327c8fe80f65f6658ae6cbef4910a4a8033 -r8e7158d8231435496fcf1d5649e51babf859ccc7 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision a3a01327c8fe80f65f6658ae6cbef4910a4a8033) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 8e7158d8231435496fcf1d5649e51babf859ccc7) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file DGInterface.c * * @author (last) Sean Nash -* @date (last) 07-Jul-2020 +* @date (last) 13-Nov-2020 * * @author (original) Sean * @date (original) 08-Apr-2020 @@ -91,9 +91,8 @@ /*********************************************************************//** * @brief * The initDGInterface function initializes the DGInterface module. - * @details - * Inputs : none - * Outputs : DGInterface module initialized. + * @details Inputs: none + * @details Outputs: DGInterface module initialized. * @return none *************************************************************************/ void initDGInterface( void ) @@ -112,9 +111,8 @@ * @brief * The initTreatmentReservoirMgmt function initializes the treatment reservoir * management state machine. - * @details - * Inputs : none - * Outputs : treatment reservoir management state machine initialized. + * @details Inputs: none + * @details Outputs: treatment reservoir management state machine initialized. * @return none *************************************************************************/ void initTreatmentReservoirMgmt( void ) @@ -129,9 +127,8 @@ * @brief * The execTreatmentReservoirMgmt function executes the state machine for the * reservoir management during treatment mode. - * @details - * Inputs : none - * Outputs : DG reservoirs (drains & fills) managed. + * @details Inputs: none + * @details Outputs: DG reservoirs (drains & fills) managed. * @return none *************************************************************************/ void execTreatmentReservoirMgmt( void ) @@ -141,8 +138,11 @@ U32 msSinceLastVolumeCalc = calcTimeSince( resUseTimer ); F32 flowRateMlPerMs = (F32)getTargetDialInFlowRate() / (F32)( MS_PER_SECOND * SEC_PER_MIN ); - // calculate volume used from active reservoir - resUseVolumeMl += ( flowRateMlPerMs * msSinceLastVolumeCalc ); // TODO - should this calc be done and kept by Dialysis sub-mode? + // calculate volume used from active reservoir - do not accumulate if saline bolus in progress + if ( SALINE_BOLUS_STATE_IN_PROGRESS != getSalineBolusState() ) + { + resUseVolumeMl += ( flowRateMlPerMs * msSinceLastVolumeCalc ); // TODO - should this calc be done and kept by Dialysis sub-mode? + } resUseTimer = getMSTimerCount(); // treatment reservoir mgmt. state machine @@ -256,9 +256,8 @@ /*********************************************************************//** * @brief * The getDGOpMode function gets the current DG operating mode. - * @details - * Inputs : dgCurrentOpMode - * Outputs : none + * @details Inputs: dgCurrentOpMode + * @details Outputs: none * @return Current DG operating mode. *************************************************************************/ DG_OP_MODE_T getDGOpMode( void ) @@ -269,9 +268,8 @@ /*********************************************************************//** * @brief * The getDGSubMode function gets the current DG operating sub-mode. - * @details - * Inputs : dgSubMode - * Outputs : none + * @details Inputs: dgSubMode + * @details Outputs: none * @return Current DG operating sub-mode. *************************************************************************/ U32 getDGSubMode( void ) @@ -282,9 +280,8 @@ /*********************************************************************//** * @brief * The getDGActiveReservoir function gets the current active reservoir. - * @details - * Inputs : dgActiveReservoirSet - * Outputs : none + * @details Inputs: dgActiveReservoirSet + * @details Outputs: none * @return Currently commanded active reservoir. *************************************************************************/ DG_RESERVOIR_ID_T getDGActiveReservoir( void ) @@ -296,9 +293,8 @@ * @brief * The getDGPressure function gets the latest pressure reported by the DG * for a given pressure sensor. - * @details - * Inputs : dgPressures[] - * Outputs : none + * @details Inputs: dgPressures[] + * @details Outputs: none * @param sensorID pressure sensor we are getting reading for * @return Latest pressure reading reported by DG for the given sensor. *************************************************************************/ @@ -322,9 +318,8 @@ * @brief * The getDGROPumpPressureSetPt function gets the latest RO pump * pressure set point reported by the DG. - * @details - * Inputs : dgROPumpPressureSetPtPSI - * Outputs : none + * @details Inputs: dgROPumpPressureSetPtPSI + * @details Outputs: none * @return Latest RO pump pressure set point reported by DG. *************************************************************************/ U32 getDGROPumpPressureSetPt( void ) @@ -338,9 +333,8 @@ * @brief * The getDGROPumpFlowRateMlMin function gets the latest RO pump flow * rate reported by the DG. - * @details - * Inputs : dgROPumpFlowRateMlMin - * Outputs : none + * @details Inputs: dgROPumpFlowRateMlMin + * @details Outputs: none * @return Latest RO pump flow rate reported by DG. *************************************************************************/ F32 getDGROPumpFlowRateMlMin( void ) @@ -354,9 +348,8 @@ * @brief * The getDGDrainPumpRPMSetPt function gets the latest drain pump RPM * set point reported by the DG. - * @details - * Inputs : dgDrainPumpSpeedSetPtRPM - * Outputs : none + * @details Inputs: dgDrainPumpSpeedSetPtRPM + * @details Outputs: none * @return Latest drain pump RPM set point reported by DG. *************************************************************************/ U32 getDGDrainPumpRPMSetPt( void ) @@ -370,9 +363,8 @@ * @brief * The setDGOpMode function sets the latest DG operating mode reported by * the DG. - * @details - * Inputs : none - * Outputs : dgCurrentOpMode + * @details Inputs: none + * @details Outputs: dgCurrentOpMode * @param opMode operating mode reported by DG * @param subMode sub-mode (current state) of operating mode reported by DG * @return none @@ -394,9 +386,8 @@ * @brief * The setDialysateTemperatureReadings function sets the latest dialysate * temperatures reported by the DG. - * @details - * Inputs : none - * Outputs : dgDialysateTemp, dgRedundantDialysateTemp + * @details Inputs: none + * @details Outputs: dgDialysateTemp, dgRedundantDialysateTemp * @param temp1 dialysate temperature reported by DG * @param temp2 redundant dialysate temperature reported by DG * @return none @@ -411,9 +402,8 @@ * @brief * The setDGDialysateTemperatures function sets the latest temperature data * reported by the DG. - * @details - * Inputs : none - * Outputs : dgPrimaryTemp, dgTrimmerTemp + * @details Inputs: none + * @details Outputs: dgPrimaryTemp, dgTrimmerTemp * @param primaryHtrTemp Primary heater temperature reported by DG * @param trimmerHtrTemp Trimmer heater temperature reported by DG * @return none @@ -428,9 +418,8 @@ * @brief * The setDGReservoirsData function sets the latest reservoir data * reported by the DG. - * @details - * Inputs : none - * Outputs : dgActiveReservoir, dgReservoirFillVolumeTarget, dgReservoirDrainVolumeTarget + * @details Inputs: none + * @details Outputs: dgActiveReservoir, dgReservoirFillVolumeTarget, dgReservoirDrainVolumeTarget * @param resID ID of active reservoir * @param fillVol Reservoir fill to volume reported by DG * @param drainVol Reservoir drain to volume reported by DG @@ -453,9 +442,8 @@ /*********************************************************************//** * @brief * The setDGPressures function sets the latest pressures reported by the DG. - * @details - * Inputs : none - * Outputs : dgPressures[] + * @details Inputs: none + * @details Outputs: dgPressures[] * @param roIn latest RO pump inlet pressure reported by DG * @param roOut latest RO pump outlet pressure reported by DG * @param drainIn latest drain pump inlet pressure reported by DG @@ -473,9 +461,8 @@ /*********************************************************************//** * @brief * The setDGROPumpData function sets the latest RO pump data reported by the DG. - * @details - * Inputs : none - * Outputs : dgROPumpPressureSetPtPSI, dgROPumpFlowRateMlMin + * @details Inputs: none + * @details Outputs: dgROPumpPressureSetPtPSI, dgROPumpFlowRateMlMin * @param presSetPt latest RO pump pressure set point reported by DG * @param flowRate latest RO pump flow rate (LPM) reported by DG * @return none @@ -489,9 +476,8 @@ /*********************************************************************//** * @brief * The setDGDrainPumpData function sets the latest drain pump data reported by the DG. - * @details - * Inputs : none - * Outputs : dgDrainPumpSpeedSetPtRPM + * @details Inputs: none + * @details Outputs: dgDrainPumpSpeedSetPtRPM * @param rpmSetPt latest drain pump RPM set point reported by DG * @return none *************************************************************************/ @@ -504,9 +490,8 @@ * @brief * The cmdSetDGDialysateTargetTemps function sends a target dialysate * temperature command message to the DG. - * @details - * Inputs : none - * Outputs : dgPrimaryTempSet, dgTrimmerTempSet + * @details Inputs: none + * @details Outputs: dgPrimaryTempSet, dgTrimmerTempSet * @param primaryHtrTemp commanded target dialysate temperature for the primary heater * @param trimmerHtrTemp commanded target dialysate temperature for the trimmer heater * @return none @@ -522,9 +507,8 @@ * @brief * The cmdStartDG function sends a start command to the DG. DG will transition * from standby to recirculate mode and start producing warm, pure water. - * @details - * Inputs : none - * Outputs : start DG command sent + * @details Inputs: none + * @details Outputs: start DG command sent * @return none *************************************************************************/ void cmdStartDG( void ) @@ -537,9 +521,8 @@ * @brief * The cmdStopDG function sends a stop command to the DG. DG will transition * from recirculate mode to standby mode. Pumps and heater go off. - * @details - * Inputs : none - * Outputs : stop DG command sent + * @details Inputs: none + * @details Outputs: stop DG command sent * @return none *************************************************************************/ void cmdStopDG( void ) @@ -552,9 +535,8 @@ * @brief * The cmdStartDGTrimmerHeater function sends a start trimmer heater command * to the DG. - * @details - * Inputs : none - * Outputs : start DG trimmer heater command sent + * @details Inputs: none + * @details Outputs: start DG trimmer heater command sent * @return none *************************************************************************/ void cmdStartDGTrimmerHeater( void ) @@ -567,9 +549,8 @@ * @brief * The cmdStopDGTrimmerHeater function sends a stop trimmer heater command * to the DG. - * @details - * Inputs : none - * Outputs : stop DG trimmer heater command sent + * @details Inputs: none + * @details Outputs: stop DG trimmer heater command sent * @return none *************************************************************************/ void cmdStopDGTrimmerHeater( void ) @@ -582,9 +563,8 @@ * @brief * The cmdSetDGActiveReservoir function sends a set active reservoir command * message to the DG. - * @details - * Inputs : none - * Outputs : set active reservoir command sent to DG. + * @details Inputs: none + * @details Outputs: set active reservoir command sent to DG. * @param resID ID of reservoir to set as active (reservoir for HD to draw from) * @return none *************************************************************************/ @@ -604,9 +584,8 @@ /*********************************************************************//** * @brief * The cmdStartDGFill function sends a fill command message to the DG. - * @details - * Inputs : none - * Outputs : fill command sent to DG. + * @details Inputs: none + * @details Outputs: fill command sent to DG. * @param fillToVolMl volume (in mL) to fill inactive reservoir to * @return none *************************************************************************/ @@ -619,9 +598,8 @@ /*********************************************************************//** * @brief * The cmdStartDGDrain function sends a drain command message to the DG. - * @details - * Inputs : none - * Outputs : drain command sent to DG. + * @details Inputs: none + * @details Outputs: drain command sent to DG. * @param drainToVolMl volume (in mL) to drain inactive reservoir to * @return none *************************************************************************/ @@ -634,9 +612,8 @@ /*********************************************************************//** * @brief * The cmdDGSampleWater function sends a sample water command message to the DG. - * @details - * Inputs : none - * Outputs : sample water command sent to DG. + * @details Inputs: none + * @details Outputs: sample water command sent to DG. * @return none *************************************************************************/ void cmdDGSampleWater( void )