Index: firmware/App/Modes/Rinseback.c =================================================================== diff -u -r580a23d5d8e27f8914cbbdc8d9721ef77e16621e -rec17ff0ee8477fde41197b5cadb5b665cf56fd75 --- firmware/App/Modes/Rinseback.c (.../Rinseback.c) (revision 580a23d5d8e27f8914cbbdc8d9721ef77e16621e) +++ firmware/App/Modes/Rinseback.c (.../Rinseback.c) (revision ec17ff0ee8477fde41197b5cadb5b665cf56fd75) @@ -7,8 +7,8 @@ * * @file Rinseback.c * -* @author (last) Sean Nash -* @date (last) 29-Nov-2023 +* @author (last) Vinayakam Mani +* @date (last) 10-Apr-2024 * * @author (original) Sean Nash * @date (original) 20-Jan-2021 @@ -45,6 +45,7 @@ #define DEFAULT_RINSEBACK_FLOW_RATE_ML_MIN 200 ///< Default rinseback flow rate (in mL/min). #define MIN_RINSEBACK_FLOW_RATE_ML_MIN 100 ///< Minimum rinseback flow rate (in mL/min). #define MAX_RINSEBACK_FLOW_RATE_ML_MIN 300 ///< Maximum rinseback flow rate (in mL/min). +#define DEFAULT_FILL_RESERVOIR_TO_VOLUME_ML 1500 ///< default Fill reservoir to this volume (in mL). /// Interval at which rinseback progress is to be published to UI. #define RINSEBACK_DATA_PUBLISH_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) @@ -188,6 +189,20 @@ stopSyringePump(); endAirTrapControl(); + // If DG restarted for some reason, lets make sure we set the heating parameters first before commanding to + // turn on the trimmer heater and start the DG as well. + if ( DG_MODE_STAN == getDGOpMode() ) + { + F32 targetTempC = getTreatmentParameterF32( TREATMENT_PARAM_DIALYSATE_TEMPERATURE ); + U32 dialysateFlowMLPM = getTreatmentParameterU32( TREATMENT_PARAM_DIALYSATE_FLOW ); + + // Set the heating parameters + setPreTreatmentHeatingParams( targetTempC, DEFAULT_FILL_RESERVOIR_TO_VOLUME_ML, DEFAULT_TARGET_FILL_FLOW_RATE_LPM, dialysateFlowMLPM ); + + // Start the DG + cmdStartDG(); + } + // Re-circulate dialysate side of dialyzer w/ heating to maintain temperature setDialInPumpTargetFlowRate( DIALYSATE_FLOW_RATE_FOR_RECIRC, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); cmdStartDGTrimmerHeater(); @@ -212,6 +227,21 @@ setBloodPumpTargetFlowRate( rate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); // Start air trap leveling control startAirTrapControl(); + + // If DG restarted for some reason, lets make sure we set the heating parameters first before commanding to + // turn on the trimmer heater and start the DG as well. + if ( DG_MODE_STAN == getDGOpMode() ) + { + F32 targetTempC = getTreatmentParameterF32( TREATMENT_PARAM_DIALYSATE_TEMPERATURE ); + U32 dialysateFlowMLPM = getTreatmentParameterU32( TREATMENT_PARAM_DIALYSATE_FLOW ); + + // Set the heating parameters + setPreTreatmentHeatingParams( targetTempC, DEFAULT_FILL_RESERVOIR_TO_VOLUME_ML, DEFAULT_TARGET_FILL_FLOW_RATE_LPM, dialysateFlowMLPM ); + + // Start the DG + cmdStartDG(); + } + // Re-circulate dialysate side of dialyzer w/ heating to maintain temperature setDialInPumpTargetFlowRate( DIALYSATE_FLOW_RATE_FOR_RECIRC, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); cmdStartDGTrimmerHeater();