Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -r1aeab08c1baf6445514b81fe51fc60a3e536e782 -r7d293e18ea5ac0fce443c68525100e44df80b4fd --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 1aeab08c1baf6445514b81fe51fc60a3e536e782) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 7d293e18ea5ac0fce443c68525100e44df80b4fd) @@ -69,6 +69,7 @@ static U32 reservoirWeightUnchangeStartTime[ NUM_OF_DG_RESERVOIRS ] = { 0, 0 }; ///< The reservoirs' weight start time when weight stop decreasing. static BOOL tareLoadCellRequest; ///< Flag indicates if load cell tare has been requested by HD. static DG_RESERVOIR_VOLUME_RECORD_T reservoirsCalRecord; ///< DG reservoirs non-volatile record. +static F32 targetFillFlowRateLPM; // ********** private function prototypes ********** @@ -78,14 +79,16 @@ * @brief * The initReservoirs function initializes the Reservoirs module. * @details Inputs: none - * @details Outputs: Reservoirs module initialized + * @details Outputs: activeReservoir.data, fillVolumeTargetMl.data, + * drainVolumeTargetMl.data, targetFillFlowRateLPM * @return none *************************************************************************/ void initReservoirs( void ) { - activeReservoir.data = (U32)DG_RESERVOIR_1; - fillVolumeTargetMl.data = DEFAULT_FILL_VOLUME_ML; - drainVolumeTargetMl.data = DEFAULT_DRAIN_VOLUME_ML; + activeReservoir.data = (U32)DG_RESERVOIR_1; + fillVolumeTargetMl.data = DEFAULT_FILL_VOLUME_ML; + drainVolumeTargetMl.data = DEFAULT_DRAIN_VOLUME_ML; + targetFillFlowRateLPM = 0.0; } /*********************************************************************//** @@ -248,25 +251,26 @@ * The startFillCmd function handles a fill command from the HD. * @details Inputs: none * @details Outputs: move to fill mode - * @param fillToVolMl Target volume (in mL) to fill reservoir to + * @param fillToVolMl target volume (in mL) to fill reservoir to + * @param fillTargeteFlowLPM target fill flow rate in L/min * @return none *************************************************************************/ -void startFillCmd( U32 fillToVolMl ) +void startFillCmd( U32 fillToVolMl, F32 fillTargetLPM ) { DG_CMD_RESPONSE_T cmdResponse; - cmdResponse.commandID = DG_CMD_START_FILL; - cmdResponse.rejected = TRUE; + cmdResponse.commandID = DG_CMD_START_FILL; + cmdResponse.rejected = TRUE; cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_NONE; // fill command only valid in generation idle mode - if ( ( DG_MODE_GENE == getCurrentOperationMode() ) && - ( DG_GEN_IDLE_MODE_STATE_FLUSH_WATER == getCurrentGenIdleState() ) ) + if ( ( DG_MODE_GENE == getCurrentOperationMode() ) && ( DG_GEN_IDLE_MODE_STATE_FLUSH_WATER == getCurrentGenIdleState() ) ) { // validate parameters if ( fillToVolMl < MAX_FILL_VOLUME_ML ) { fillVolumeTargetMl.data = fillToVolMl; + requestNewOperationMode( DG_MODE_FILL ); cmdResponse.rejected = FALSE; } @@ -280,6 +284,8 @@ cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_INVALID_MODE; } + targetFillFlowRateLPM = fillTargetLPM; + sendCommandResponseMsg( &cmdResponse ); } @@ -433,7 +439,7 @@ * @brief * The getReservoirWeight function returns the small filtered weight * of the reservoir's associated load cell. - * @details Inputs: associatedLoadCell[] + * @details Inputs: none * @details Outputs: none * @param reservoirId id of reservoir to get weight from * @return small filtered weight @@ -445,6 +451,19 @@ /*********************************************************************//** * @brief + * The getTargetFillFlowRateLPM function returns the target fill flow rate + * in L/min. + * @details Inputs: none + * @details Outputs: none + * @return target fill flow rate in L/min + *************************************************************************/ +F32 getTargetFillFlowRateLPM( void ) +{ + return targetFillFlowRateLPM; +} + +/*********************************************************************//** + * @brief * The getReservoirsCalRecord function returns the reservoirs' calibration * record. * @details Inputs: reservoirsCalRecord