Index: firmware/App/Modes/ModeTreatmentParams.c =================================================================== diff -u -rc67def50892f9a7c2f1f22985b5351465a8f6773 -r1a685471524555a374854c0c9ec8e208e71fe2df --- firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision c67def50892f9a7c2f1f22985b5351465a8f6773) +++ firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision 1a685471524555a374854c0c9ec8e208e71fe2df) @@ -85,6 +85,7 @@ static BOOL validTreatParamsReceived = FALSE; ///< Flag indicates user has provided treatment parameters. static BOOL treatParamsConfirmed = FALSE; ///< Flag indicates user has confirmed the treatment parameters. +static BOOL treatParamsRejected = FALSE; ///< Flag indicates user has rejected the treatment parameters. static BOOL treatmentCancelled = FALSE; ///< Flag indicates user has cancelled the treatment. // ********** private function prototypes ********** @@ -96,7 +97,7 @@ static BOOL checkTreatmentParamsDependencies( U32 *reasons ); static BOOL isTreatmentParamInRange( TREATMENT_PARAM_T param, CRITICAL_DATAS_T value ); static void extractTreatmentParamsFromPayload( TREATMENT_PARAMS_DATA_PAYLOAD_T payload ); -static void sendTreatmentParamsResponse( BOOL valid, U32 *reasons ); +static void sendTreatmentParamsResponse( BOOL rejected, U32 *reasons ); /*********************************************************************//** * @brief @@ -128,6 +129,7 @@ validTreatParamsReceived = FALSE; treatParamsConfirmed = FALSE; + treatParamsRejected = FALSE; treatmentCancelled = FALSE; // temporary test code. TODO - remove later @@ -159,6 +161,9 @@ // set staged parameter values to zero stagedParams[ param ].uInt = 0; } +#ifndef DISABLE_UI_TREATMENT_WORKFLOW + setTreatmentParameterF32( TREATMENT_PARAM_UF_VOLUME, 0.6 ); +#endif // zero original parameter values origTreatmentParams.bloodFlowRate_mL_min = 0; @@ -194,6 +199,28 @@ /*********************************************************************//** * @brief + * The signalUserRejectionOfTreatmentParameters function sets the user + * rejection flag signaling user has rejected treatment parameters. + * @details + * Inputs : none + * Outputs : treatParamsRejected + * @return TRUE if rejection accepted, FALSE if not + *************************************************************************/ +BOOL signalUserRejectionOfTreatmentParameters( void ) +{ + BOOL result = FALSE; + + if ( ( MODE_TPAR == getCurrentOperationMode() ) && ( HD_TREATMENT_PARAMS_MODE_STATE_WAIT_4_UI_2_CONFIRM == currentTreatmentParamsState ) ) + { + treatParamsRejected = TRUE; + result = TRUE; + } + + return result; +} + +/*********************************************************************//** + * @brief * The signalUserCancelTreatment function sets the cancelled treatment * flag signaling the user has cancelled the treatment. * @details Inputs: none @@ -243,11 +270,9 @@ break; } -#ifdef UF_TEST_ENABLED #ifdef DISABLE_UI_TREATMENT_WORKFLOW requestNewOperationMode( MODE_PRET ); #endif -#endif #ifdef RM46_EVAL_BOARD_TARGET if ( TRUE == didTimeout( start, 5000U ) ) { @@ -327,12 +352,18 @@ treatParamsConfirmed = FALSE; } + else if ( TRUE == treatParamsRejected ) + { + treatParamsRejected = FALSE; + // user rejected last parameter set, so reset them and wait for new set + resetAllTreatmentParameters(); + result = HD_TREATMENT_PARAMS_MODE_STATE_WAIT_4_UI_2_SEND; + } else if ( TRUE == treatmentCancelled ) { + treatmentCancelled = FALSE; // go back to standby mode requestNewOperationMode( MODE_STAN ); - - treatmentCancelled = FALSE; } return result; @@ -524,19 +555,20 @@ * The sendTreatmentParamsResponse function responds to the treatment parameters * received from the UI. An over-all ok/rejected flag as well as individual reject * reason codes for each parameter are provided back to the UI. - * @details Inputs: none - * @details Outputs: Response to treatment parameters message constructed and sent. - * @param valid 1 if valid, 0 if not + * @details + * Inputs : none + * Outputs : Response to treatment parameters message constructed and sent. + * @param rejected 1 if rejected, 0 if parameters ok * @param reasons array of reject reason codes for each parameter (0=not rejected) * @return none *************************************************************************/ -static void sendTreatmentParamsResponse( BOOL valid, U32 *reasons ) +static void sendTreatmentParamsResponse( BOOL rejected, U32 *reasons ) { U32 respPayload[NUM_OF_TREATMENT_PARAMS]; memcpy( &respPayload[0], &reasons[0], sizeof(TREATMENT_PARAMS_DATA_PAYLOAD_T) ); - sendTreatmentParametersResponseMsg( valid, (U08*)(&respPayload[0]), ( NUM_OF_TREATMENT_PARAMS - 1 ) * sizeof(U32) ); // UF vol. param not included in reject reasons + sendTreatmentParametersResponseMsg( rejected, (U08*)(&respPayload[0]), ( NUM_OF_TREATMENT_PARAMS - 1 ) * sizeof(U32) ); // UF vol. param not included in reject reasons } /*********************************************************************//**