Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -rb5756e5b5041288a2e95585990cce5a93756d693 -r848865316d989b1e541b234aefcb99891c92a481 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision b5756e5b5041288a2e95585990cce5a93756d693) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 848865316d989b1e541b234aefcb99891c92a481) @@ -819,14 +819,14 @@ // TODO - temporary debug code - remove later char debugFlowStr[ 256 ]; - F32 measFlowSig = getFPGABloodFlowSignalStrength() * 10000.0; + F32 measFlowSig = getFPGABloodFlowSignalStrength() * 100.0; F32 dialFlow = getMeasuredDialInFlowRate(); - F32 dialFlowSig = getFPGADialysateFlowSignalStrength() * 10000.0; + F32 dialFlowSig = getFPGADialysateFlowSignalStrength() * 100.0; F32 bldOccl = getMeasuredBloodPumpOcclusion(); F32 dpiOccl = getMeasuredDialInPumpOcclusion(); F32 dpoOccl = getMeasuredDialOutPumpOcclusion(); - sprintf( debugFlowStr, "Blood: %5d, %5d, %5d Dial-I: %5d, %5d, %5d Dial-O: %5d\n", (S32)measFlowSig, (S32)measFlow, (S32)bldOccl, (S32)dialFlowSig, (S32)dialFlow, (S32)dpiOccl, (S32)dpoOccl ); + sprintf( debugFlowStr, "Blood: %5.1f, %6.1f, %6.1f Dial-I: %5.1f, %6.1f, %6.1f Dial-O: %6.1f\n", measFlowSig, measFlow, bldOccl, dialFlowSig, dialFlow, dpiOccl, dpoOccl ); sendDebugData( (U08*)debugFlowStr, strlen(debugFlowStr) ); #else broadcastBloodFlowData( flowStPt, measFlow, measRotSpd, measSpd, measMCSpd, measMCCurr, pumpPWMPctDutyCycle ); @@ -864,6 +864,7 @@ *************************************************************************/ static void filterBloodFlowReadings( F32 flow ) { +#ifndef RAW_FLOW_SENSOR_DATA if ( flowReadingsCount >= SIZE_OF_ROLLING_AVG ) { flowReadingsTotal -= flowReadings[ flowReadingsIdx ]; @@ -873,6 +874,9 @@ flowReadingsIdx = INC_WRAP( flowReadingsIdx, 0, SIZE_OF_ROLLING_AVG - 1 ); flowReadingsCount = INC_CAP( flowReadingsCount, SIZE_OF_ROLLING_AVG ); measuredBloodFlowRate.data = flowReadingsTotal / (F32)flowReadingsCount; +#else + measuredBloodFlowRate.data = flow; +#endif } /*********************************************************************//** Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -rb5756e5b5041288a2e95585990cce5a93756d693 -r848865316d989b1e541b234aefcb99891c92a481 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision b5756e5b5041288a2e95585990cce5a93756d693) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 848865316d989b1e541b234aefcb99891c92a481) @@ -773,6 +773,7 @@ *************************************************************************/ static void filterDialInFlowReadings( F32 flow ) { +#ifndef RAW_FLOW_SENSOR_DATA if ( flowReadingsCount >= SIZE_OF_ROLLING_AVG ) { flowReadingsTotal -= flowReadings[ flowReadingsIdx ]; @@ -782,6 +783,9 @@ flowReadingsIdx = INC_WRAP( flowReadingsIdx, 0, SIZE_OF_ROLLING_AVG - 1 ); flowReadingsCount = INC_CAP( flowReadingsCount, SIZE_OF_ROLLING_AVG ); measuredDialInFlowRate.data = flowReadingsTotal / (F32)flowReadingsCount; +#else + measuredDialInFlowRate.data = flow; +#endif } /*********************************************************************//** Index: firmware/App/HDCommon.h =================================================================== diff -u -rb5756e5b5041288a2e95585990cce5a93756d693 -r848865316d989b1e541b234aefcb99891c92a481 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision b5756e5b5041288a2e95585990cce5a93756d693) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 848865316d989b1e541b234aefcb99891c92a481) @@ -43,6 +43,8 @@ #define DISABLE_PUMP_SPEED_CHECKS 1 #define DISABLE_PUMP_DIRECTION_CHECKS 1 #define DISABLE_PRESSURE_CHECKS 1 + #define DISABLE_UF_ALARMS 1 +// #define RAW_FLOW_SENSOR_DATA 1 // #define SHOW_LOAD_CELL_IN_ROTOR_RPM 1 // #define READ_FPGA_ASYNC_DATA 1 // #define FLOW_DEBUG 1 Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -r2df21d2472a8d79d78af7e359518acf3614accc5 -r848865316d989b1e541b234aefcb99891c92a481 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 2df21d2472a8d79d78af7e359518acf3614accc5) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 848865316d989b1e541b234aefcb99891c92a481) @@ -341,13 +341,12 @@ void execDialysis( void ) { // check ultrafiltration max rate and accuracy during dialysis (even when ultrafiltration is paused). -// checkUFAccuracyAndVolume(); + checkUFAccuracyAndVolume(); // dialysis state machine switch ( currentDialysisState ) { case DIALYSIS_START_STATE: -// resStartVolume = getLoadCellWeightInGrams( LOAD_CELL_RESERVOIR_1_PRIMARY ); // should be set by reservoir mgmg state machine now currentDialysisState = DIALYSIS_UF_STATE; break; @@ -500,6 +499,9 @@ uFTimeMS += msSinceLast; lastUFTimeStamp = newTime; + // update UF ref volume in UF running state only + refUFVolume += ( ( (F32)msSinceLast / MS_PER_SECOND ) / SEC_PER_MIN ) * setUFRate; + // calculate UF volumes and provide to dialysate outlet pump controller updateUFVolumes(); @@ -576,7 +578,9 @@ // check UF max rate if ( uFMeasRate > MAX_UF_RATE_ML_PER_MIN ) { +#ifndef DISABLE_UF_ALARMS SET_ALARM_WITH_1_F32_DATA( ALARM_ID_UF_RATE_TOO_HIGH_ERROR, uFMeasRate ); +#endif } // reset for next check lastUFVolumeChecked = measUFVolume; @@ -586,7 +590,9 @@ // check total UF volume error if ( ( FABS( refUFVolume - measUFVolume ) ) >= (F32)MAX_UF_ACCURACY_ERROR_ML ) { +#ifndef DISABLE_UF_ALARMS SET_ALARM_WITH_2_F32_DATA( ALARM_ID_UF_VOLUME_ACCURACY_ERROR, refUFVolume, measUFVolume ); +#endif } } @@ -617,7 +623,6 @@ } // calculate UF volumes and provide to dialysate outlet pump controller - refUFVolume = ( ( (F32)uFTimeMS / MS_PER_SECOND ) / SEC_PER_MIN ) * setUFRate; measUFVolume = measUFVolumeFromPriorReservoirs + ( latestResVolume - resStartVolume[ activeRes ] ); resFinalVolume[ activeRes ] = latestResVolume; setDialOutUFVolumes( refUFVolume, measUFVolume ); Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -rb5756e5b5041288a2e95585990cce5a93756d693 -r848865316d989b1e541b234aefcb99891c92a481 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision b5756e5b5041288a2e95585990cce5a93756d693) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 848865316d989b1e541b234aefcb99891c92a481) @@ -329,7 +329,7 @@ { // TODO - temporary debug code - remove later char debugStr[ 256 ]; - sprintf( debugStr, "ALARM triggered:%5d %8X \n", alarm, alarmData.data.uInt ); + sprintf( debugStr, "ALARM triggered:%5d %8X \n", alarm, alarmData.data.uInt.data ); sendDebugData( (U08*)debugStr, strlen(debugStr) ); } #endif @@ -362,7 +362,7 @@ { // TODO - temporary debug code - remove later char debugStr[ 256 ]; - sprintf( debugStr, "ALARM triggered:%5d %8X %8X \n", alarm, alarmData1.data.uInt, alarmData2.data.uInt ); + sprintf( debugStr, "ALARM triggered:%5d %8X %8X \n", (S32)alarm, alarmData1.data.uInt.data, alarmData2.data.uInt.data ); sendDebugData( (U08*)debugStr, strlen(debugStr) ); } #endif