Index: firmware/App/Controllers/TemperatureSensors.c =================================================================== diff -u -r6edc3ea8adbf031fe3b1522d3a14d78f238a9f30 -r3f44ec8f7a0bb4245c899abd93b23697c883024c --- firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 6edc3ea8adbf031fe3b1522d3a14d78f238a9f30) +++ firmware/App/Controllers/TemperatureSensors.c (.../TemperatureSensors.c) (revision 3f44ec8f7a0bb4245c899abd93b23697c883024c) @@ -182,6 +182,7 @@ TEMP_SENSORS_DATA_PUBLISH_INTERVAL, 0, 0 }; ///< Temperature sensors publish time interval override. static DG_TEMP_SENSORS_CAL_RECORD_T tempSensorCalRecord; ///< Temperature sensors calibration record. static DIAL_TEMP_MOVING_AVG_DATA_T dialTempMovingAvgData[ NUM_OF_DIAL_TEMPS ]; ///< Dialysate temperature moving average data. +static BOOL tempDriftEventCheck; static const F32 POSITIVE_TC_EXP_A0 = 0.118597600000E0; ///< K TC positive temperature exponent coefficient A0. static const F32 POSITIVE_TC_EXP_A1 = -0.118343200000E-3; ///< K TC positive temperature exponent coefficient A1. static const F32 POSITIVE_TC_EXP_A2 = 0.126968600000E3; ///< K TC positive temperature exponent coefficient A2. @@ -244,6 +245,7 @@ baroConvConsts.coeffsCRC.data = 0; baroConvConsts.hasCRCBeenChecked = FALSE; baroConvConsts.waitForCoeffStartTimeMS = 0; + tempDriftEventCheck = FALSE; /* NOTE: The temperature sensors do not have conversion coefficient. * The conversion coefficients are used for the heaters internal temperature sensors and @@ -635,6 +637,19 @@ BOOL isDriftOut = ( fabs( TDi - TRo ) > driftC ? TRUE : FALSE ); checkPersistentAlarm( ALARM_ID_DG_DIALYSATE_TEMPERATURE_SENSORS_OUT_OF_RANGE, isDriftOut, fabs( TDi - TRo ), driftC ); + + if ( ( FALSE == tempDriftEventCheck ) && ( TRUE == isDriftOut ) ) + { + // Send event only condition trigger, not continuously. + tempDriftEventCheck = TRUE; + SEND_EVENT_WITH_2_U32_DATA(DG_EVENT_TEMPERATURE_DRIFT, TDi, TRo) + } + + if ( ( TRUE == tempDriftEventCheck ) && ( FALSE == isDriftOut ) ) + { + tempDriftEventCheck = FALSE; + } + } break;