Index: firmware/App/Modes/ModeTreatmentParams.h =================================================================== diff -u -r4aa16058db700e071748f89f91e6eb58ed348ea3 -r37a9fd8f15e413db5337371a7d1a1cb65567af7c --- firmware/App/Modes/ModeTreatmentParams.h (.../ModeTreatmentParams.h) (revision 4aa16058db700e071748f89f91e6eb58ed348ea3) +++ firmware/App/Modes/ModeTreatmentParams.h (.../ModeTreatmentParams.h) (revision 37a9fd8f15e413db5337371a7d1a1cb65567af7c) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2020-2022 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 ModeTreatmentParams.h +* @file ModeTreatmentParams.h * -* @author (last) Dara Navaei -* @date (last) 05-Oct-2020 +* @author (last) Darren Cox +* @date (last) 10-Mar-2022 * -* @author (original) Sean Nash -* @date (original) 29-May-2020 +* @author (original) Sean Nash +* @date (original) 29-May-2020 * ***************************************************************************/ @@ -33,7 +33,7 @@ // ********** public definitions ********** #define MIN_PRESSURE_ALARM_LIMIT_DELTA_MMHG ( 30 ) ///< Minimum pressure alarm limit delta (in mmHg) -#define MAX_UF_RATE_ML_MIN ( 2500.0 / (F32)MIN_PER_HOUR ) ///< Maximum ultrafiltration rate (in mL/min). +#define MAX_UF_RATE_ML_MIN ( 2500.01 / (F32)MIN_PER_HOUR ) ///< Maximum ultrafiltration rate (in mL/min). Added small decimal to prevent float round off issues. #define MAX_UF_VOLUME_ML ( 8 * ML_PER_LITER ) ///< Maximum ultrafiltration volume (in mL). /// Record structure for a treatment parameters payload. @@ -47,6 +47,7 @@ U32 acidConcentrate; ///< User set acid concentrate option U32 bicarbConcentrate; ///< User set bicarbonate concentrate option U32 dialyzerType; ///< User set dialyzer type option + U32 heparinType; ///< User set heparin type option U32 bloodPressureMeasurementInterval_min; ///< User set blood pressure measurement interval (in min) U32 rinsebackFlowRate_mL_min; ///< User set rinseback flow rate (in mL/min) S32 arterialPressureLowLimit_mmHg; ///< User set lower alarm limit for arterial pressure (in mmHg) @@ -71,10 +72,21 @@ F32 uFVolume_L; ///< Original ultrafiltration volume (in L) set by user before treatment start } ADJ_TREATMENT_PARAMS_T; + +/// Record structure for current treatment parameters +typedef struct +{ + U32 accepted; ///< Accepted or rejected based on if critical data has been set. + TREATMENT_PARAMS_DATA_PAYLOAD_T treatment_parameters; ///< Record structure of treatment parameters + F32 uFVolume_L; ///< Current ultrafiltration volume (in L). + +} CURRENT_TREATMENT_PARAMS_DATA_PAYLOAD_T; + + // ********** Public function prototypes ********** void initTreatParamsMode( void ); // Initialize this module -void transitionToTreatParamsMode( void ); // Prepares for transition to treatment parameters mode +U32 transitionToTreatParamsMode( void ); // Prepares for transition to treatment parameters mode U32 execTreatParamsMode( void ); // Execute the treatment parameters mode state machine (call from OperationModes) BOOL validateAndSetTreatmentParameters( TREATMENT_PARAMS_DATA_PAYLOAD_T params ); // User provided treatment params to be set and validated @@ -88,12 +100,17 @@ BOOL setTreatmentParameterU32( TREATMENT_PARAM_T param, U32 value ); // Set a specified unsigned integer treatment parameter value BOOL setTreatmentParameterS32( TREATMENT_PARAM_T param, S32 value ); // Set a specified signed integer treatment parameter value BOOL setTreatmentParameterF32( TREATMENT_PARAM_T param, F32 value ); // Set a specified floating point treatment parameter value -U32 getTreatmentParameterU32( TREATMENT_PARAM_T param ); // Get a specified unsigned integer treatment parameter -S32 getTreatmentParameterS32( TREATMENT_PARAM_T param ); // Get a specified signed integer treatment parameter -F32 getTreatmentParameterF32( TREATMENT_PARAM_T param ); // Get a specified floating point treatment parameter +U32 getTreatmentParameterU32( TREATMENT_PARAM_T param ); // Get a specified unsigned integer treatment parameter +S32 getTreatmentParameterS32( TREATMENT_PARAM_T param ); // Get a specified signed integer treatment parameter +F32 getTreatmentParameterF32( TREATMENT_PARAM_T param ); // Get a specified floating point treatment parameter BOOL isTreatmentParamInRange( TREATMENT_PARAM_T param, CRITICAL_DATAS_T value ); // Check range for a proposed treatment parameter value +S32 getS32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_T param ); // Get the lower range limit for a signed integer treatment parameter +S32 getS32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_T param ); // Get the upper range limit for a signed integer treatment parameter +F32 getUltrafiltrationVolumeOriginal( void ); // Get the original ultrafiltration volume, set in pre-treatment mode by user. +F32 getUltrafiltrationRateOriginal( void ); // Get/calculate the original ultrafiltration rate, by ultrafiltration volume and treatment duration set in pre-treatment mode by user. BOOL testSetTreatmentParameter( TREATMENT_PARAM_T param, CRITICAL_DATAS_T value ); // Set a specific treatment parameter value +BOOL testSendCurrentTreatmentParameters(); // Update current treatment parameters /**@}*/