Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -rf760ffc4b10556e5186e9ceb90294262063440ca -r270b4665c25617158ef06c1819debfb5bd59a942 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision f760ffc4b10556e5186e9ceb90294262063440ca) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 270b4665c25617158ef06c1819debfb5bd59a942) @@ -79,7 +79,8 @@ static F32 lgLoadCellBackupReadingsTotal[ NUM_OF_DG_RESERVOIRS ]; ///< Rolling total - used to calc large load cell moving average. // DG Dialysate flow rate -static F32 dgDialysateFlowRateMlMin = 0.0; ///< Latest dialysate flow rate reported by the DG. +static F32 dgDialysateFlowRateLMin; ///< Latest dialysate flow rate (in L/min) reported by the DG. +static F32 dgDialysateFlowRateRawLMin; ///< Latest raw dialysate flow rate (in L/min) reported by the DG. static BOOL dgDialysateFlowDataFreshFlag = FALSE; ///< Flag to signal the execDialInFlowMonitor() to process fresh flow rate data static BOOL dgLoadCellDataFreshFlag = FALSE; ///< Flag to signal the handleLoadCellReadingsFromDG() to process fresh load cell data static BOOL dgDialysateTemperatureDataFreshFlag = FALSE; ///< Flag to signal the handleTemperatureReadingsFromDG() to process fresh temperature data @@ -131,7 +132,8 @@ dgCurrentOpMode = DG_MODE_INIT; dgSubMode = 0; dgStartCommandSent = FALSE; - dgDialysateFlowRateMlMin = 0.0F; + dgDialysateFlowRateLMin = 0.0F; + dgDialysateFlowRateRawLMin = 0.0F; dgDialysateFlowDataFreshFlag = FALSE; dgHeatDisinfectTemp = 0.0F; @@ -309,19 +311,34 @@ * @brief * The getDGDialysateFlowRateLMin function gets the latest dialysate flow * rate reported by the DG. - * @details Inputs: dgDialysateFlowRateMlMin + * @details Inputs: dgDialysateFlowRateLMin * @details Outputs: none * @return Latest dialysate flow rate (in L/min) reported by DG. *************************************************************************/ F32 getDGDialysateFlowRateLMin( void ) { - F32 result = dgDialysateFlowRateMlMin; + F32 result = dgDialysateFlowRateLMin; return result; } /*********************************************************************//** * @brief + * The getDGRawDialysateFlowRateLMin function gets the latest raw dialysate flow + * rate reported by the DG. + * @details Inputs: dgDialysateFlowRateRawLMin + * @details Outputs: none + * @return Latest dialysate flow rate (in L/min) reported by DG. + *************************************************************************/ +F32 getDGRawDialysateFlowRateLMin( void ) +{ + F32 result = dgDialysateFlowRateRawLMin; + + return result; +} + +/*********************************************************************//** + * @brief * The getDialysateFlowDataFreshFlag function returns a flag to indicate * if the dialysate flow rate data reported by the DG is fresh or stale data. * @details Inputs: dgDialysateFlowDataFreshFlag @@ -569,19 +586,25 @@ * The setDialysateFlowData function sets the latest dialysate flow rate * and its freshness status. The dialysate flow data is reported by the DG. * @details Inputs: none - * @details Outputs: dgDialysateFlowRateMlMin, dgDialysateFlowDataFreshFlag - * @param flowRate latest dialysate flow rate (mL/min) reported by DG + * @details Outputs: dgDialysateFlowRateLMin, dgDialysateFlowRateRawLMin, + * dgDialysateFlowDataFreshFlag + * @param flowRates latest DG flow rates (mL/min) reported by DG * @return none *************************************************************************/ -void setDialysateFlowData( F32 flowRate ) +void setDialysateFlowData( FLOW_SENSORS_DATA_T flowRates ) { // Check if the sent value by DG is a NaN - if ( isnan( flowRate ) ) + if ( isnan( flowRates.dialysateFlowRateLPM ) ) { - flowRate = 0.0; + flowRates.dialysateFlowRateLPM = 0.0F; } + if ( isnan( flowRates.dialysateRawFlowRateLPM ) ) + { + flowRates.dialysateRawFlowRateLPM = 0.0F; + } - dgDialysateFlowRateMlMin = flowRate; + dgDialysateFlowRateLMin = flowRates.dialysateFlowRateLPM; + dgDialysateFlowRateRawLMin = flowRates.dialysateRawFlowRateLPM; dgDialysateFlowDataFreshFlag = TRUE; } Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -rf760ffc4b10556e5186e9ceb90294262063440ca -r270b4665c25617158ef06c1819debfb5bd59a942 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision f760ffc4b10556e5186e9ceb90294262063440ca) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 270b4665c25617158ef06c1819debfb5bd59a942) @@ -90,16 +90,6 @@ U32 flushUIState; ///< DG flush UI state } DG_DISINFECT_UI_STATES_T; -/// Dialysate heating parameters -typedef struct -{ - F32 trimmerTargetTemperature; ///< Trimmer target temperature - U32 timeReservoirCycleMS; ///< Reservoir cycle time in milliseconds - F32 timeReservoirFillMS; ///< Reservoir fill time in milliseconds - U32 timeReservoirWait2SwitchMS; ///< Reservoir wait to switch time in milliseconds - F32 dialysateFlowLPM; ///< Dialysate flow in L/min -} DG_CMD_DIALYSATE_HEATING_PARAMS_T; - /// HD version of the DG service record typedef struct { @@ -121,7 +111,8 @@ DG_RESERVOIR_ID_T getDGInactiveReservoir( void ); BOOL hasDGCompletedReservoirSwitch( void ); BOOL getDialysateFlowDataFreshFlag( void ); -F32 getDGDialysateFlowRateLMin( void ); +F32 getDGDialysateFlowRateLMin( void ); +F32 getDGRawDialysateFlowRateLMin( void ); F32 getLoadCellWeight( LOAD_CELL_ID_T loadCellID ); F32 getReservoirWeight( DG_RESERVOIR_ID_T resID ); F32 getReservoirWeightLargeFilter( DG_RESERVOIR_ID_T resID ); @@ -135,7 +126,7 @@ void setDGOpMode( U32 opMode, U32 subMode ); void setDialysateTemperatureReadings( F32 tdi, F32 tro, F32 thd ); void setDGReservoirsData( DG_RESERVOIR_ID_T resID, U32 fillVol, U32 drainVol ); -void setDialysateFlowData( F32 flowRate ); +void setDialysateFlowData( FLOW_SENSORS_DATA_T flowRates ); void setNewLoadCellReadings( F32 res1Primary, F32 res1Backup, F32 res2Primary, F32 res2Backup ); void setDGDisinfectsStates( DG_DISINFECT_UI_STATES_T states ); void setDGMixingRatios( DG_MIXING_RATIOS_T ratios ); Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r4c5ab126c8c33f9a5dcc58cef8933bbe0b1c25b4 -r270b4665c25617158ef06c1819debfb5bd59a942 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 4c5ab126c8c33f9a5dcc58cef8933bbe0b1c25b4) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 270b4665c25617158ef06c1819debfb5bd59a942) @@ -50,7 +50,7 @@ #define MAX_DIAL_IN_PUMP_PWM_STEP_DN_CHANGE 0.02F ///< Max duty cycle change when ramping down ~ 300 mL/min/s. #define MAX_DIAL_IN_PUMP_PWM_DUTY_CYCLE 0.90F ///< Controller will error if PWM duty cycle > 90%, so set max to 90%. #define MIN_DIAL_IN_PUMP_PWM_DUTY_CYCLE 0.10F ///< Controller will error if PWM duty cycle < 10%, so set min to 10%. -#define MIN_DG_DIAL_FLOW_RATE 10.0F ///< Minimum DG Dialysate Flow Rate (mL/Min) - DN-9NOV2022 +#define MIN_DG_DIAL_FLOW_RATE 10.0F ///< Minimum DG Dialysate Flow Rate (mL/Min) #define DIP_CONTROL_INTERVAL_SEC 4 ///< Dialysate inlet pump control interval (in seconds). /// Interval (ms/task time) at which the dialIn pump is controlled. @@ -74,7 +74,7 @@ #define DIP_MAX_MOTOR_SPEED_VS_TRGT_DIFF_PCT 0.15F ///< Maximum motor speed vs target difference in percent. /// Persist time (task intervals) for unexpected flow check failure condition. -static const U32 DIP_UNEXP_FLOW_CHK_PERSIST = ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL); +static const U32 DIP_NO_FLOW_CHK_PERSIST = ((10 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL); /// Persist time (task intervals) for motor off error condition. static const U32 DIP_OFF_ERROR_PERSIST = ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL); /// Persist time (task intervals) motor speed error condition. @@ -276,7 +276,7 @@ // Initialize persistent alarm for flow sensor signal strength too low initPersistentAlarm( ALARM_ID_HD_DIAL_IN_FLOW_OUT_OF_RANGE, 0, DIP_MAX_FLOW_RATE_OUT_OF_RANGE_PERSIST ); - initPersistentAlarm( ALARM_ID_HD_DIAL_IN_FLOW_CHECK_FAILURE, DIP_UNEXP_FLOW_CHK_PERSIST, DIP_UNEXP_FLOW_CHK_PERSIST ); + initPersistentAlarm( ALARM_ID_HD_DIAL_IN_FLOW_CHECK_FAILURE, 0, DIP_NO_FLOW_CHK_PERSIST ); initTimeWindowedCount( TIME_WINDOWED_COUNT_DIP_COMMUTATION_ERROR, DIP_COMMUTATION_ERROR_MAX_CNT, DIP_COMMUTATION_ERROR_TIME_WIN_MS ); } @@ -1414,10 +1414,9 @@ } // Check DG Dialysate flow rate - /* TODO: Temporarily comment this out. Will restore it when know better how to handle this alarm. if ( ( TRUE == isDialInPumpRunning() ) && ( dialInPumpControlMode != PUMP_CONTROL_MODE_OPEN_LOOP ) ) { - F32 measuredDialInFlow = getDGDialysateFlowRateLMin() * ML_PER_LITER; + F32 measuredDialInFlow = getDGRawDialysateFlowRateLMin() * ML_PER_LITER; if ( ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_DIAL_IN_FLOW_CHECK_FAILURE, measuredDialInFlow < MIN_DG_DIAL_FLOW_RATE ) ) ) { @@ -1427,7 +1426,7 @@ else { isPersistentAlarmTriggered( ALARM_ID_HD_DIAL_IN_FLOW_CHECK_FAILURE, FALSE ); - } */ + } } /*********************************************************************//** Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -raa8b9687b9396b4878cf0d5327d72a5d67477761 -r270b4665c25617158ef06c1819debfb5bd59a942 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision aa8b9687b9396b4878cf0d5327d72a5d67477761) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 270b4665c25617158ef06c1819debfb5bd59a942) @@ -2370,7 +2370,7 @@ FLOW_SENSORS_DATA_T payload; memcpy( &payload, message->payload, sizeof( FLOW_SENSORS_DATA_T ) ); - setDialysateFlowData( payload.dialysateFlowRateLPM ); + setDialysateFlowData( payload ); } }