Index: firmware/App/Modes/ModeTxParams.c =================================================================== diff -u -r44756f72f2b493444495fcb3067c691dda9a7920 -r52e1d4487a69a1ef0475321084527c0ba86c0892 --- firmware/App/Modes/ModeTxParams.c (.../ModeTxParams.c) (revision 44756f72f2b493444495fcb3067c691dda9a7920) +++ firmware/App/Modes/ModeTxParams.c (.../ModeTxParams.c) (revision 52e1d4487a69a1ef0475321084527c0ba86c0892) @@ -92,6 +92,12 @@ } DIALIN_SET_TX_PARAM_PAYLOAD_T; #pragma pack(pop) +/// Dialyzer volume data record structure. +typedef struct { + U32 bloodVolume; ///< Blood volume of the dialyzer in mL. + U32 dialysateVolume; ///< Dialysate volume of the dialyzer in mL. +} DIALYZER_VOLUME_DATA_T; + // ********** private data ********** static TD_TREATMENT_PARAMS_MODE_STATE_T currentTreatmentParamsState; ///< Current state of treatment parameters mode state machine. @@ -121,6 +127,16 @@ { CRITICAL_DATA_TYPE_F32, {.sFlt=0.0}, {.sFlt=8.0}, {.sFlt=0.0} }, // TREATMENT_PARAM_UF_VOLUME }; +/// Dialyzer volumes (blood and dialysate) table in mL for each type of dialyzer. +const DIALYZER_VOLUME_DATA_T dialyzerVolumeTable[ NUM_OF_DIALYZER_TYPES ] = + { { 82, 170 }, // DIALYZER_TYPE_BBRAUN_PRO_13H + { 100, 200 }, // DIALYZER_TYPE_BBRAUN_PRO_16H + { 120, 257 }, // DIALYZER_TYPE_BBRAUN_PRO_19H + { 87, 233 }, // DIALYZER_TYPE_FRESENIUS_OPTIFLUX_F160NRE + { 102, 280 }, // DIALYZER_TYPE_FRESENIUS_OPTIFLUX_F180NRE + { 113, 348 }, // DIALYZER_TYPE_FRESENIUS_OPTIFLUX_F200NRE + { 142, 304 } }; // DIALYZER_TYPE_FRESENIUS_OPTIFLUX_F250NRE + // Current treatment parameter values static CRITICAL_DATA_T treatmentParameters[ NUM_OF_TREATMENT_PARAMS ]; ///< Treatment parameters. static CRITICAL_DATAS_T stagedParams[ NUM_OF_TREATMENT_PARAMS ]; ///< Temporary staged treatment parameters for validation and awaiting user confirmation. @@ -891,6 +907,58 @@ /*********************************************************************//** * @brief + * The getDialyzerBloodVolume function gets the blood side volume (in mL) + * for a given dialyzer type. + * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given dialyzer type is invalid + * @details \b Inputs : dialyzerVolumeTable[] + * @details \b Outputs : none + * @param dialyzer The type of dialyzer to get the blood side volume for + * @return The blood side volume for the given dialyzer type + *************************************************************************/ +U32 getDialyzerBloodVolume( DIALYZER_TYPE_T dialyzer ) +{ + U32 result = 0; + + if ( dialyzer < NUM_OF_DIALYZER_TYPES ) + { + result = dialyzerVolumeTable[ dialyzer ].bloodVolume; + } + else + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_DIALYZER_TYPE_INVALID1, (U32)dialyzer ) + } + + return result; +} + +/*********************************************************************//** + * @brief + * The getDialyzerDialysateVolume function gets the dialysate side volume (in mL) + * for a given dialyzer type. + * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given dialyzer type is invalid + * @details \b Inputs : dialyzerVolumeTable[] + * @details \b Outputs : none + * @param dialyzer The type of dialyzer to get the dialysate side volume for + * @return The dialysate side volume for the given dialyzer type + *************************************************************************/ +U32 getDialyzerDialysateVolume( DIALYZER_TYPE_T dialyzer ) +{ + U32 result = 0; + + if ( dialyzer < NUM_OF_DIALYZER_TYPES ) + { + result = dialyzerVolumeTable[ dialyzer ].dialysateVolume; + } + else + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_DIALYZER_TYPE_INVALID2, (U32)dialyzer ) + } + + return result; +} + +/*********************************************************************//** + * @brief * The isTreatmentParamInRange function determines whether a given treatment * parameter is in range. * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given param is invalid