Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -rb01542f8e4ef5a29e9b08fc0d465478de516bf02 -ra2bc96881a5fc3d8f779246b2abebf15a8de9384 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision b01542f8e4ef5a29e9b08fc0d465478de516bf02) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision a2bc96881a5fc3d8f779246b2abebf15a8de9384) @@ -55,21 +55,21 @@ #define DOP_P_COEFFICIENT 0.0050 ///< P term for dialysate outlet pump control. #define DOP_I_COEFFICIENT 0.0001 ///< I term for dialysate outlet pump control. -#define DOP_HOME_RATE 100 ///< target pump speed (in estimate mL/min) for homing. -#define DOP_HOME_TIMEOUT_MS 10000 ///< maximum time allowed for homing to complete (in ms). -/// interval (ms/task time) at which the blood pump speed is calculated (every 40 ms). +#define DOP_HOME_RATE 100 ///< Target pump speed (in estimate mL/min) for homing. +#define DOP_HOME_TIMEOUT_MS 10000 ///< Maximum time allowed for homing to complete (in ms). +/// Interval (ms/task time) at which the blood pump speed is calculated (every 40 ms). #define DOP_SPEED_CALC_INTERVAL ( 40 / TASK_PRIORITY_INTERVAL ) -/// number of hall sensor counts kept in buffer to hold last 1 second of count data. +/// Number of hall sensor counts kept in buffer to hold last 1 second of count data. #define DOP_SPEED_CALC_BUFFER__LEN ( 1000 / DOP_SPEED_CALC_INTERVAL / TASK_PRIORITY_INTERVAL ) -#define DOP_HALL_EDGE_COUNTS_PER_REV 48 ///< number of hall sensor edge counts per motor revolution. +#define DOP_HALL_EDGE_COUNTS_PER_REV 48 ///< Number of hall sensor edge counts per motor revolution. -#define DOP_MAX_MOTOR_SPEED_WHILE_OFF_RPM 100.0 ///< maximum motor speed (RPM) while motor is commanded off. -#define DOP_MAX_ROTOR_VS_MOTOR_DIFF_RPM 5.0 ///< maximum difference in speed between motor and rotor (in rotor RPM). -#define DOP_MAX_MOTOR_SPEED_ERROR_RPM 300.0 ///< maximum difference in speed between measured and commanded RPM. -#define DOP_OFF_ERROR_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< persist time (task intervals) for motor off error condition. -#define DOP_MOTOR_SPEED_ERROR_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< persist time (task intervals) motor speed error condition. -#define DOP_ROTOR_SPEED_ERROR_PERSIST ((12 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< persist time (task intervals) rotor speed error condition. -#define DOP_DIRECTION_ERROR_PERSIST (250 / TASK_PRIORITY_INTERVAL) ///< persist time (task intervals) pump direction error condition. +#define DOP_MAX_MOTOR_SPEED_WHILE_OFF_RPM 100.0 ///< Maximum motor speed (RPM) while motor is commanded off. +#define DOP_MAX_ROTOR_VS_MOTOR_DIFF_RPM 5.0 ///< Maximum difference in speed between motor and rotor (in rotor RPM). +#define DOP_MAX_MOTOR_SPEED_ERROR_RPM 300.0 ///< Maximum difference in speed between measured and commanded RPM. +#define DOP_OFF_ERROR_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) for motor off error condition. +#define DOP_MOTOR_SPEED_ERROR_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) motor speed error condition. +#define DOP_ROTOR_SPEED_ERROR_PERSIST ((12 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) rotor speed error condition. +#define DOP_DIRECTION_ERROR_PERSIST (250 / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) pump direction error condition. #define DOP_MAX_CURR_WHEN_STOPPED_MA 150.0 ///< Motor controller current should not exceed this when pump should be stopped. #define DOP_MIN_CURR_WHEN_RUNNING_MA 150.0 ///< Motor controller current should always exceed this when pump should be running. @@ -111,15 +111,10 @@ NUM_OF_DIAL_OUT_PUMP_SELF_TEST_STATES ///< Number of dialysate outlet pump self-test states. } DIAL_OUT_PUMP_SELF_TEST_STATE_T; -// pin assignments and macros for pump stop and direction outputs +// Pin assignments and macros for pump stop and direction outputs #define STOP_DO_PUMP_MIBSPI1_PORT_MASK 0x00000400 ///< MIBSPI1 SIMO[0] - re-purposed as GPIOoutput for pump controller run/stop pin. -#ifndef BREADBOARD_TARGET - #define SET_DOP_STOP() {mibspiREG1->PC3 &= ~STOP_DO_PUMP_MIBSPI1_PORT_MASK;} ///< Macro sets pump controller run/stop signal to stop. - #define CLR_DOP_STOP() {mibspiREG1->PC3 |= STOP_DO_PUMP_MIBSPI1_PORT_MASK;} ///< Macro sets pump controller run/stop signal to run. -#else - #define SET_DOP_STOP() {mibspiREG1->PC3 |= STOP_DO_PUMP_MIBSPI1_PORT_MASK;} ///< Macro sets pump controller run/stop signal to stop. - #define CLR_DOP_STOP() {mibspiREG1->PC3 &= ~STOP_DO_PUMP_MIBSPI1_PORT_MASK;} ///< Macro sets pump controller run/stop signal to run. -#endif +#define SET_DOP_STOP() {mibspiREG1->PC3 &= ~STOP_DO_PUMP_MIBSPI1_PORT_MASK;} ///< Macro sets pump controller run/stop signal to stop. +#define CLR_DOP_STOP() {mibspiREG1->PC3 |= STOP_DO_PUMP_MIBSPI1_PORT_MASK;} ///< Macro sets pump controller run/stop signal to run. #define STOP_DO_PUMP_GIO_PORT_PIN 6U ///< GIO port A pin used for pump controller direction pin. #define SET_DOP_DIR() gioSetBit( gioPORTA, STOP_DO_PUMP_GIO_PORT_PIN, PIN_SIGNAL_HIGH ) ///< Macro sets pump controller direction to forward direction. #define CLR_DOP_DIR() gioSetBit( gioPORTA, STOP_DO_PUMP_GIO_PORT_PIN, PIN_SIGNAL_LOW ) ///< Macro sets pump controller direction to reverse direction. @@ -149,18 +144,18 @@ static U32 dopControlTimerCounter = 0; ///< Timer counter to determine when to control dialysate outlet pump. static U32 dopCurrErrorDurationCtr = 0; ///< Timer counter for motor current error persistence. -static U32 dopRotorRevStartTime = 0; ///< dialysate outlet pump rotor rotation start time (in ms) -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 U32 dopRotorRevStartTime = 0; ///< Dialysate outlet pump rotor rotation start time (in ms) +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 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. +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. -static U32 errorDialOutMotorOffPersistTimerCtr = 0; ///< persistence timer counter for motor off check error condition. -static U32 errorDialOutMotorSpeedPersistTimerCtr = 0; ///< persistence timer counter for motor speed error condition. -static U32 errorDialOutRotorSpeedPersistTimerCtr = 0; ///< persistence timer counter for rotor speed error condition. -static U32 errorDialOutPumpDirectionPersistTimerCtr = 0; ///< persistence timer counter for pump direction error condition. +static U32 errorDialOutMotorOffPersistTimerCtr = 0; ///< Persistence timer counter for motor off check error condition. +static U32 errorDialOutMotorSpeedPersistTimerCtr = 0; ///< Persistence timer counter for motor speed error condition. +static U32 errorDialOutRotorSpeedPersistTimerCtr = 0; ///< Persistence timer counter for rotor speed error condition. +static U32 errorDialOutPumpDirectionPersistTimerCtr = 0; ///< Persistence timer counter for pump direction error condition. static DIAL_OUT_PUMP_SELF_TEST_STATE_T dialOutPumpSelfTestState = DIAL_OUT_PUMP_SELF_TEST_STATE_START; ///< Current state of the dialysate outlet pump self-test state machine. static U32 dialOutPumpSelfTestTimerCount = 0; ///< Timer counter for time reference during self-test. @@ -185,7 +180,7 @@ static void checkDialOutPumpSpeeds( void ); static void checkDialOutPumpMCCurrent( void ); -static DATA_GET_PROTOTYPE( U32, getPublishDialOutDataInterval ); +static U32 getPublishDialOutDataInterval( void ); /*********************************************************************//** * @brief @@ -201,20 +196,20 @@ stopDialOutPump(); setDialOutPumpDirection( MOTOR_DIR_FORWARD ); - // zero motor hall sensors counts buffer + // Zero motor hall sensors counts buffer dopMotorSpeedCalcIdx = 0; for ( i = 0; i < DOP_SPEED_CALC_BUFFER__LEN; i++ ) { dopLastMotorHallSensorCounts[ i ] = 0; } - // initialize load cell weights + // Initialize load cell weights for ( i = 0; i < NUM_OF_LOAD_CELLS; i++ ) { loadCellWeightInGrams[ i ].data = 0.0; } - // initialize dialysate outlet flow PI controller + // Initialize dialysate outlet flow PI controller initializePIController( PI_CONTROLLER_ID_ULTRAFILTRATION, MIN_DIAL_OUT_PUMP_PWM_DUTY_CYCLE, DOP_P_COEFFICIENT, DOP_I_COEFFICIENT, MIN_DIAL_OUT_PUMP_PWM_DUTY_CYCLE, MAX_DIAL_OUT_PUMP_PWM_DUTY_CYCLE ); @@ -235,10 +230,10 @@ { BOOL result = FALSE; - // direction change while pump is running is not allowed + // Direction change while pump is running is not allowed if ( ( FALSE == isDialOutPumpOn ) || ( 0 == flowRate ) || ( dir == dialOutPumpDirectionSet ) ) { - // verify flow rate + // Verify flow rate if ( flowRate <= MAX_DIAL_OUT_FLOW_RATE ) { F32 adjFlow = (F32)flowRate; @@ -250,24 +245,24 @@ lastGivenRate = flowRate; dialOutPumpDirection = dir; dialOutPumpControlMode = mode; - // set PWM duty cycle target to an estimated initial target to ramp to based on target flow rate - then we'll control to flow when ramp completed + // Set PWM duty cycle target to an estimated initial target to ramp to based on target flow rate - then we will control to flow when ramp completed dialOutPumpPWMDutyCyclePct = DOP_PWM_FROM_ML_PER_MIN(adjFlow); switch ( dialOutPumpState ) { - case DIAL_OUT_PUMP_RAMPING_UP_STATE: // see if we need to reverse direction of ramp + case DIAL_OUT_PUMP_RAMPING_UP_STATE: // See if we need to reverse direction of ramp if ( dialOutPumpPWMDutyCyclePct < dialOutPumpPWMDutyCyclePctSet ) { dialOutPumpState = DIAL_OUT_PUMP_RAMPING_DOWN_STATE; } break; - case DIAL_OUT_PUMP_RAMPING_DOWN_STATE: // see if we need to reverse direction of ramp + case DIAL_OUT_PUMP_RAMPING_DOWN_STATE: // See if we need to reverse direction of ramp if ( dialOutPumpPWMDutyCyclePct > dialOutPumpPWMDutyCyclePctSet ) { dialOutPumpState = DIAL_OUT_PUMP_RAMPING_UP_STATE; } break; - case DIAL_OUT_PUMP_CONTROL_TO_TARGET_STATE: // start ramp to new target in appropriate direction + case DIAL_OUT_PUMP_CONTROL_TO_TARGET_STATE: // Start ramp to new target in appropriate direction if ( dialOutPumpPWMDutyCyclePctSet > dialOutPumpPWMDutyCyclePct ) { dialOutPumpState = DIAL_OUT_PUMP_RAMPING_DOWN_STATE; @@ -278,12 +273,12 @@ } break; default: - // ok - not all states need to be handled here + // Ok - not all states need to be handled here break; } result = TRUE; } - else // requested flow rate too high + else // Requested flow rate too high { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_DIAL_OUT_FLOW_SET_TOO_HIGH, flowRate ) } @@ -340,11 +335,11 @@ U32 rotTime = getMSTimerCount(); U32 deltaTime = calcTimeBetween( dopRotorRevStartTime, rotTime ); - // calculate rotor speed (in RPM) + // Calculate rotor speed (in RPM) dialOutPumpRotorSpeedRPM.data = ( 1.0 / (F32)deltaTime ) * (F32)MS_PER_SECOND * (F32)SEC_PER_MIN; dopRotorRevStartTime = rotTime; - // if we're supposed to stop pump at home position, stop pump now. + // If we are supposed to stop pump at home position, stop pump now. if ( TRUE == dopStopAtHomePosition ) { signalDialOutPumpHardStop(); @@ -427,19 +422,19 @@ dialOutPumpMCSpeedRPM.data = (F32)(SIGN_FROM_12_BIT_VALUE(bpRPM)) * DOP_SPEED_ADC_TO_RPM_FACTOR; dialOutPumpMCCurrentmA.data = (F32)(SIGN_FROM_12_BIT_VALUE(bpmA)) * DOP_CURRENT_ADC_TO_MA_FACTOR; - // calculate dialysate outlet pump motor speed/direction from hall sensor count + // Calculate dialysate outlet pump motor speed/direction from hall sensor count updateDialOutPumpSpeedAndDirectionFromHallSensors(); - // don't start enforcing checks until out of init/POST mode + // Do not start enforcing checks until out of init/POST mode if ( getCurrentOperationMode() != MODE_INIT ) { - // check pump direction + // Check pump direction checkDialOutPumpDirection(); - // check pump controller current + // Check pump controller current checkDialOutPumpMCCurrent(); - // check pump speeds + // Check pump speeds checkDialOutPumpSpeeds(); - // check for home position, zero/low speed + // Check for home position, zero/low speed checkDialOutPumpRotor(); } @@ -492,13 +487,13 @@ { DIAL_OUT_PUMP_STATE_T result = DIAL_OUT_PUMP_OFF_STATE; - // if we've been given a flow rate, setup ramp up and transition to ramp up state + // If we have been given a flow rate, setup ramp up and transition to ramp up state if ( lastGivenRate > 0 ) { - // set initial PWM duty cycle + // Set initial PWM duty cycle dialOutPumpPWMDutyCyclePctSet = DOP_PWM_ZERO_OFFSET + MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE; setDialOutPumpControlSignalPWM( dialOutPumpPWMDutyCyclePctSet ); - // allow dialOut pump to run in requested direction + // Allow dialOut pump to run in requested direction setDialOutPumpDirection( dialOutPumpDirection ); releaseDialOutPumpStop(); isDialOutPumpOn = TRUE; @@ -524,28 +519,28 @@ { DIAL_OUT_PUMP_STATE_T result = DIAL_OUT_PUMP_RAMPING_UP_STATE; - // have we been asked to stop the dialOut pump? + // Have we been asked to stop the dialOut pump? if ( dialOutPumpPWMDutyCyclePct < (MAX_DIAL_OUT_PUMP_PWM_STEP_DN_CHANGE + DOP_PWM_ZERO_OFFSET) ) { - // start ramp down to stop + // Start ramp down to stop dialOutPumpPWMDutyCyclePctSet -= MAX_DIAL_OUT_PUMP_PWM_STEP_DN_CHANGE; setDialOutPumpControlSignalPWM( dialOutPumpPWMDutyCyclePctSet ); result = DIAL_OUT_PUMP_RAMPING_DOWN_STATE; } - // have we reached end of ramp up? + // Have we reached end of ramp up? else if ( dialOutPumpPWMDutyCyclePctSet >= dialOutPumpPWMDutyCyclePct ) { resetPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, dialOutPumpPWMDutyCyclePctSet ); dialOutPumpControlModeSet = dialOutPumpControlMode; - // if open loop mode, set PWM to requested duty cycle where it will stay during control state + // If open loop mode, set PWM to requested duty cycle where it will stay during control state if ( dialOutPumpControlModeSet == PUMP_CONTROL_MODE_OPEN_LOOP ) { dialOutPumpPWMDutyCyclePctSet = dialOutPumpPWMDutyCyclePct; setDialOutPumpControlSignalPWM( dialOutPumpPWMDutyCyclePct ); } result = DIAL_OUT_PUMP_CONTROL_TO_TARGET_STATE; } - // continue ramp up + // Continue ramp up else { dialOutPumpPWMDutyCyclePctSet += MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE; @@ -567,26 +562,26 @@ { DIAL_OUT_PUMP_STATE_T result = DIAL_OUT_PUMP_RAMPING_DOWN_STATE; - // have we essentially reached zero speed + // Have we essentially reached zero speed? if ( dialOutPumpPWMDutyCyclePctSet < (MAX_DIAL_OUT_PUMP_PWM_STEP_DN_CHANGE + DOP_PWM_ZERO_OFFSET) ) { stopDialOutPump(); result = DIAL_OUT_PUMP_OFF_STATE; } - // have we reached end of ramp down? + // Have we reached end of ramp down? else if ( dialOutPumpPWMDutyCyclePctSet <= dialOutPumpPWMDutyCyclePct ) { resetPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, dialOutPumpPWMDutyCyclePctSet ); dialOutPumpControlModeSet = dialOutPumpControlMode; - // if open loop mode, set PWM to requested duty cycle where it will stay during control state + // If open loop mode, set PWM to requested duty cycle where it will stay during control state if ( dialOutPumpControlModeSet == PUMP_CONTROL_MODE_OPEN_LOOP ) { dialOutPumpPWMDutyCyclePctSet = dialOutPumpPWMDutyCyclePct; setDialOutPumpControlSignalPWM( dialOutPumpPWMDutyCyclePct ); } result = DIAL_OUT_PUMP_CONTROL_TO_TARGET_STATE; } - // continue ramp down + // Continue ramp down else { dialOutPumpPWMDutyCyclePctSet -= MAX_DIAL_OUT_PUMP_PWM_STEP_DN_CHANGE; @@ -608,7 +603,7 @@ { DIAL_OUT_PUMP_STATE_T result = DIAL_OUT_PUMP_CONTROL_TO_TARGET_STATE; - // control at set interval + // Control at set interval if ( ++dopControlTimerCounter >= DOP_CONTROL_INTERVAL ) { if ( dialOutPumpControlModeSet == PUMP_CONTROL_MODE_CLOSED_LOOP ) @@ -618,17 +613,17 @@ F32 newPWMDutyCyclePct; F32 deltaPWMDutyCyclePct; - // get new PWM from PI controller + // Get new PWM from PI controller newPWMDutyCyclePct = runPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, refVol, totVol ); - // limit PWM change to max + // Limit PWM change to max deltaPWMDutyCyclePct = newPWMDutyCyclePct - dialOutPumpPWMDutyCyclePctSet; if ( fabs( deltaPWMDutyCyclePct ) > 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 + // Set new PWM dialOutPumpPWMDutyCyclePctSet = newPWMDutyCyclePct; setDialOutPumpControlSignalPWM( newPWMDutyCyclePct ); } @@ -719,7 +714,7 @@ *************************************************************************/ static void publishDialOutFlowData( void ) { - // publish dialysate outlet pump and UF volume data on interval + // Publish dialysate outlet pump and UF volume data on interval if ( ++dialOutFlowDataPublicationTimerCounter >= getPublishDialOutDataInterval() ) { DIAL_OUT_FLOW_DATA_T dialOutBroadCastVariables; @@ -758,7 +753,7 @@ U16 decDelta = HEX_64_K - incDelta; U16 delta; - // determine dialysate outlet pump speed/direction from delta hall sensor count since last interval + // Determine dialysate outlet pump speed/direction from delta hall sensor count since last interval if ( incDelta < decDelta ) { delta = incDelta; @@ -770,7 +765,7 @@ dialOutPumpSpeedRPM.data = ( (F32)delta / (F32)DOP_HALL_EDGE_COUNTS_PER_REV ) * (F32)SEC_PER_MIN * -1.0; } - // update last count for next time + // Update last count for next time dopLastMotorHallSensorCounts[ nextIdx ] = dopMotorHallSensorCount; dopMotorSpeedCalcIdx = nextIdx; dopMotorSpeedCalcTimerCtr = 0; @@ -788,15 +783,15 @@ *************************************************************************/ static void checkDialOutPumpRotor( void ) { - // if homing, check timeout + // If homing, check timeout if ( ( TRUE == dopStopAtHomePosition ) && ( TRUE == didTimeout( dopHomeStartTime, DOP_HOME_TIMEOUT_MS ) ) ) { signalDialOutPumpHardStop(); dopStopAtHomePosition = FALSE; // TODO - alarm??? } - // if pump is stopped or running very slowly, set rotor speed to zero + // If pump is stopped or running very slowly, set rotor speed to zero if ( TRUE == didTimeout( dopRotorRevStartTime, DOP_HOME_TIMEOUT_MS ) ) { dialOutPumpRotorSpeedRPM.data = 0.0; @@ -820,7 +815,7 @@ dopMCDir = ( getMeasuredDialOutPumpMCSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); dopDir = ( getMeasuredDialOutPumpSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); - // check set direction vs. direction from hall sensors + // Check set direction vs. direction from hall sensors if ( dialOutPumpDirectionSet != dopDir ) { if ( ++errorDialOutPumpDirectionPersistTimerCtr >= DOP_DIRECTION_ERROR_PERSIST ) @@ -830,7 +825,7 @@ #endif } } - // check set direction vs. direction from sign of motor controller speed + // Check set direction vs. direction from sign of motor controller speed else if ( dialOutPumpDirectionSet != dopMCDir ) { if ( ++errorDialOutPumpDirectionPersistTimerCtr >= DOP_DIRECTION_ERROR_PERSIST ) @@ -867,7 +862,7 @@ { F32 measMotorSpeed = getMeasuredDialOutPumpSpeed(); - // check for pump running while commanded off + // Check for pump running while commanded off if ( FALSE == isDialOutPumpOn ) { if ( measMotorSpeed > DOP_MAX_MOTOR_SPEED_WHILE_OFF_RPM ) @@ -898,7 +893,7 @@ F32 measMotorSpeedInRotorRPM = measMotorSpeed / DOP_GEAR_RATIO; F32 deltaRotorSpeed = fabs( measRotorSpeed - measMotorSpeedInRotorRPM ); - // check measured motor speed vs. commanded motor speed while controlling to target + // Check measured motor speed vs. commanded motor speed while controlling to target if ( deltaMotorSpeed > DOP_MAX_MOTOR_SPEED_ERROR_RPM ) { if ( ++errorDialOutMotorSpeedPersistTimerCtr >= DOP_MOTOR_SPEED_ERROR_PERSIST ) @@ -913,7 +908,7 @@ errorDialOutMotorSpeedPersistTimerCtr = 0; } - // check measured rotor speed vs. measured motor speed while controlling to target + // Check measured rotor speed vs. measured motor speed while controlling to target if ( deltaRotorSpeed > DOP_MAX_ROTOR_VS_MOTOR_DIFF_RPM ) { if ( ++errorDialOutRotorSpeedPersistTimerCtr >= DOP_ROTOR_SPEED_ERROR_PERSIST ) @@ -947,7 +942,7 @@ { F32 dopCurr; - // dialOut pump should be off + // DialOut pump should be off if ( DIAL_OUT_PUMP_OFF_STATE == dialOutPumpState ) { dopCurr = fabs( getMeasuredDialOutPumpMCCurrent() ); @@ -966,7 +961,7 @@ dopCurrErrorDurationCtr = 0; } } - // dialOut pump should be running + // DialOut pump should be running else { dopCurr = fabs( getMeasuredDialOutPumpMCCurrent() );