Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r562333878837ad2ff1efa6e61e6cdbf332227fec -rc653aeb570c11e65ab6859f966c6081c8e3de318 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 562333878837ad2ff1efa6e61e6cdbf332227fec) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision c653aeb570c11e65ab6859f966c6081c8e3de318) @@ -182,9 +182,9 @@ static U32 errorDialInRotorSpeedPersistTimerCtr = 0; ///< Persistence timer counter for rotor speed error condition. static U32 errorDialInPumpDirectionPersistTimerCtr = 0; ///< Persistence timer counter for pump direction error condition. -static F32 flowReadings[ SIZE_OF_ROLLING_AVG ]; ///< Holds flow samples for a rolling average. +static F64 flowReadings[ SIZE_OF_ROLLING_AVG ]; ///< Holds flow samples for a rolling average. static U32 flowReadingsIdx = 0; ///< Index for next sample in rolling average array. -static F32 flowReadingsTotal = 0.0; ///< Rolling total - used to calc average. +static F64 flowReadingsTotal = 0.0; ///< Rolling total - used to calc average. static U32 flowReadingsCount = 0; ///< Number of samples in flow rolling average buffer. static U32 dipCurrErrorDurationCtr = 0; ///< Used for tracking persistence of dip current errors. @@ -201,7 +201,7 @@ static void setDialInPumpDirection( MOTOR_DIR_T dir ); static void publishDialInFlowData( void ); static void resetDialInFlowMovingAverage( void ); -static void filterDialInFlowReadings( F32 flow ); +static void filterDialInFlowReadings( F64 flow ); static void updateDialInPumpSpeedAndDirectionFromHallSensors( void ); static void checkDialInPumpRotor( void ); static void checkDialInPumpDirection( void ); @@ -406,12 +406,12 @@ U08 spReadCtr = getFPGADialysateFlowSlowPacketReadCounter(); U08 flowErrorCtr = getFPGADialysateFlowErrorCounter(); U08 flowStatus = getFPGADialysateFlowMeterStatus(); - F32 dipFlow; + F64 dipFlow; // Process new dialysate flow readings if ( TRUE == getDialysateFlowDataFreshFlag() ) { - dipFlow = getDGDialysateFlowRateLMin() * (F32)ML_PER_LITER; // convert rate to mL/min + dipFlow = getDGDialysateFlowRateLMin() * (F64)ML_PER_LITER; // convert rate to mL/min filterDialInFlowReadings( dipFlow ); // process the fresh dialysate flow data dialysateFlowDataFreshStatusCounter = 0; // reset counter } @@ -880,7 +880,7 @@ * @details Outputs: flowReadings[], flowReadingsIdx, flowReadingsCount, flowReadingsTotal * @return none *************************************************************************/ -void filterDialInFlowReadings( F32 flow ) +void filterDialInFlowReadings( F64 flow ) { if ( flowReadingsCount >= SIZE_OF_ROLLING_AVG ) { @@ -890,7 +890,7 @@ flowReadingsTotal += flow; flowReadingsIdx = INC_WRAP( flowReadingsIdx, 0, SIZE_OF_ROLLING_AVG - 1 ); flowReadingsCount = INC_CAP( flowReadingsCount, SIZE_OF_ROLLING_AVG ); - measuredDialInFlowRate.data = flowReadingsTotal / (F32)flowReadingsCount; + measuredDialInFlowRate.data = (F32)( flowReadingsTotal / (F64)flowReadingsCount ); } /*********************************************************************//**