Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -r933a18d740285e70be9d00696ed0f5a5381bc8e4 -rb01542f8e4ef5a29e9b08fc0d465478de516bf02 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 933a18d740285e70be9d00696ed0f5a5381bc8e4) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision b01542f8e4ef5a29e9b08fc0d465478de516bf02) @@ -62,14 +62,14 @@ { U32 setPtPSI; F32 measFlowRateMlMin; - F32 setPWM; + F32 setPWMDutyCyclePct; } DG_RO_PUMP_DATA_PAYLOAD_T; /// Payload record structure for a drain pump data message. typedef struct { U32 setPtRPM; - F32 setPWM; + F32 setDAC; } DG_DRAIN_PUMP_DATA_PAYLOAD_T; /// Payload record structure for a DG pressures data message. Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r933a18d740285e70be9d00696ed0f5a5381bc8e4 -rb01542f8e4ef5a29e9b08fc0d465478de516bf02 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 933a18d740285e70be9d00696ed0f5a5381bc8e4) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision b01542f8e4ef5a29e9b08fc0d465478de516bf02) @@ -58,7 +58,7 @@ /// interval (ms/task time) at which the blood pump speed is calculated (every 40 ms). #define DIP_SPEED_CALC_INTERVAL ( 40 / TASK_PRIORITY_INTERVAL ) /// number of hall sensor counts kept in buffer to hold last 1 second of count data. -#define DIP_SPEED_CALC_BUFFER__LEN ( 1000 / DIP_SPEED_CALC_INTERVAL / TASK_PRIORITY_INTERVAL ) +#define DIP_SPEED_CALC_BUFFER_LEN ( 1000 / DIP_SPEED_CALC_INTERVAL / TASK_PRIORITY_INTERVAL ) #define DIP_HALL_EDGE_COUNTS_PER_REV 48 ///< number of hall sensor edge counts per motor revolution. #define DIP_MAX_FLOW_VS_SPEED_DIFF_RPM 200.0 ///< maximum difference between measured motor speed and speed implied by measured flow. @@ -164,7 +164,7 @@ static BOOL dipStopAtHomePosition = FALSE; ///< stop dialysate inlet pump at next home position static U32 dipHomeStartTime = 0; ///< when did dialysate inlet pump home command begin? (in ms) -static U16 dipLastMotorHallSensorCounts[ DIP_SPEED_CALC_BUFFER__LEN ]; ///< last hall sensor count for the blood pump motor +static U16 dipLastMotorHallSensorCounts[ DIP_SPEED_CALC_BUFFER_LEN ]; ///< last hall sensor count for the dialysate inlet pump motor static U32 dipMotorSpeedCalcIdx = 0; ///< index into 1 second buffer of motor speed hall sensor counts static U32 dipMotorSpeedCalcTimerCtr = 0; ///< counter determines interval for calculating dialysate inlet pump motor speed from hall sensor count. @@ -225,7 +225,7 @@ // zero motor hall sensors counts buffer dipMotorSpeedCalcIdx = 0; - for ( i = 0; i < DIP_SPEED_CALC_BUFFER__LEN; i++ ) + for ( i = 0; i < DIP_SPEED_CALC_BUFFER_LEN; i++ ) { dipLastMotorHallSensorCounts[ i ] = 0; } @@ -912,7 +912,7 @@ if ( ++dipMotorSpeedCalcTimerCtr >= DIP_SPEED_CALC_INTERVAL ) { U16 dipMotorHallSensorCount = getFPGADialInPumpHallSensorCount(); - U32 nextIdx = INC_WRAP( dipMotorSpeedCalcIdx, 0, DIP_SPEED_CALC_BUFFER__LEN - 1 ); + U32 nextIdx = INC_WRAP( dipMotorSpeedCalcIdx, 0, DIP_SPEED_CALC_BUFFER_LEN - 1 ); U16 incDelta = ( dipMotorHallSensorCount >= dipLastMotorHallSensorCounts[ nextIdx ] ? \ dipMotorHallSensorCount - dipLastMotorHallSensorCounts[ nextIdx ] : \ ( HEX_64_K - dipLastMotorHallSensorCounts[ nextIdx ] ) + dipMotorHallSensorCount ); Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r933a18d740285e70be9d00696ed0f5a5381bc8e4 -rb01542f8e4ef5a29e9b08fc0d465478de516bf02 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 933a18d740285e70be9d00696ed0f5a5381bc8e4) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision b01542f8e4ef5a29e9b08fc0d465478de516bf02) @@ -153,7 +153,7 @@ static BOOL dopStopAtHomePosition = FALSE; ///< stop dialysate outlet pump at next home position static U32 dopHomeStartTime = 0; ///< when did dialysate outlet pump home command begin? (in ms) -static U16 dopLastMotorHallSensorCounts[ DOP_SPEED_CALC_BUFFER__LEN ]; ///< last hall sensor count for the blood pump motor +static U16 dopLastMotorHallSensorCounts[ DOP_SPEED_CALC_BUFFER__LEN ]; ///< last hall sensor count for the dialysate outlet pump motor static U32 dopMotorSpeedCalcIdx = 0; ///< index into 1 second buffer of motor speed hall sensor counts static U32 dopMotorSpeedCalcTimerCtr = 0; ///< counter determines interval for calculating dialysate outlet pump motor speed from hall sensor count. @@ -615,20 +615,22 @@ { F32 refVol = getTotalTargetDialOutUFVolumeInMl(); F32 totVol = getTotalMeasuredUFVolumeInMl(); - F32 newPWM; - F32 deltaPWM; + F32 newPWMDutyCyclePct; + F32 deltaPWMDutyCyclePct; // get new PWM from PI controller - newPWM = runPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, refVol, totVol ); + newPWMDutyCyclePct = runPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, refVol, totVol ); // limit PWM change to max - deltaPWM = newPWM - dialOutPumpPWMDutyCyclePctSet; - if ( fabs( deltaPWM ) > MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE ) + deltaPWMDutyCyclePct = newPWMDutyCyclePct - dialOutPumpPWMDutyCyclePctSet; + if ( fabs( deltaPWMDutyCyclePct ) > MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE ) { - newPWM = ( deltaPWM < 0.0 ? dialOutPumpPWMDutyCyclePctSet - MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE : dialOutPumpPWMDutyCyclePctSet + MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE ); + newPWMDutyCyclePct = ( deltaPWMDutyCyclePct < 0.0 ? \ + dialOutPumpPWMDutyCyclePctSet - MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE : \ + dialOutPumpPWMDutyCyclePctSet + MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE ); } // set new PWM - dialOutPumpPWMDutyCyclePctSet = newPWM; - setDialOutPumpControlSignalPWM( newPWM ); + dialOutPumpPWMDutyCyclePctSet = newPWMDutyCyclePct; + setDialOutPumpControlSignalPWM( newPWMDutyCyclePct ); } dopControlTimerCounter = 0; } @@ -925,7 +927,6 @@ { errorDialOutRotorSpeedPersistTimerCtr = 0; } - } else { @@ -991,6 +992,7 @@ * GET SUPPORT FUNCTIONS *************************************************************************/ + /*********************************************************************//** * @brief * The getPublishDialOutFlowDataInterval function gets the dialysate out flow Index: firmware/App/Modes/ModeTreatmentParams.h =================================================================== diff -u -r933a18d740285e70be9d00696ed0f5a5381bc8e4 -rb01542f8e4ef5a29e9b08fc0d465478de516bf02 --- firmware/App/Modes/ModeTreatmentParams.h (.../ModeTreatmentParams.h) (revision 933a18d740285e70be9d00696ed0f5a5381bc8e4) +++ firmware/App/Modes/ModeTreatmentParams.h (.../ModeTreatmentParams.h) (revision b01542f8e4ef5a29e9b08fc0d465478de516bf02) @@ -37,36 +37,36 @@ /// Record structure for a treatment parameters payload. typedef struct { - U32 bloodFlowRate_mL_min; - U32 dialysateFlowRate_mL_min; - U32 treatmentDuration_min; - U32 heparinPreStop_min; - U32 salineBolusVolume_mL; - U32 acidConcentrate; - U32 bicarbConcentrate; - U32 dialyzerType; - U32 bloodPressureMeasurementInterval_min; - U32 rinsebackFlowRate_mL_min; - S32 arterialPressureLowLimit_mmHg; - S32 arterialPressureHighLimit_mmHg; - S32 venousPressureLowLimit_mmHg; - S32 venousPressureHighLimit_mmHg; - F32 heparinDispenseRate_mL_hr; - F32 heparinBolusVolume_mL; - F32 dialysateTemperature_degC; + U32 bloodFlowRate_mL_min; ///< User set blood flow rate (in mL/min) + U32 dialysateFlowRate_mL_min; ///< User set dialysate flow rate (in mL/min) + U32 treatmentDuration_min; ///< User set treatment duration (in min) + U32 heparinPreStop_min; ///< User set heparin pre-stop time (in min) + U32 salineBolusVolume_mL; ///< User set saline bolus volume (in mL) + U32 acidConcentrate; ///< User set acid concentrate option + U32 bicarbConcentrate; ///< User set bicarbonate concentrate option + U32 dialyzerType; ///< User set dialyzer type option + U32 bloodPressureMeasurementInterval_min; ///< User set blood pressure measurement interval (in min) + U32 rinsebackFlowRate_mL_min; ///< User set rinseback flow rate (in mL/min) + S32 arterialPressureLowLimit_mmHg; ///< User set lower alarm limit for arterial pressure (in mmHg) + S32 arterialPressureHighLimit_mmHg; ///< User set upper alarm limit for arterial pressure (in mmHg) + S32 venousPressureLowLimit_mmHg; ///< User set lower alarm limit for venous pressure (in mmHg) + S32 venousPressureHighLimit_mmHg; ///< User set upper alarm limit for venous pressure (in mmHg) + F32 heparinDispenseRate_mL_hr; ///< User set heparin dispense rate (in mL/hr) + F32 heparinBolusVolume_mL; ///< User set heparin bolus volume (in mL) + F32 dialysateTemperature_degC; ///< User set dialysate temperature (in deg C) } TREATMENT_PARAMS_DATA_PAYLOAD_T; /// Record structure for adjustable treatment parameters typedef struct { - U32 bloodFlowRate_mL_min; - U32 dialysateFlowRate_mL_min; - U32 treatmentDuration_min; - S32 arterialPressureLowLimit_mmHg; - S32 arterialPressureHighLimit_mmHg; - S32 venousPressureLowLimit_mmHg; - S32 venousPressureHighLimit_mmHg; - F32 uFVolume_L; + U32 bloodFlowRate_mL_min; ///< Original blood flow rate (in mL/min) set by user before treatment start + U32 dialysateFlowRate_mL_min; ///< Original dialysate flow rate (in mL/min) set by user before treatment start + U32 treatmentDuration_min; ///< Original treatment duration (in min) set by user before treatment start + S32 arterialPressureLowLimit_mmHg; ///< Original lower alarm limit for arterial pressure (in mmHg) set by user before treatment start + S32 arterialPressureHighLimit_mmHg; ///< Original upper alarm limit for arterial pressure (in mmHg) set by user before treatment start + S32 venousPressureLowLimit_mmHg; ///< Original lower alarm limit for venous pressure (in mmHg) set by user before treatment start + S32 venousPressureHighLimit_mmHg; ///< Original upper alarm limit for venous pressure (in mmHg) set by user before treatment start + F32 uFVolume_L; ///< Original ultrafiltration volume (in L) set by user before treatment start } ADJ_TREATMENT_PARAMS_T; // ********** Public function prototypes ********** Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r933a18d740285e70be9d00696ed0f5a5381bc8e4 -rb01542f8e4ef5a29e9b08fc0d465478de516bf02 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 933a18d740285e70be9d00696ed0f5a5381bc8e4) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision b01542f8e4ef5a29e9b08fc0d465478de516bf02) @@ -15,13 +15,9 @@ * ***************************************************************************/ -#include #include "gio.h" -#include "TaskGeneral.h" -#include "SystemCommMessages.h" -#include "OperationModes.h" - +#include "HDCommon.h" #include "ModeInitPOST.h" #include "ModeService.h" #include "ModeFault.h" @@ -30,6 +26,9 @@ #include "ModePreTreat.h" #include "ModeTreatment.h" #include "ModePostTreat.h" +#include "OperationModes.h" +#include "SystemCommMessages.h" +#include "TaskGeneral.h" /** * @addtogroup HDOperationModes Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r933a18d740285e70be9d00696ed0f5a5381bc8e4 -rb01542f8e4ef5a29e9b08fc0d465478de516bf02 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 933a18d740285e70be9d00696ed0f5a5381bc8e4) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision b01542f8e4ef5a29e9b08fc0d465478de516bf02) @@ -403,7 +403,7 @@ /*********************************************************************//** * @brief - * The sendChangePressureLimitsChangeResponse function constructs a change + * The sendPressureLimitsChangeResponse function constructs a change * pressure limits response to the UI and queues the msg for transmit on the * appropriate CAN channel. * @details Inputs: none @@ -915,11 +915,7 @@ * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details Inputs: none * @details Outputs: pressure/occlusion data msg constructed and queued. - * @param artPres Latest measured arterial pressure - * @param venPres Latest measured venous pressure - * @param bpOccl Latest measured blood pump occlusion pressure - * @param diOccl Latest measured dialysate inlet pump occlusion pressure - * @param doOccl Latest measured dialysate outlet pump occlusion pressure + * @param data Latest measured pressures and occlusion values. * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL broadcastPresOcclData( PRESSURE_OCCLUSION_DATA_T data )