Index: firmware/App/Monitors/Pressures.c =================================================================== diff -u -rd595ea4a23b0b2371e31838c24990059653c1871 -r312045692a83bb40857b7ff055c454c5e05a60ea --- firmware/App/Monitors/Pressures.c (.../Pressures.c) (revision d595ea4a23b0b2371e31838c24990059653c1871) +++ firmware/App/Monitors/Pressures.c (.../Pressures.c) (revision 312045692a83bb40857b7ff055c454c5e05a60ea) @@ -18,6 +18,7 @@ #include "AirPump.h" #include "AlarmMgmtTD.h" //#include "BloodFlow.h" +#include "DDInterface.h" #include "FpgaTD.h" #include "Messaging.h" //#include "ModeTreatment.h" @@ -134,10 +135,11 @@ static S32 currentVenousMinLimit; ///< Minimum venous pressure limit (in mmHg). static BOOL pressureLimitsActive; ///< Flag indicates whether arterial and venous pressure alarm limits are active. static U32 stabilizationStartTimeMs; ///< Timestamp taken when pressure limit stabilization began (ms). -static F32 longFilteredArterialPressure; ///< Measured arterial pressure after long (10 s) filter. -static OVERRIDE_F32_T shortFilteredArterialPressure; ///< Measured arterial pressure after short (1 s) filter. -static F32 longFilteredVenousPressure; ///< Measured venous pressure after long (10 s) filter. -static OVERRIDE_F32_T shortFilteredVenousPressure; ///< Measured venous pressure after short (1 s) filter. +static F32 longFilteredArterialPressure; ///< Measured arterial pressure after long (10 s) filter (in mmHg). +static OVERRIDE_F32_T shortFilteredArterialPressure; ///< Measured arterial pressure after short (1 s) filter (in mmHg). +static F32 longFilteredVenousPressure; ///< Measured venous pressure after long (10 s) filter (in mmHg). +static OVERRIDE_F32_T shortFilteredVenousPressure; ///< Measured venous pressure after short (1 s) filter (in mmHg). +static OVERRIDE_F32_T tmpPressure; ///< Calculated trans-membrane pressure (in mmHg). static STABILIZATION_PERIODS_T pressureStabilizeTime; ///< Pressure stabilization time based on system events such as airpump, treatment param changes etc., static BOOL resetFillExemptPeriod; ///< Flag to reset the exempt period after defined time expire. static BOOL lowVenousPressureExemptCheck; ///< low venous pressure exempt check flag based on the air trap valve status @@ -224,6 +226,10 @@ shortFilteredVenousPressure.ovData = 0.0F; shortFilteredVenousPressure.ovInitData = 0.0F; shortFilteredVenousPressure.override = OVERRIDE_RESET; + tmpPressure.data = 0.0F; + tmpPressure.ovData = 0.0F; + tmpPressure.ovInitData = 0.0F; + tmpPressure.override = OVERRIDE_RESET; pressureDataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; pressureState = PRESSURE_WAIT_FOR_POST_STATE; @@ -526,6 +532,9 @@ // Filter inline pressure readings filterInlinePressureReadings( fpgaArtPres, fpgaVenPres ); + // Get latest dialysate pressure so we can calculate TMP + tmpPressure.data = getLongFilteredVenousPressure() - getDialysatePressure(); + // Handle pressure limits state machine execPressureLimits(); @@ -889,6 +898,18 @@ /*********************************************************************//** * @brief + * The getTMPPressure function gets the calculated trans-membrane pressure. + * @details \b Inputs: tmpPressure + * @details \b Outputs: none + * @return the current calculated TMP (in mmHg). + *************************************************************************/ +F32 getTMPPressure( void ) +{ + return getF32OverrideValue( &tmpPressure ); +} + +/*********************************************************************//** + * @brief * The filterInlinePressureReadings function adds a new arterial and venous * pressure sample to the filters. * @details \b Inputs: none @@ -975,9 +996,9 @@ data.h14MaxLimit = currentVenousMaxLimit; data.h2LongFilterPres = longFilteredArterialPressure; data.h14LongFilterPres = longFilteredVenousPressure; - data.tmpPressure = 0.0F; - data.tmpMinLimit = 0.0F; - data.tmpMaxLimit = 0.0F; + data.tmpPressure = getTMPPressure(); + data.tmpMinLimit = -400.0F; // TODO - use windowed min/max values based on user set params when implemented + data.tmpMaxLimit = 100.0F; broadcastData( MSG_ID_TD_PRESSURE_DATA, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08*)&data, sizeof( PRESSURE_DATA_T ) ); pressureDataPublicationTimerCounter = 0; Index: firmware/App/Monitors/Pressures.h =================================================================== diff -u -rd595ea4a23b0b2371e31838c24990059653c1871 -r312045692a83bb40857b7ff055c454c5e05a60ea --- firmware/App/Monitors/Pressures.h (.../Pressures.h) (revision d595ea4a23b0b2371e31838c24990059653c1871) +++ firmware/App/Monitors/Pressures.h (.../Pressures.h) (revision 312045692a83bb40857b7ff055c454c5e05a60ea) @@ -90,6 +90,7 @@ F32 getLongFilteredArterialPressure( void ); F32 getFilteredVenousPressure( void ); F32 getLongFilteredVenousPressure( void ); +F32 getTMPPressure( void ); BOOL testPressuresDataPublishIntervalOverride( MESSAGE_T *message ); Index: firmware/App/Services/DDInterface.c =================================================================== diff -u -rd595ea4a23b0b2371e31838c24990059653c1871 -r312045692a83bb40857b7ff055c454c5e05a60ea --- firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision d595ea4a23b0b2371e31838c24990059653c1871) +++ firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision 312045692a83bb40857b7ff055c454c5e05a60ea) @@ -326,7 +326,7 @@ checkPersistentAlarm( alarmID, FALSE, 0.0, 0.0 ); } else - { // Alarm if not receiving DG fresh data message in timely manner + { // Alarm if not receiving DD fresh data message in timely manner if ( TRUE == isDDCommunicating() ) { checkPersistentAlarm( alarmID, TRUE, 0.0, 0.0 );