Index: firmware/App/Services/TxParams.h =================================================================== diff -u -r83310420ae862de4724f8cfbbaeda9936c47801b -r52787cd53986cfd0abb7e674bf096898e5070f9a --- firmware/App/Services/TxParams.h (.../TxParams.h) (revision 83310420ae862de4724f8cfbbaeda9936c47801b) +++ firmware/App/Services/TxParams.h (.../TxParams.h) (revision 52787cd53986cfd0abb7e674bf096898e5070f9a) @@ -37,6 +37,8 @@ #define MAX_UF_RATE_ML_MIN ( 2000.01F / (F32)MIN_PER_HOUR ) ///< Maximum ultrafiltration rate (in mL/min). Added small decimal to prevent float round off issues. #define MIN_UF_RATE_ML_MIN ( 0.0F ) ///< Minimum ultrafiltration rate (in mL/min). #define MAX_UF_VOLUME_ML ( 8 * ML_PER_LITER ) ///< Maximum ultrafiltration volume (in mL). +#define MIN_ISOLATED_UF_DURATION_MIN ( 30 ) ///< Minimum isolated UF session duration (in min). +#define MIN_ISOLATED_UF_VOLUME_ML ( 0.1F * (F32)ML_PER_LITER ) ///< Minimum isolated UF volume (in mL). /// Record structure for a treatment parameters payload from UI. typedef struct @@ -104,17 +106,54 @@ F32 uFVolume_L; ///< Current ultrafiltration volume (in L). } CURRENT_TREATMENT_PARAMS_DATA_PAYLOAD_T; -/// Payload record structure for treatment parameter range broadcast messages. +#pragma pack(push, 1) + +/// Payload record structure for requesting an isolated UF duration change. typedef struct { - U32 minTreatmentTime; ///< Minimum treatment duration (in minutes) - U32 maxTreatmentTime; ///< Maximum treatment duration (in minutes) - F32 minUFVolume; ///< Minimum ultrafiltration volume (in mL) - F32 maxUFVolume; ///< Maximum ultrafiltration volume (in mL) - U32 minDialRate; ///< Minimum dialysate flow rate (in mL/min) - U32 maxDialRate; ///< Maximum dialysate flow rate (in mL/min) -} TREATMENT_PARAM_RANGE_BROADCAST_PAYLOAD_T; + U32 mDuration; ///< Requested isolated UF duration in minutes. +} ISOLATED_UF_DURATION_CHANGE_REQUEST_PAYLOAD_T; +/// Payload record structure for requesting an isolated UF volume goal change. +typedef struct +{ + U32 mDuration; ///< Requested isolated UF duration in minutes. + U32 mVolume; ///< Requested isolated UF volume goal in mL. +} ISOLATED_UF_VOLUME_GOAL_CHANGE_REQUEST_PAYLOAD_T; + +/// Payload record structure for confirming an isolated UF settings change. +typedef struct +{ + U32 mConfirmed; ///< TRUE if user confirms the staged isolated UF settings. +} ISOLATED_UF_CONFIRM_REQUEST_PAYLOAD_T; + +/// Payload record structure for isolated UF duration change responses. +typedef struct +{ + U32 mAccepted; ///< Accepted/Rejected. + U32 mReason; ///< Rejection reason if not accepted. + U32 mVolumeMax; ///< Maximum isolated UF volume in mL for the requested duration. +} ISOLATED_UF_DURATION_CHANGE_RESPONSE_PAYLOAD_T; + +/// Payload record structure for isolated UF volume goal change responses. +typedef struct +{ + U32 mAccepted; ///< Accepted/Rejected. + U32 mReason; ///< Rejection reason if not accepted. + U32 mVolume; ///< Isolated UF volume goal in mL. + U32 mDuration; ///< Isolated UF duration in minutes. + U32 mRate; ///< Isolated UF rate in mL/min. +} ISOLATED_UF_VOLUME_GOAL_CHANGE_RESPONSE_PAYLOAD_T; + +/// Payload record structure for isolated UF confirmation responses. +typedef struct +{ + U32 mAccepted; ///< Accepted/Rejected. + U32 mReason; ///< Rejection reason if not accepted. +} ISOLATED_UF_CONFIRM_RESPONSE_PAYLOAD_T; + +#pragma pack(pop) + /// Payload record structure for treatment duration validate request. typedef struct { @@ -256,6 +295,11 @@ F32 getTreatmentParameterF32( TREATMENT_PARAM_T param ); // Get a specified floating point treatment parameter BOOL validateAndSetTreatmentParameters( MESSAGE_T *message ); // User provided treatment params to be set and validated +//BOOL validateAndSetUFVolume( MESSAGE_T *message ); // User provided ultrafiltration volume to be set and validated +F32 calculateIsolatedUFRateMlMin( U32 durationMin, F32 volumeGoalMl ); // Calculate isolated UF rate (mL/min) from duration and volume goal +BOOL handleIsolatedUFDurationChangeRequest( MESSAGE_T *message ); // User requested isolated UF duration change +BOOL handleIsolatedUFVolumeGoalChangeRequest( MESSAGE_T *message ); // User requested isolated UF volume goal change +BOOL handleIsolatedUFConfirmRequest( MESSAGE_T *message ); // User confirmed/rejected isolated UF settings change // Edit Treatment parameter handlers BOOL validateAndSetTreatmentDuration( MESSAGE_T *message ); // User provided treatment duration to be set and validated