Index: firmware/App/Controllers/AirTrap.c =================================================================== diff -u -rc67def50892f9a7c2f1f22985b5351465a8f6773 -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision c67def50892f9a7c2f1f22985b5351465a8f6773) +++ firmware/App/Controllers/AirTrap.c (.../AirTrap.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -32,9 +32,9 @@ // ********** private definitions ********** -#define AIR_TRAP_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< interval (ms/task time) at which the air trap data is published on the CAN bus. -#define AIR_TRAP_ILLEGAL_LEVELS_PERSISTENCE ( MS_PER_SECOND * 2 / TASK_PRIORITY_INTERVAL ) ///< persistence period for illegal level sensors fault. -#define VENOUS_LINE_VOLUME_ML ( 200.0 ) ///< TODO volume (in mL) of venous portion of blood circuit line. +#define AIR_TRAP_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the air trap data is published on the CAN bus. +#define AIR_TRAP_ILLEGAL_LEVELS_PERSISTENCE ( MS_PER_SECOND * 2 / TASK_PRIORITY_INTERVAL ) ///< Persistence period for illegal level sensors fault. +#define VENOUS_LINE_VOLUME_ML ( 200.0 ) ///< TODO Volume (in mL) of venous portion of blood circuit line. /// Defined states for the air trap controller state machine. typedef enum AirTrap_States @@ -57,22 +57,22 @@ // ********** private data ********** -static AIR_TRAP_STATE_T airTrapControllerState; ///< current state of air trap controller state machine. -static U32 airTrapDataPublicationTimerCounter = 0; ///< used to schedule air trap data publication to CAN bus. +static AIR_TRAP_STATE_T airTrapControllerState; ///< Current state of air trap controller state machine. +static U32 airTrapDataPublicationTimerCounter = 0; ///< Used to schedule air trap data publication to CAN bus. -/// interval (in ms) at which to publish air trap data to CAN bus. +/// Interval (in ms) at which to publish air trap data to CAN bus. static OVERRIDE_U32_T airTrapDataPublishInterval = { AIR_TRAP_DATA_PUB_INTERVAL, AIR_TRAP_DATA_PUB_INTERVAL, 0, 0 }; -static OVERRIDE_U32_T airTrapLevels[ NUM_OF_AIR_TRAP_LEVEL_SENSORS ]; ///< detected air trap level for each level sensor. +static OVERRIDE_U32_T airTrapLevels[ NUM_OF_AIR_TRAP_LEVEL_SENSORS ]; ///< Detected air trap level for each level sensor. -static AIR_TRAP_SELF_TEST_STATE_T airTrapSelfTestState; ///< current air trap self-test state. -static U32 airTrapSelfTestTimerCount = 0; ///< timer counter for air trap self-test. +static AIR_TRAP_SELF_TEST_STATE_T airTrapSelfTestState; ///< Current air trap self-test state. +static U32 airTrapSelfTestTimerCount = 0; ///< Timer counter for air trap self-test. -static BOOL pendingStartAirTrapController = FALSE; ///< flag indicates an air trap controller start request is pending. -static BOOL pendingStopAirTrapController = FALSE; ///< flag indicates an air trap controller stop request is pending. +static BOOL pendingStartAirTrapController = FALSE; ///< Flag indicates an air trap controller start request is pending. +static BOOL pendingStopAirTrapController = FALSE; ///< Flag indicates an air trap controller stop request is pending. -static U32 fillStartTime = 0; ///< time stamp for start of air trap fill. +static U32 fillStartTime = 0; ///< Time stamp for start of air trap fill. -static U32 airTrapIllegalLevelSensorsCtr = 0; ///< timer counter for illegal level sensor fault. +static U32 airTrapIllegalLevelSensorsCtr = 0; ///< Timer counter for illegal level sensor fault. // ********** private function prototypes ********** @@ -138,7 +138,7 @@ if ( TRUE == isAirTrapControlling() ) { pendingStopAirTrapController = TRUE; - setValveAirTrap( STATE_CLOSED ); // always exit air trap valve control w/ valve closed. + setValveAirTrap( STATE_CLOSED ); // Always exit air trap valve control w/ valve closed. } } @@ -178,7 +178,7 @@ airTrapLevels[ AIR_TRAP_LEVEL_SENSOR_LOWER ].data = (U32)( TRUE == lower ? AIR_TRAP_LEVEL_AIR : AIR_TRAP_LEVEL_FLUID ); airTrapLevels[ AIR_TRAP_LEVEL_SENSOR_UPPER ].data = (U32)( TRUE == upper ? AIR_TRAP_LEVEL_AIR : AIR_TRAP_LEVEL_FLUID ); - // check level readings are valid + // Check level readings are valid if ( ( AIR_TRAP_LEVEL_AIR == getAirTrapLevel( AIR_TRAP_LEVEL_SENSOR_LOWER ) ) && ( AIR_TRAP_LEVEL_FLUID == getAirTrapLevel( AIR_TRAP_LEVEL_SENSOR_UPPER ) ) ) { @@ -206,7 +206,7 @@ *************************************************************************/ void execAirTrapMonitorPriming( void ) { - // TODO - implement when priming sub-mode of pre-treatment mode is implemented. + // TODO - Implement when priming sub-mode of pre-treatment mode is implemented. // activateAlarmNoData( ALARM_ID_AIR_TRAP_FILL_DURING_PRIME ); } @@ -220,10 +220,10 @@ *************************************************************************/ void execAirTrapMonitorTreatment( void ) { - // check air trap fill timeout during treatment + // Check air trap fill timeout during treatment if ( AIR_TRAP_VALVE_OPEN_STATE == airTrapControllerState ) { - F32 bldFlowRate = (F32)getTreatmentParameterU32( TREATMENT_PARAM_BLOOD_FLOW ); // function will never return zero + F32 bldFlowRate = (F32)getTreatmentParameterU32( TREATMENT_PARAM_BLOOD_FLOW ); // Function will never return zero F32 fillTimeoutMS = ( VENOUS_LINE_VOLUME_ML / bldFlowRate ) * (F32)SEC_PER_MIN * (F32)MS_PER_SECOND; if ( TRUE == didTimeout( fillStartTime, fillTimeoutMS ) ) @@ -244,14 +244,14 @@ *************************************************************************/ void execAirTrapController( void ) { - // if we've faulted, close valve and go to manual control + // If we've faulted, close valve and go to manual control if ( MODE_FAUL == getCurrentOperationMode() ) { airTrapControllerState = AIR_TRAP_MANUAL_CONTROL_STATE; pendingStartAirTrapController = FALSE; } - // execute air trap state machine + // Execute air trap state machine switch( airTrapControllerState ) { case AIR_TRAP_INIT_STATE: @@ -276,7 +276,7 @@ break; } - // publish air trap data if due + // Publish air trap data if due publishAirTrapData(); } @@ -292,7 +292,7 @@ { AIR_TRAP_STATE_T result = AIR_TRAP_MANUAL_CONTROL_STATE; - // transition to valve control states when requested + // Transition to valve control states when requested if ( TRUE == pendingStartAirTrapController ) { pendingStartAirTrapController = FALSE; @@ -315,13 +315,13 @@ { AIR_TRAP_STATE_T result = AIR_TRAP_VALVE_CLOSED_STATE; - // transition to manual valve control state when requested + // Transition to manual valve control state when requested if ( TRUE == pendingStopAirTrapController ) { pendingStopAirTrapController = FALSE; result = AIR_TRAP_MANUAL_CONTROL_STATE; } - // transition to open valve state when air detected at lower level + // Transition to open valve state when air detected at lower level else if ( AIR_TRAP_LEVEL_AIR == getAirTrapLevel( AIR_TRAP_LEVEL_SENSOR_LOWER ) ) { setValveAirTrap( STATE_OPEN ); @@ -344,13 +344,13 @@ { AIR_TRAP_STATE_T result = AIR_TRAP_VALVE_OPEN_STATE; - // transition to manual valve control state when requested + // Transition to manual valve control state when requested if ( TRUE == pendingStopAirTrapController ) { pendingStopAirTrapController = FALSE; result = AIR_TRAP_MANUAL_CONTROL_STATE; } - // transition to closed valve state when fluid detected at upper level + // Transition to closed valve state when fluid detected at upper level else if ( AIR_TRAP_LEVEL_FLUID == getAirTrapLevel( AIR_TRAP_LEVEL_SENSOR_UPPER ) ) { setValveAirTrap( STATE_CLOSED ); @@ -419,7 +419,7 @@ *************************************************************************/ static void publishAirTrapData( void ) { - // publish air trap data on interval + // Publish air trap data on interval if ( ++airTrapDataPublicationTimerCounter >= getPublishAirTrapDataInterval() ) { AIR_TRAP_LEVELS_T lowLevel = getAirTrapLevel( AIR_TRAP_LEVEL_SENSOR_LOWER ); @@ -442,7 +442,7 @@ { SELF_TEST_STATUS_T status = SELF_TEST_STATUS_PASSED; - // TODO - implement POST + // TODO - Implement POST return status; } Index: firmware/App/Controllers/AirTrap.h =================================================================== diff -u -rc67def50892f9a7c2f1f22985b5351465a8f6773 -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Controllers/AirTrap.h (.../AirTrap.h) (revision c67def50892f9a7c2f1f22985b5351465a8f6773) +++ firmware/App/Controllers/AirTrap.h (.../AirTrap.h) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -35,16 +35,16 @@ /// Enumeration of air trap level sensors monitored by this module. typedef enum AirTrapLevelSensors { - AIR_TRAP_LEVEL_SENSOR_LOWER = 0, ///< lower air trap sensor - AIR_TRAP_LEVEL_SENSOR_UPPER, ///< upper air trap sensor + AIR_TRAP_LEVEL_SENSOR_LOWER = 0, ///< Lower air trap sensor + AIR_TRAP_LEVEL_SENSOR_UPPER, ///< Upper air trap sensor NUM_OF_AIR_TRAP_LEVEL_SENSORS ///< Number of air trap sensors } AIR_TRAP_LEVEL_SENSORS_T; /// Enumeration of air trap level sensor levels. typedef enum AirTrapLevelSensorLevels { - AIR_TRAP_LEVEL_AIR = 0, ///< air trap level sensor detects air - AIR_TRAP_LEVEL_FLUID, ///< air trap level sensor detects fluid + AIR_TRAP_LEVEL_AIR = 0, ///< Air trap level sensor detects air + AIR_TRAP_LEVEL_FLUID, ///< Air trap level sensor detects fluid NUM_OF_AIR_TRAP_LEVELS ///< Number of air trap level sensor levels } AIR_TRAP_LEVELS_T; Index: firmware/App/Controllers/AlarmLamp.c =================================================================== diff -u -rc672f41061bcd500d6593655641cb27ce3ae58fc -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Controllers/AlarmLamp.c (.../AlarmLamp.c) (revision c672f41061bcd500d6593655641cb27ce3ae58fc) +++ firmware/App/Controllers/AlarmLamp.c (.../AlarmLamp.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -82,7 +82,7 @@ }; static ALARM_LAMP_SELF_TEST_STATE_T alarmLampSelfTestState = ALARM_LAMP_SELF_TEST_STATE_START; ///< Current alarm lamp self-test state. -static U32 alarmLampSelfTestStepTimerCount = 0; ///< timer counter for current alarm lamp self-test state. +static U32 alarmLampSelfTestStepTimerCount = 0; ///< Timer counter for current alarm lamp self-test state. // ********** private function prototypes ********** @@ -117,33 +117,33 @@ *************************************************************************/ void execAlarmLamp( void ) { - // if starting a new lamp pattern, reset pattern variables + // If starting a new lamp pattern, reset pattern variables if ( pendingLampPattern != currentLampPattern.data ) { currentLampPattern.data = pendingLampPattern; currentLampPatternStep = 0; setAlarmLampToPatternStep(); } - // otherwise, increment pattern timer + // Otherwise, increment pattern timer else { lampPatternStepTimer += ALARM_LAMP_AND_AUDIO_CONTROL_INTERVAL_MS; } - // control alarm lamp to currently set pattern (unless we're in manual pattern) + // Control alarm lamp to currently set pattern (unless we're in manual pattern) if ( getCurrentAlarmLampPattern() != LAMP_PATTERN_MANUAL ) { - // if pattern step duration has elapsed, move to next step + // If pattern step duration has elapsed, move to next step if ( lampPatternStepTimer >= lampPatterns[ getCurrentAlarmLampPattern() ].duration[ currentLampPatternStep ] ) { - // increment pattern step + // Increment pattern step currentLampPatternStep++; if ( currentLampPatternStep >= NUM_OF_LAMP_STATES ) { currentLampPatternStep = 0; } - // set lamps according to pattern step + // Set lamps according to pattern step setAlarmLampToPatternStep(); } } @@ -251,7 +251,7 @@ break; case ALARM_LAMP_SELF_TEST_STATE_COMPLETE: - // if we get called in this state, assume we're doing self-test again + // If we get called in this state, assume we're doing self-test again alarmLampSelfTestState = ALARM_LAMP_SELF_TEST_STATE_START; break; Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -rac05209d7b6c65b22359754eced5ad2672d3092a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision ac05209d7b6c65b22359754eced5ad2672d3092a) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -20,7 +20,7 @@ #include "can.h" #include "etpwm.h" -// TODO - test includes - remove later +// TODO - Test includes - remove later #include "DialInFlow.h" #include "PresOccl.h" @@ -44,53 +44,53 @@ // ********** private definitions ********** -/// interval (ms/task time) at which the blood flow data is published on the CAN bus. +/// Interval (ms/task time) at which the blood flow data is published on the CAN bus. #define BLOOD_FLOW_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) -#define MAX_BLOOD_PUMP_PWM_STEP_UP_CHANGE 0.008 ///< max duty cycle change when ramping up ~ 100 mL/min/s. -#define MAX_BLOOD_PUMP_PWM_STEP_DN_CHANGE 0.016 ///< max duty cycle change when ramping down ~ 200 mL/min/s. -#define MAX_BLOOD_PUMP_PWM_DUTY_CYCLE 0.88 ///< controller will error if PWM duty cycle > 90%, so set max to 88% -#define MIN_BLOOD_PUMP_PWM_DUTY_CYCLE 0.12 ///< controller will error if PWM duty cycle < 10%, so set min to 12% +#define MAX_BLOOD_PUMP_PWM_STEP_UP_CHANGE 0.008 ///< Max duty cycle change when ramping up ~ 100 mL/min/s. +#define MAX_BLOOD_PUMP_PWM_STEP_DN_CHANGE 0.016 ///< Max duty cycle change when ramping down ~ 200 mL/min/s. +#define MAX_BLOOD_PUMP_PWM_DUTY_CYCLE 0.88 ///< Controller will error if PWM duty cycle > 90%, so set max to 88% +#define MIN_BLOOD_PUMP_PWM_DUTY_CYCLE 0.12 ///< Controller will error if PWM duty cycle < 10%, so set min to 12% -/// interval (ms/task time) at which the blood pump is controlled. +/// Interval (ms/task time) at which the blood pump is controlled. #define BP_CONTROL_INTERVAL ( 10000 / TASK_GENERAL_INTERVAL ) #define BP_P_COEFFICIENT 0.00035 ///< P term for blood pump control #define BP_I_COEFFICIENT 0.00035 ///< I term for blood pump control -#define BP_HOME_RATE 100 ///< target pump speed (in estimate mL/min) for homing. -#define BP_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 BP_HOME_RATE 100 ///< Target pump speed (in estimate mL/min) for homing. +#define BP_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 BP_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 BP_SPEED_CALC_BUFFER_LEN ( 1000 / BP_SPEED_CALC_INTERVAL / TASK_PRIORITY_INTERVAL ) -#define BP_HALL_EDGE_COUNTS_PER_REV 48 ///< number of hall sensor edge counts per motor revolution. -#define BP_MAX_ROTOR_SPEED_RPM 100.0 ///< maximum rotor speed allowed for blood pump. +#define BP_HALL_EDGE_COUNTS_PER_REV 48 ///< Number of hall sensor edge counts per motor revolution. +#define BP_MAX_ROTOR_SPEED_RPM 100.0 ///< Maximum rotor speed allowed for blood pump. -#define BP_MAX_FLOW_VS_SPEED_DIFF_RPM 200.0 ///< maximum difference between measured speed and speed implied by measured flow. -#define BP_MAX_MOTOR_SPEED_WHILE_OFF_RPM 100.0 ///< maximum motor speed (RPM) while motor is commanded off. -#define BP_MAX_ROTOR_VS_MOTOR_DIFF_RPM 5.0 ///< maximum difference in speed between motor and rotor (in rotor RPM). -#define BP_MAX_MOTOR_SPEED_ERROR_RPM 300.0 ///< maximum difference in speed between measured and commanded RPM. -#define BP_FLOW_VS_SPEED_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< persist time (task intervals) for flow vs. motor speed error condition. -#define BP_OFF_ERROR_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< persist time (task intervals) for motor off error condition. -#define BP_MOTOR_SPEED_ERROR_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< persist time (task intervals) motor speed error condition. -#define BP_ROTOR_SPEED_ERROR_PERSIST ((12 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< persist time (task intervals) rotor speed error condition. -#define BP_DIRECTION_ERROR_PERSIST (250 / TASK_PRIORITY_INTERVAL) ///< persist time (task intervals) pump direction error condition. -#define BP_MAX_ROTOR_SPEED_ERROR_PERSIST ((1 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< persist time (task intervals) blood pump rotor speed too fast error condition. +#define BP_MAX_FLOW_VS_SPEED_DIFF_RPM 200.0 ///< Maximum difference between measured speed and speed implied by measured flow. +#define BP_MAX_MOTOR_SPEED_WHILE_OFF_RPM 100.0 ///< Maximum motor speed (RPM) while motor is commanded off. +#define BP_MAX_ROTOR_VS_MOTOR_DIFF_RPM 5.0 ///< Maximum difference in speed between motor and rotor (in rotor RPM). +#define BP_MAX_MOTOR_SPEED_ERROR_RPM 300.0 ///< Maximum difference in speed between measured and commanded RPM. +#define BP_FLOW_VS_SPEED_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) for flow vs. motor speed error condition. +#define BP_OFF_ERROR_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) for motor off error condition. +#define BP_MOTOR_SPEED_ERROR_PERSIST ((5 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) motor speed error condition. +#define BP_ROTOR_SPEED_ERROR_PERSIST ((12 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) rotor speed error condition. +#define BP_DIRECTION_ERROR_PERSIST (250 / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) pump direction error condition. +#define BP_MAX_ROTOR_SPEED_ERROR_PERSIST ((1 * MS_PER_SECOND) / TASK_PRIORITY_INTERVAL) ///< Persist time (task intervals) blood pump rotor speed too fast error condition. -#define BP_MAX_CURR_WHEN_STOPPED_MA 150.0 ///< motor controller current should not exceed this when pump should be stopped -#define BP_MIN_CURR_WHEN_RUNNING_MA 150.0 ///< motor controller current should always exceed this when pump should be running -#define BP_MAX_CURR_WHEN_RUNNING_MA 2000.0 ///< motor controller current should not exceed this when pump should be running -#define BP_MAX_CURR_ERROR_DURATION_MS 2000 ///< motor controller current errors persisting beyond this duration will trigger an alarm +#define BP_MAX_CURR_WHEN_STOPPED_MA 150.0 ///< Motor controller current should not exceed this when pump should be stopped +#define BP_MIN_CURR_WHEN_RUNNING_MA 150.0 ///< Motor controller current should always exceed this when pump should be running +#define BP_MAX_CURR_WHEN_RUNNING_MA 2000.0 ///< Motor controller current should not exceed this when pump should be running +#define BP_MAX_CURR_ERROR_DURATION_MS 2000 ///< Motor controller current errors persisting beyond this duration will trigger an alarm -#define BP_SPEED_ADC_TO_RPM_FACTOR 1.280938 ///< conversion factor from ADC counts to RPM for blood pump motor -#define BP_CURRENT_ADC_TO_MA_FACTOR 3.002 ///< conversion factor from ADC counts to mA for blood pump motor +#define BP_SPEED_ADC_TO_RPM_FACTOR 1.280938 ///< Conversion factor from ADC counts to RPM for blood pump motor +#define BP_CURRENT_ADC_TO_MA_FACTOR 3.002 ///< Conversion factor from ADC counts to mA for blood pump motor -#define BP_REV_PER_LITER 150.0 ///< rotor revolutions per liter -#define BP_ML_PER_MIN_TO_PUMP_RPM_FACTOR ( BP_REV_PER_LITER / ML_PER_LITER ) ///< conversion factor from mL/min to motor RPM. -#define BP_GEAR_RATIO 32.0 ///< blood pump motor to blood pump gear ratio +#define BP_REV_PER_LITER 150.0 ///< Rotor revolutions per liter +#define BP_ML_PER_MIN_TO_PUMP_RPM_FACTOR ( BP_REV_PER_LITER / ML_PER_LITER ) ///< Conversion factor from mL/min to motor RPM. +#define BP_GEAR_RATIO 32.0 ///< Blood pump motor to blood pump gear ratio #define BP_MOTOR_RPM_TO_PWM_DC_FACTOR 0.00028 ///< ~28 BP motor RPM = 1% PWM duty cycle #define BP_PWM_ZERO_OFFSET 0.1 ///< 10% PWM duty cycle = zero speed -/// conversion factor from mL/min to estimated PWM duty cycle %. +/// Conversion factor from mL/min to estimated PWM duty cycle %. #define BP_PWM_FROM_ML_PER_MIN(rate) ( (rate) * BP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * BP_GEAR_RATIO * BP_MOTOR_RPM_TO_PWM_DC_FACTOR + BP_PWM_ZERO_OFFSET ) #define BLOODPUMP_ADC_FULL_SCALE_V 3.0 ///< BP analog signals are 0-3V (while int. ADC ref may be different) @@ -127,63 +127,63 @@ #define STOP_CAN3_PORT_MASK 0x00000002 // (Tx - re-purposed as output GPIO for blood pump stop signal) #define DIR_CAN3_PORT_MASK 0x00000002 // (Rx - re-purposed as output GPIO for blood pump direction signal) // blood pump stop and direction macros -#define SET_BP_DIR() {canREG3->RIOC |= DIR_CAN3_PORT_MASK;} // macro to set blood pump direction signal high. -#define CLR_BP_DIR() {canREG3->RIOC &= ~DIR_CAN3_PORT_MASK;} // macro to set blood pump direction signal low. -#define SET_BP_STOP() {canREG3->TIOC &= ~STOP_CAN3_PORT_MASK;} // macro to set blood pump stop signal (active low). -#define CLR_BP_STOP() {canREG3->TIOC |= STOP_CAN3_PORT_MASK;} // macro to clear blood pump stop signal (active low). +#define SET_BP_DIR() {canREG3->RIOC |= DIR_CAN3_PORT_MASK;} // Macro to set blood pump direction signal high. +#define CLR_BP_DIR() {canREG3->RIOC &= ~DIR_CAN3_PORT_MASK;} // Macro to set blood pump direction signal low. +#define SET_BP_STOP() {canREG3->TIOC &= ~STOP_CAN3_PORT_MASK;} // Macro to set blood pump stop signal (active low). +#define CLR_BP_STOP() {canREG3->TIOC |= STOP_CAN3_PORT_MASK;} // Macro to clear blood pump stop signal (active low). // ********** private data ********** -static BLOOD_PUMP_STATE_T bloodPumpState = BLOOD_PUMP_OFF_STATE; ///< current state of blood flow controller state machine -static U32 bloodFlowDataPublicationTimerCounter = 0; ///< used to schedule blood flow data publication to CAN bus -static BOOL isBloodPumpOn = FALSE; ///< blood pump is currently running -static F32 bloodPumpPWMDutyCyclePct = 0.0; ///< initial blood pump PWM duty cycle -static F32 bloodPumpPWMDutyCyclePctSet = 0.0; ///< currently set blood pump PWM duty cycle -static MOTOR_DIR_T bloodPumpDirection = MOTOR_DIR_FORWARD; ///< requested blood flow direction -static MOTOR_DIR_T bloodPumpDirectionSet = MOTOR_DIR_FORWARD; ///< currently set blood flow direction -static PUMP_CONTROL_MODE_T bloodPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< requested blood pump control mode. -static PUMP_CONTROL_MODE_T bloodPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< currently set blood pump control mode. -static F32 bloodFlowCalGain = 1.0; ///< blood flow calibration gain. -static F32 bloodFlowCalOffset = 0.0; ///< blood flow calibration offset. +static BLOOD_PUMP_STATE_T bloodPumpState = BLOOD_PUMP_OFF_STATE; ///< Current state of blood flow controller state machine +static U32 bloodFlowDataPublicationTimerCounter = 0; ///< Used to schedule blood flow data publication to CAN bus +static BOOL isBloodPumpOn = FALSE; ///< Blood pump is currently running +static F32 bloodPumpPWMDutyCyclePct = 0.0; ///< Initial blood pump PWM duty cycle +static F32 bloodPumpPWMDutyCyclePctSet = 0.0; ///< Currently set blood pump PWM duty cycle +static MOTOR_DIR_T bloodPumpDirection = MOTOR_DIR_FORWARD; ///< Requested blood flow direction +static MOTOR_DIR_T bloodPumpDirectionSet = MOTOR_DIR_FORWARD; ///< Currently set blood flow direction +static PUMP_CONTROL_MODE_T bloodPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< Requested blood pump control mode. +static PUMP_CONTROL_MODE_T bloodPumpControlModeSet = PUMP_CONTROL_MODE_CLOSED_LOOP; ///< Currently set blood pump control mode. +static F32 bloodFlowCalGain = 1.0; ///< Blood flow calibration gain. +static F32 bloodFlowCalOffset = 0.0; ///< Blood flow calibration offset. /// Interval (in task intervals) at which to publish blood flow data to CAN bus. static OVERRIDE_U32_T bloodFlowDataPublishInterval = { BLOOD_FLOW_DATA_PUB_INTERVAL, BLOOD_FLOW_DATA_PUB_INTERVAL, BLOOD_FLOW_DATA_PUB_INTERVAL, 0 }; -static S32 targetBloodFlowRate = 0; ///< requested blood flow rate -static OVERRIDE_F32_T measuredBloodFlowRate = { 0.0, 0.0, 0.0, 0 }; ///< measured blood flow rate -static OVERRIDE_F32_T bloodPumpRotorSpeedRPM = { 0.0, 0.0, 0.0, 0 }; ///< measured blood pump rotor speed -static OVERRIDE_F32_T bloodPumpSpeedRPM = { 0.0, 0.0, 0.0, 0 }; ///< measured blood pump motor speed -static OVERRIDE_F32_T adcBloodPumpMCSpeedRPM = { 0.0, 0.0, 0.0, 0 }; ///< measured blood pump motor controller speed -static OVERRIDE_F32_T adcBloodPumpMCCurrentmA = { 0.0, 0.0, 0.0, 0 }; ///< measured blood pump motor controller current -static OVERRIDE_F32_T bloodFlowSignalStrength = { 0.0, 0.0, 0.0, 0 }; ///< measured blood flow signal strength (%) +static S32 targetBloodFlowRate = 0; ///< Requested blood flow rate +static OVERRIDE_F32_T measuredBloodFlowRate = { 0.0, 0.0, 0.0, 0 }; ///< Measured blood flow rate +static OVERRIDE_F32_T bloodPumpRotorSpeedRPM = { 0.0, 0.0, 0.0, 0 }; ///< Measured blood pump rotor speed +static OVERRIDE_F32_T bloodPumpSpeedRPM = { 0.0, 0.0, 0.0, 0 }; ///< Measured blood pump motor speed +static OVERRIDE_F32_T adcBloodPumpMCSpeedRPM = { 0.0, 0.0, 0.0, 0 }; ///< Measured blood pump motor controller speed +static OVERRIDE_F32_T adcBloodPumpMCCurrentmA = { 0.0, 0.0, 0.0, 0 }; ///< Measured blood pump motor controller current +static OVERRIDE_F32_T bloodFlowSignalStrength = { 0.0, 0.0, 0.0, 0 }; ///< Measured blood flow signal strength (%) -static U32 bpControlTimerCounter = 0; ///< determines when to perform control on blood flow +static U32 bpControlTimerCounter = 0; ///< Determines when to perform control on blood flow -static U32 bpRotorRevStartTime = 0; ///< blood pump rotor rotation start time (in ms) -static U32 bloodPumpRotorCounter = 0; ///< running counter for blood pump rotor revolutions -static BOOL bpStopAtHomePosition = FALSE; ///< stop blood pump at next home position -static U32 bpHomeStartTime = 0; ///< when did blood pump home command begin? (in ms) +static U32 bpRotorRevStartTime = 0; ///< Blood pump rotor rotation start time (in ms) +static U32 bloodPumpRotorCounter = 0; ///< Running counter for blood pump rotor revolutions +static BOOL bpStopAtHomePosition = FALSE; ///< Stop blood pump at next home position +static U32 bpHomeStartTime = 0; ///< When did blood pump home command begin? (in ms) -static U32 bloodPumpMotorEdgeCount = 0; ///< running counter for blood pump motor revolutions -static U16 bpLastMotorHallSensorCounts[ BP_SPEED_CALC_BUFFER_LEN ]; ///< last hall sensor readings for the blood pump motor -static U32 bpMotorSpeedCalcIdx = 0; ///< index into 1 second buffer of motor speed hall sensor counts -static U32 bpMotorSpeedCalcTimerCtr = 0; ///< counter determines interval for calculating blood pump motor speed from hall sensor count. +static U32 bloodPumpMotorEdgeCount = 0; ///< Running counter for blood pump motor revolutions +static U16 bpLastMotorHallSensorCounts[ BP_SPEED_CALC_BUFFER_LEN ]; ///< Last hall sensor readings for the blood pump motor +static U32 bpMotorSpeedCalcIdx = 0; ///< Index into 1 second buffer of motor speed hall sensor counts +static U32 bpMotorSpeedCalcTimerCtr = 0; ///< Counter determines interval for calculating blood pump motor speed from hall sensor count. -static U32 errorBloodFlowVsMotorSpeedPersistTimerCtr = 0; ///< persistence timer counter for flow vs. motor speed error condition. -static U32 errorBloodMotorOffPersistTimerCtr = 0; ///< persistence timer counter for motor off check error condition. -static U32 errorBloodMotorSpeedPersistTimerCtr = 0; ///< persistence timer counter for motor speed error condition. -static U32 errorBloodRotorSpeedPersistTimerCtr = 0; ///< persistence timer counter for rotor speed error condition. -static U32 errorBloodPumpDirectionPersistTimerCtr = 0; ///< persistence timer counter for pump direction error condition. -static U32 errorBloodPumpRotorTooFastPersistTimerCtr = 0; ///< persistence timer counter for pump rotor too fast error condition. +static U32 errorBloodFlowVsMotorSpeedPersistTimerCtr = 0; ///< Persistence timer counter for flow vs. motor speed error condition. +static U32 errorBloodMotorOffPersistTimerCtr = 0; ///< Persistence timer counter for motor off check error condition. +static U32 errorBloodMotorSpeedPersistTimerCtr = 0; ///< Persistence timer counter for motor speed error condition. +static U32 errorBloodRotorSpeedPersistTimerCtr = 0; ///< Persistence timer counter for rotor speed error condition. +static U32 errorBloodPumpDirectionPersistTimerCtr = 0; ///< Persistence timer counter for pump direction error condition. +static U32 errorBloodPumpRotorTooFastPersistTimerCtr = 0; ///< Persistence timer counter for pump rotor too fast error condition. -static F32 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 U32 flowReadingsCount = 0; ///< number of samples in flow rolling average buffer +static F32 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 U32 flowReadingsCount = 0; ///< Number of samples in flow rolling average buffer -static U32 bpCurrErrorDurationCtr = 0; ///< used for tracking persistence of bp current errors +static U32 bpCurrErrorDurationCtr = 0; ///< Used for tracking persistence of bp current errors -static BLOOD_FLOW_SELF_TEST_STATE_T bloodPumpSelfTestState = BLOOD_FLOW_SELF_TEST_STATE_START; ///< current blood pump self-test state -static U32 bloodPumpSelfTestTimerCount = 0; ///< timer counter for blood pump self-test +static BLOOD_FLOW_SELF_TEST_STATE_T bloodPumpSelfTestState = BLOOD_FLOW_SELF_TEST_STATE_START; ///< Current blood pump self-test state +static U32 bloodPumpSelfTestTimerCount = 0; ///< Timer counter for blood pump self-test // ********** private function prototypes ********** @@ -221,22 +221,22 @@ stopBloodPump(); setBloodPumpDirection( MOTOR_DIR_FORWARD ); - // zero rolling flow average buffer + // Zero rolling flow average buffer resetBloodFlowMovingAverage(); - // zero motor hall sensors counts buffer + // Zero motor hall sensors counts buffer bpMotorSpeedCalcIdx = 0; for ( i = 0; i < BP_SPEED_CALC_BUFFER_LEN; i++ ) { bpLastMotorHallSensorCounts[ i ] = 0; } - // initialize blood flow PI controller + // Initialize blood flow PI controller initializePIController( PI_CONTROLLER_ID_BLOOD_FLOW, MIN_BLOOD_PUMP_PWM_DUTY_CYCLE, BP_P_COEFFICIENT, BP_I_COEFFICIENT, MIN_BLOOD_PUMP_PWM_DUTY_CYCLE, MAX_BLOOD_PUMP_PWM_DUTY_CYCLE ); - // initialize persistent alarm for flow sensor signal strength too low + // Initialize persistent alarm for flow sensor signal strength too low initPersistentAlarm( PERSISTENT_ALARM_BLOOD_FLOW_SIGNAL_STRENGTH, ALARM_ID_BLOOD_FLOW_SIGNAL_STRENGTH_TOO_LOW, FALSE, FLOW_SIG_STRGTH_ALARM_PERSIST, FLOW_SIG_STRGTH_ALARM_PERSIST ); @@ -257,34 +257,34 @@ { BOOL result = FALSE; - // direction change while pump is running is not allowed + // Direction change while pump is running is not allowed if ( ( FALSE == isBloodPumpOn ) || ( 0 == flowRate ) || ( dir == bloodPumpDirectionSet ) ) { - // verify flow rate + // Verify flow rate if ( flowRate <= MAX_BLOOD_FLOW_RATE ) { resetBloodFlowMovingAverage(); targetBloodFlowRate = ( dir == MOTOR_DIR_FORWARD ? (S32)flowRate : (S32)flowRate * -1 ); bloodPumpDirection = dir; bloodPumpControlMode = 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'll control to flow when ramp completed bloodPumpPWMDutyCyclePct = BP_PWM_FROM_ML_PER_MIN((F32)flowRate); // ~ 8% per 100 mL/min with a 10% zero offset added in (e.g. 100 mL/min = 8+10 = 18%) switch ( bloodPumpState ) { - case BLOOD_PUMP_RAMPING_UP_STATE: // see if we need to reverse direction of ramp + case BLOOD_PUMP_RAMPING_UP_STATE: // See if we need to reverse direction of ramp if ( bloodPumpPWMDutyCyclePct < bloodPumpPWMDutyCyclePctSet ) { bloodPumpState = BLOOD_PUMP_RAMPING_DOWN_STATE; } break; - case BLOOD_PUMP_RAMPING_DOWN_STATE: // see if we need to reverse direction of ramp + case BLOOD_PUMP_RAMPING_DOWN_STATE: // See if we need to reverse direction of ramp if ( bloodPumpPWMDutyCyclePct > bloodPumpPWMDutyCyclePctSet ) { bloodPumpState = BLOOD_PUMP_RAMPING_UP_STATE; } break; - case BLOOD_PUMP_CONTROL_TO_TARGET_STATE: // start ramp to new target in appropriate direction + case BLOOD_PUMP_CONTROL_TO_TARGET_STATE: // Start ramp to new target in appropriate direction if ( bloodPumpPWMDutyCyclePctSet > bloodPumpPWMDutyCyclePct ) { bloodPumpState = BLOOD_PUMP_RAMPING_DOWN_STATE; @@ -295,12 +295,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_BLOOD_FLOW_SET_TOO_HIGH, flowRate ) } @@ -340,14 +340,14 @@ U32 rotTime = getMSTimerCount(); U32 deltaTime = calcTimeBetween( bpRotorRevStartTime, rotTime ); - // increment rotor counter + // Increment rotor counter bloodPumpRotorCounter++; - // calculate rotor speed (in RPM) + // Calculate rotor speed (in RPM) bloodPumpRotorSpeedRPM.data = ( 1.0 / (F32)deltaTime ) * (F32)MS_PER_SECOND * (F32)SEC_PER_MIN; bpRotorRevStartTime = rotTime; - // if we're supposed to stop pump at home position, stop pump now. + // If we're supposed to stop pump at home position, stop pump now. if ( TRUE == bpStopAtHomePosition ) { signalBloodPumpHardStop(); @@ -427,34 +427,34 @@ HD_OP_MODE_T opMode = getCurrentOperationMode(); U16 bpRPM = getIntADCReading( INT_ADC_BLOOD_PUMP_SPEED ); U16 bpmA = getIntADCReading( INT_ADC_BLOOD_PUMP_MOTOR_CURRENT ); - F32 bpFlow = ( ( getFPGABloodFlow() * -1.0 ) * bloodFlowCalGain ) + bloodFlowCalOffset; // blood flow sensor installed backwards on HD + F32 bpFlow = ( ( getFPGABloodFlow() * -1.0 ) * bloodFlowCalGain ) + bloodFlowCalOffset; // Blood flow sensor installed backwards on HD adcBloodPumpMCSpeedRPM.data = (F32)(SIGN_FROM_12_BIT_VALUE(bpRPM)) * BP_SPEED_ADC_TO_RPM_FACTOR; adcBloodPumpMCCurrentmA.data = (F32)(SIGN_FROM_12_BIT_VALUE(bpmA)) * BP_CURRENT_ADC_TO_MA_FACTOR; bloodFlowSignalStrength.data = getFPGABloodFlowSignalStrength(); filterBloodFlowReadings( bpFlow ); - // calculate blood pump motor speed/direction from hall sensor count + // Calculate blood pump motor speed/direction from hall sensor count updateBloodPumpSpeedAndDirectionFromHallSensors(); - // don't start enforcing checks until out of init/POST mode + // Don't start enforcing checks until out of init/POST mode if ( opMode != MODE_INIT ) { - // check pump direction + // Check pump direction checkBloodPumpDirection(); - // check pump controller current + // Check pump controller current checkBloodPumpMCCurrent(); - // check pump speeds and flow + // Check pump speeds and flow checkBloodPumpSpeeds(); checkBloodPumpFlowAgainstSpeed(); - // check for home position, zero/low speed + // Check for home position, zero/low speed checkBloodPumpRotor(); - // check flow sensor signal strength + // Check flow sensor signal strength checkBloodFlowSensorSignalStrength(); } - // publish blood flow data on interval + // Publish blood flow data on interval publishBloodFlowData(); } @@ -503,13 +503,13 @@ { BLOOD_PUMP_STATE_T result = BLOOD_PUMP_OFF_STATE; - // if we've been given a flow rate, setup ramp up and transition to ramp up state + // If we've been given a flow rate, setup ramp up and transition to ramp up state if ( targetBloodFlowRate != 0 ) { - // set initial PWM duty cycle + // Set initial PWM duty cycle bloodPumpPWMDutyCyclePctSet = BP_PWM_ZERO_OFFSET + MAX_BLOOD_PUMP_PWM_STEP_UP_CHANGE; setBloodPumpControlSignalPWM( bloodPumpPWMDutyCyclePctSet ); - // allow blood pump to run in requested direction + // Allow blood pump to run in requested direction setBloodPumpDirection( bloodPumpDirection ); releaseBloodPumpStop(); isBloodPumpOn = TRUE; @@ -553,7 +553,7 @@ } result = BLOOD_PUMP_CONTROL_TO_TARGET_STATE; } - // continue ramp up + // Continue ramp up else { bloodPumpPWMDutyCyclePctSet += MAX_BLOOD_PUMP_PWM_STEP_UP_CHANGE; @@ -595,7 +595,7 @@ } result = BLOOD_PUMP_CONTROL_TO_TARGET_STATE; } - // continue ramp down + // Continue ramp down else { bloodPumpPWMDutyCyclePctSet -= MAX_BLOOD_PUMP_PWM_STEP_DN_CHANGE; @@ -617,7 +617,7 @@ { BLOOD_PUMP_STATE_T result = BLOOD_PUMP_CONTROL_TO_TARGET_STATE; - // control at set interval + // Control at set interval if ( ++bpControlTimerCounter >= BP_CONTROL_INTERVAL ) { if ( bloodPumpControlModeSet == PUMP_CONTROL_MODE_CLOSED_LOOP ) @@ -1015,7 +1015,7 @@ bpMCDir = ( getMeasuredBloodPumpMCSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); bpDir = ( getMeasuredBloodPumpSpeed() >= 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 ( bloodPumpDirectionSet != bpDir ) { if ( ++errorBloodPumpDirectionPersistTimerCtr >= BP_DIRECTION_ERROR_PERSIST ) @@ -1025,7 +1025,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 ( bloodPumpDirectionSet != bpMCDir ) { if ( ++errorBloodPumpDirectionPersistTimerCtr >= BP_DIRECTION_ERROR_PERSIST ) @@ -1063,7 +1063,7 @@ F32 measMotorSpeed = fabs( getMeasuredBloodPumpSpeed() ); S32 cmdRate = targetBloodFlowRate; - // check for pump running while commanded off + // Check for pump running while commanded off if ( 0 == cmdRate ) { if ( measMotorSpeed > BP_MAX_MOTOR_SPEED_WHILE_OFF_RPM ) @@ -1094,7 +1094,7 @@ F32 measMotorSpeedInRotorRPM = measMotorSpeed / BP_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 > BP_MAX_MOTOR_SPEED_ERROR_RPM ) { if ( ++errorBloodMotorSpeedPersistTimerCtr >= BP_MOTOR_SPEED_ERROR_PERSIST ) @@ -1109,7 +1109,7 @@ errorBloodMotorSpeedPersistTimerCtr = 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 > BP_MAX_ROTOR_VS_MOTOR_DIFF_RPM ) { if ( ++errorBloodRotorSpeedPersistTimerCtr >= BP_ROTOR_SPEED_ERROR_PERSIST ) @@ -1143,7 +1143,7 @@ *************************************************************************/ static void checkBloodPumpFlowAgainstSpeed( void ) { - // check only performed while in treatment mode and while we're in control to target state + // Check only performed while in treatment mode and while we're in control to target state if ( ( MODE_TREA == getCurrentOperationMode() ) && ( BLOOD_PUMP_CONTROL_TO_TARGET_STATE == bloodPumpState ) ) { F32 flow = getMeasuredBloodFlowRate(); @@ -1236,7 +1236,7 @@ #ifndef DISABLE_PUMP_FLOW_CHECKS HD_OP_MODE_T opMode = getCurrentOperationMode(); - // check flow sensor signal strength when appropriate TODO - in pre-treatment, must be far enough along for fluid to be in tubing + // Check flow sensor signal strength when appropriate TODO - in pre-treatment, must be far enough along for fluid to be in tubing if ( MODE_TREA == opMode || ( MODE_PRET == opMode && FALSE ) ) { F32 sigStrength = getMeasuredBloodFlowSignalStrength(); @@ -1263,7 +1263,7 @@ switch ( bloodPumpSelfTestState ) { case BLOOD_FLOW_SELF_TEST_STATE_START: - // retrieve blood flow sensor calibration data + // Retrieve blood flow sensor calibration data if ( TRUE == getCalibrationData( &cal ) ) { bloodFlowCalGain = cal.bloodFlowGain; Index: firmware/App/Controllers/Buttons.c =================================================================== diff -u -rc67def50892f9a7c2f1f22985b5351465a8f6773 -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Controllers/Buttons.c (.../Buttons.c) (revision c67def50892f9a7c2f1f22985b5351465a8f6773) +++ firmware/App/Controllers/Buttons.c (.../Buttons.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -292,7 +292,7 @@ // is an off request pending user confirmation? if ( TRUE == offRequestAwaitingUserConfirmation ) { - // reset off request pending flag + // Reset off request pending flag offRequestAwaitingUserConfirmation = FALSE; // if we're in a mode that allows power off, initiate power off sequence if ( TRUE == isCurrentOpModeOkToTurnOff() ) @@ -318,7 +318,7 @@ // is an off request pending user confirmation? if ( TRUE == offRequestAwaitingUserConfirmation ) { - // reset off request pending flag + // Reset off request pending flag offRequestAwaitingUserConfirmation = FALSE; } break; Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r85ab84d9a0668e1e3976b00eb29e79c38c81b651 -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 85ab84d9a0668e1e3976b00eb29e79c38c81b651) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -75,7 +75,7 @@ static U32 dgROPumpPressureSetPtPSI = 0; ///< Latest RO pump target pressure reported by the DG. static U32 dgDrainPumpSpeedSetPtRPM = 0; ///< Latest Drain pump target speed reported by the DG. -// reservoir data +// Reservoir data static DG_RESERVOIR_ID_T dgActiveReservoir = DG_RESERVOIR_2; ///< Latest active reservoir reported by the DG. static DG_RESERVOIR_ID_T dgActiveReservoirSet = DG_RESERVOIR_2; ///< Active reservoir commanded. static U32 dgReservoirFillVolumeTarget = 0; ///< Latest fill-to volume reported by the DG. @@ -168,7 +168,7 @@ U32 msSinceLastVolumeCalc = calcTimeSince( resUseTimer ); F32 flowRateMlPerMs = (F32)getTargetDialInFlowRate() / (F32)( MS_PER_SECOND * SEC_PER_MIN ); - // calculate volume used from active reservoir - do not accumulate if saline bolus in progress + // Calculate volume used from active reservoir - do not accumulate if saline bolus in progress if ( SALINE_BOLUS_STATE_IN_PROGRESS != getSalineBolusState() ) { resUseVolumeMl += ( flowRateMlPerMs * msSinceLastVolumeCalc ); // TODO - should this calc be done and kept by Dialysis sub-mode? @@ -245,7 +245,7 @@ break; case TREATMENT_RESERVOIR_MGMT_WAIT_FOR_RES_SWITCH_STATE: - // reservoir switch during treatment should only occur in this state (i.e. when DG is ready). + // Reservoir switch during treatment should only occur in this state (i.e. when DG is ready). // switch reservoirs when active reservoir is spent (i.e. we've pumped fill volume through dialyzer) and DG ready if ( ( DG_MODE_CIRC == getDGOpMode() ) && ( DG_RECIRCULATE_MODE_STATE_RECIRC_WATER == getDGSubMode() ) && ( resUseVolumeMl >= (F32)dgReservoirFillVolumeTargetSet ) ) @@ -255,7 +255,7 @@ // signal dialysis sub-mode to capture baseline volume for next reservoir. setStartReservoirVolume(); - // command DG to switch reservoirs + // Command DG to switch reservoirs cmdSetDGActiveReservoir( inactiveRes ); // signal dialysis sub-mode to switch reservoirs signalReservoirsSwitched(); @@ -271,7 +271,7 @@ { // signal dialysis sub-mode to capture final volume of prior reservoir after settling. setFinalReservoirVolume(); - // reset to start state to restart drain, fill, switch process. + // Reset to start state to restart drain, fill, switch process. currentTrtResMgmtState = TREATMENT_RESERVOIR_MGMT_START_STATE; } break; Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -rac05209d7b6c65b22359754eced5ad2672d3092a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision ac05209d7b6c65b22359754eced5ad2672d3092a) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -294,7 +294,7 @@ } 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_IN_FLOW_SET_TOO_HIGH, flowRate ) } @@ -334,7 +334,7 @@ U32 rotTime = getMSTimerCount(); U32 deltaTime = calcTimeBetween( dipRotorRevStartTime, rotTime ); - // calculate rotor speed (in RPM) + // Calculate rotor speed (in RPM) dialInPumpRotorSpeedRPM.data = ( 1.0 / (F32)deltaTime ) * (F32)MS_PER_SECOND * (F32)SEC_PER_MIN; dipRotorRevStartTime = rotTime; @@ -400,22 +400,22 @@ filterDialInFlowReadings( dipFlow ); - // calculate dialysate inlet pump motor speed/direction from hall sensor count + // Calculate dialysate inlet pump motor speed/direction from hall sensor count updateDialInPumpSpeedAndDirectionFromHallSensors(); // don't start enforcing checks until out of init/POST mode if ( opMode != MODE_INIT ) { - // check pump direction + // Check pump direction checkDialInPumpDirection(); - // check pump controller current + // Check pump controller current checkDialInPumpMCCurrent(); - // check pump speeds and flow + // Check pump speeds and flow checkDialInPumpSpeeds(); checkDialInPumpFlowAgainstSpeed(); - // check for home position, zero/low speed + // Check for home position, zero/low speed checkDialInPumpRotor(); - // check flow sensor signal strength + // Check flow sensor signal strength checkDialInFlowSensorSignalStrength(); } @@ -518,7 +518,7 @@ } result = DIAL_IN_PUMP_CONTROL_TO_TARGET_STATE; } - // continue ramp up + // Continue ramp up else { dialInPumpPWMDutyCyclePctSet += MAX_DIAL_IN_PUMP_PWM_STEP_UP_CHANGE; @@ -560,7 +560,7 @@ } result = DIAL_IN_PUMP_CONTROL_TO_TARGET_STATE; } - // continue ramp down + // Continue ramp down else { dialInPumpPWMDutyCyclePctSet -= MAX_DIAL_IN_PUMP_PWM_STEP_DN_CHANGE; @@ -582,7 +582,7 @@ { DIAL_IN_PUMP_STATE_T result = DIAL_IN_PUMP_CONTROL_TO_TARGET_STATE; - // control at set interval + // Control at set interval if ( ++dipControlTimerCounter >= DIP_CONTROL_INTERVAL ) { if ( dialInPumpControlModeSet == PUMP_CONTROL_MODE_CLOSED_LOOP ) @@ -976,7 +976,7 @@ dipMCDir = ( getMeasuredDialInPumpMCSpeed() >= 0.0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); dipDir = ( getMeasuredDialInPumpSpeed() >= 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 ( dialInPumpDirectionSet != dipDir ) { if ( ++errorDialInPumpDirectionPersistTimerCtr >= DIP_DIRECTION_ERROR_PERSIST ) @@ -986,7 +986,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 ( dialInPumpDirectionSet != dipMCDir ) { if ( ++errorDialInPumpDirectionPersistTimerCtr >= DIP_DIRECTION_ERROR_PERSIST ) @@ -1024,7 +1024,7 @@ F32 measMotorSpeed = getMeasuredDialInPumpSpeed(); S32 cmdRate = targetDialInFlowRate; - // check for pump running while commanded off + // Check for pump running while commanded off if ( 0 == cmdRate ) { if ( measMotorSpeed > DIP_MAX_MOTOR_SPEED_WHILE_OFF_RPM ) @@ -1055,7 +1055,7 @@ F32 measMotorSpeedInRotorRPM = measMotorSpeed / DIP_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 > DIP_MAX_MOTOR_SPEED_ERROR_RPM ) { if ( ++errorDialInMotorSpeedPersistTimerCtr >= DIP_MOTOR_SPEED_ERROR_PERSIST ) @@ -1070,7 +1070,7 @@ errorDialInMotorSpeedPersistTimerCtr = 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 > DIP_MAX_ROTOR_VS_MOTOR_DIFF_RPM ) { if ( ++errorDialInRotorSpeedPersistTimerCtr >= DIP_ROTOR_SPEED_ERROR_PERSIST ) @@ -1105,7 +1105,7 @@ *************************************************************************/ static void checkDialInPumpFlowAgainstSpeed( void ) { - // check only performed while in treatment mode and while we're in control to target state + // Check only performed while in treatment mode and while we're in control to target state if ( ( MODE_TREA == getCurrentOperationMode() ) && ( DIAL_IN_PUMP_CONTROL_TO_TARGET_STATE == dialInPumpState ) ) { F32 flow = getMeasuredDialInFlowRate(); @@ -1198,7 +1198,7 @@ #ifndef DISABLE_PUMP_FLOW_CHECKS HD_OP_MODE_T opMode = getCurrentOperationMode(); - // check flow sensor signal strength when appropriate TODO - in pre-treatment, must be far enough along for fluid to be in tubing + // Check flow sensor signal strength when appropriate TODO - in pre-treatment, must be far enough along for fluid to be in tubing if ( MODE_TREA == opMode || ( MODE_PRET == opMode && FALSE ) ) { F32 sigStrength = getMeasuredDialInFlowSignalStrength(); @@ -1225,7 +1225,7 @@ switch ( dialInPumpSelfTestState ) { case DIAL_IN_FLOW_SELF_TEST_STATE_START: - // retrieve blood flow sensor calibration data + // Retrieve blood flow sensor calibration data if ( TRUE == getCalibrationData( &cal ) ) { dialInFlowCalGain = cal.dialysateFlowGain; Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -rac05209d7b6c65b22359754eced5ad2672d3092a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision ac05209d7b6c65b22359754eced5ad2672d3092a) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -278,7 +278,7 @@ } 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 ) } @@ -335,7 +335,7 @@ 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; @@ -422,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 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(); } @@ -540,7 +540,7 @@ } result = DIAL_OUT_PUMP_CONTROL_TO_TARGET_STATE; } - // continue ramp up + // Continue ramp up else { dialOutPumpPWMDutyCyclePctSet += MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE; @@ -581,7 +581,7 @@ } result = DIAL_OUT_PUMP_CONTROL_TO_TARGET_STATE; } - // continue ramp down + // Continue ramp down else { dialOutPumpPWMDutyCyclePctSet -= MAX_DIAL_OUT_PUMP_PWM_STEP_DN_CHANGE; @@ -603,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 ) @@ -815,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 ) @@ -825,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 ) @@ -862,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 ) @@ -893,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 ) @@ -908,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 ) Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -rce3e0696642099164fa482c864509c67ce65579b -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision ce3e0696642099164fa482c864509c67ce65579b) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -88,7 +88,7 @@ static OVERRIDE_U32_T dialInPumpOcclusion = {0, 0, 0, 0 }; ///< measured dialysate inlet pump occlusion pressure. static OVERRIDE_U32_T dialOutPumpOcclusion = {0, 0, 0, 0 }; ///< measured dialysate outlet pump occlusion pressure. -/// current pressure self-test state. +/// Current pressure self-test state. static PRESSURE_SELF_TEST_STATE_T presOcclSelfTestState = PRESSURE_SELF_TEST_STATE_START; static U32 bloodPumpSelfTestTimerCount = 0; ///< timer counter for pressure self-test. @@ -207,17 +207,17 @@ { PRESSURE_STATE_T result = PRESSURE_CONTINUOUS_READ_STATE; - // read latest in-line (arterial and venous) pressures + // Read latest in-line (arterial and venous) pressures convertInlinePressures(); - // read latest occlusion pressures + // Read latest occlusion pressures convertOcclusionPressures(); - // check in-line pressures are in range + // Check in-line pressures are in range checkArterialPressureInRange(); checkVenousPressureInRange(); - // check for occlusions + // Check for occlusions checkOcclusions(); return result; @@ -243,7 +243,7 @@ // TODO - any filtering required??? - // convert arterial pressure to mmHg if no alarm + // Convert arterial pressure to mmHg if no alarm if ( 0 == artPresAlarm ) { arterialPressure.data = ARTERIAL_PRESSURE_V_PER_BIT * ( (F32)(artPres) / ( ARTERIAL_PRESSURE_SENSITIVITY * ARTERIAL_PRESSURE_V_BIAS ) ); @@ -255,9 +255,9 @@ #endif } - // convert venous pressure to PSI + // Convert venous pressure to PSI venPresPSI = ( (F32)(venPres - VENOUS_PRESSURE_OFFSET) * (VENOUS_PRESSURE_MAX - VENOUS_PRESSURE_MIN) / (F32)VENOUS_PRESSURE_SCALE ) + VENOUS_PRESSURE_MIN; - // convert venous pressure from PSI to mmHg if sensor status is normal + // Convert venous pressure from PSI to mmHg if sensor status is normal if ( VENOUS_PRESSURE_NORMAL_OP == venPresStatus ) { venousPressure.data = venPresPSI * PSI_TO_MMHG; @@ -274,7 +274,7 @@ } } - // check for venous pressure sensor alarm or in wrong (cmd) mode + // Check for venous pressure sensor alarm or in wrong (cmd) mode if ( ( VENOUS_PRESSURE_DIAG_CONDITION == venPresStatus ) || ( VENOUS_PRESSURE_CMD_MODE == venPresStatus ) ) { #ifndef DISABLE_PRESSURE_CHECKS @@ -312,7 +312,7 @@ { F32 artPres = getMeasuredArterialPressure(); - // check arterial pressure during treatment mode + // Check arterial pressure during treatment mode if ( MODE_TREA == getCurrentOperationMode() ) { F32 artLowLimit = (F32)getTreatmentParameterS32( TREATMENT_PARAM_ART_PRESSURE_LOW_LIMIT ); @@ -337,7 +337,7 @@ { F32 venPres = getMeasuredVenousPressure(); - // check arterial pressure during treatment mode + // Check arterial pressure during treatment mode if ( MODE_TREA == getCurrentOperationMode() ) { F32 venLowLimit = (F32)getTreatmentParameterS32( TREATMENT_PARAM_VEN_PRESSURE_LOW_LIMIT ); Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r3df4c16999408c02204131555c5d8551d8bcc3b9 -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 3df4c16999408c02204131555c5d8551d8bcc3b9) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -273,7 +273,7 @@ valvesStatus[ valve ].execState = VALVE_STATE_WAIT_FOR_POST; } - // close air trap valve + // Close air trap valve setValveAirTrap( STATE_CLOSED ); } Index: firmware/App/Drivers/SafetyShutdown.c =================================================================== diff -u -rc67def50892f9a7c2f1f22985b5351465a8f6773 -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Drivers/SafetyShutdown.c (.../SafetyShutdown.c) (revision c67def50892f9a7c2f1f22985b5351465a8f6773) +++ firmware/App/Drivers/SafetyShutdown.c (.../SafetyShutdown.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -93,7 +93,7 @@ if ( TRUE == isTestingActivated() ) { - // remember natural state before override so we can reset + // Remember natural state before override so we can reset safetyShutdownOverrideResetState = safetyShutdownActivated; // override safety shutdown signal if ( value > 0 ) Index: firmware/App/HDCommon.h =================================================================== diff -u -rac05209d7b6c65b22359754eced5ad2672d3092a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/HDCommon.h (.../HDCommon.h) (revision ac05209d7b6c65b22359754eced5ad2672d3092a) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -25,38 +25,38 @@ #define HD_VERSION_MAJOR 0 #define HD_VERSION_MINOR 4 #define HD_VERSION_MICRO 5 -#define HD_VERSION_BUILD 11 +#define HD_VERSION_BUILD 0 // ********** development build switches ********** #ifndef _RELEASE_ #ifndef _VECTORCAST_ -// #define RUN_WITHOUT_DG 1 // run HD w/o DG -// #define SIMULATE_UI 1 // build w/o requirement that UI be there -// #define TASK_TIMING_OUTPUT_ENABLED 1 // re-purposes alarm lamp pins for task timing -// #define DISABLE_ALARM_AUDIO 1 // disable alarm audio - #define SKIP_POST 1 // skip POST tests - all pass -// #define LIMITED_NVDATA_CRC_CHECKS 1 // only perform POST CRC checks on nv-data records that are implemented so far - #define DISABLE_AIR_TRAP_LEVELING 1 // disable air trap level control -// #define DISABLE_3WAY_VALVES 1 // disable 3-way valves -// #define TST_3WAY_VALVES_ALWAYS_OPEN 1 // after POST and homing, open all 4 valves - #define DISABLE_ACCELS 1 // disable accelerometer POST and monitoring - #define DISABLE_CRC_ERROR 1 // do not error on bad CRC for CAN messages - #define DISABLE_ACK_ERRORS 1 // do not error on failure of other node(s) to ACK a message - #define DISABLE_MOTOR_CURRENT_CHECKS 1 // do not error on HD pump current checks - #define DISABLE_PUMP_FLOW_CHECKS 1 // do not error on HD pump flow checks - #define DISABLE_PUMP_SPEED_CHECKS 1 // do not error on HD pump speed checks - #define DISABLE_PUMP_DIRECTION_CHECKS 1 // do not error on HD pump direction checks - #define DISABLE_SALINE_BOLUS_CHECKS 1 // do not error on HD saline bolus checks - #define DISABLE_PRESSURE_CHECKS 1 // do not error on HD pressure checks - #define DISABLE_UF_ALARMS 1 // do not error on HD ultrafiltration checks - #define DISABLE_VALVE_ALARMS 1 // do not error on HD valve position +// #define RUN_WITHOUT_DG 1 // Run HD w/o DG +// #define SIMULATE_UI 1 // Build w/o requirement that UI be there +// #define TASK_TIMING_OUTPUT_ENABLED 1 // Re-purposes alarm lamp pins for task timing +// #define DISABLE_ALARM_AUDIO 1 // Disable alarm audio + #define SKIP_POST 1 // Skip POST tests - all pass +// #define LIMITED_NVDATA_CRC_CHECKS 1 // Only perform POST CRC checks on nv-data records that are implemented so far + #define DISABLE_AIR_TRAP_LEVELING 1 // Disable air trap level control +// #define DISABLE_3WAY_VALVES 1 // Disable 3-way valves +// #define TST_3WAY_VALVES_ALWAYS_OPEN 1 // After POST and homing, open all 4 valves + #define DISABLE_ACCELS 1 // Disable accelerometer POST and monitoring + #define DISABLE_CRC_ERROR 1 // Do not error on bad CRC for CAN messages + #define DISABLE_ACK_ERRORS 1 // Do not error on failure of other node(s) to ACK a message + #define DISABLE_MOTOR_CURRENT_CHECKS 1 // Do not error on HD pump current checks + #define DISABLE_PUMP_FLOW_CHECKS 1 // Do not error on HD pump flow checks + #define DISABLE_PUMP_SPEED_CHECKS 1 // Do not error on HD pump speed checks + #define DISABLE_PUMP_DIRECTION_CHECKS 1 // Do not error on HD pump direction checks + #define DISABLE_SALINE_BOLUS_CHECKS 1 // Do not error on HD saline bolus checks + #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure checks + #define DISABLE_UF_ALARMS 1 // Do not error on HD ultrafiltration checks + #define DISABLE_VALVE_ALARMS 1 // Do not error on HD valve position // #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) -// #define RAW_FLOW_SENSOR_DATA 1 // test build will not filter flow sensor data -// #define READ_FPGA_ASYNC_DATA 1 // test build reads non-priority register page every other time +// #define RAW_FLOW_SENSOR_DATA 1 // Test build will not filter flow sensor data +// #define READ_FPGA_ASYNC_DATA 1 // Test build reads non-priority register page every other time // #define EMC_TEST_BUILD 1 // EMC test build - HD/DG run separately but connected, HD pumps toggle on/off w/ stop button - #define ALARMS_DEBUG 1 // triggered alarms sent to debug UART - #define V1_5_SYSTEM 1 // build for v1.5 system + #define ALARMS_DEBUG 1 // Triggered alarms sent to debug UART + #define V1_5_SYSTEM 1 // Build for v1.5 system #include #include Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -r6a414654391c1729525d55812abbf111ddef7d6a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 6a414654391c1729525d55812abbf111ddef7d6a) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -243,7 +243,7 @@ setValvePosition( VDO, VALVE_POSITION_B_OPEN ); setValvePosition( VBA, VALVE_POSITION_B_OPEN ); setValvePosition( VBV, VALVE_POSITION_B_OPEN ); - // restart pumps + // Restart pumps #ifndef RUN_PUMPS_OPEN_LOOP setBloodPumpTargetFlowRate( setBloodFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); setDialInPumpTargetFlowRate( setDialysateFlowRate, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); @@ -483,7 +483,7 @@ result = TRUE; // set outlet pump to dialysate rate + set UF rate setDialOutPumpTargetRate( setDialysateFlowRate + FLOAT_TO_INT_WITH_ROUND( setUFRate ), MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); - // restart UF time accumulation for reference volume calculation + // Restart UF time accumulation for reference volume calculation lastUFTimeStamp = getMSTimerCount(); // go to UF paused state currentUFState = UF_RUNNING_STATE; @@ -698,9 +698,9 @@ salineBolusAutoResumeUF = FALSE; // set outlet pump to dialysate rate + set UF rate setDialOutPumpTargetRate( setDialysateFlowRate + FLOAT_TO_INT_WITH_ROUND( setUFRate ), MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); - // restart UF time accumulation for reference volume calculation + // Restart UF time accumulation for reference volume calculation lastUFTimeStamp = getMSTimerCount(); - // resume UF + // Resume UF result = UF_RUNNING_STATE; } @@ -876,7 +876,7 @@ if ( ( FALSE == isBloodPumpRunning() ) && ( FALSE == isDialInPumpRunning() ) && ( FALSE == isDialOutPumpRunning() ) ) { - // reset bolus data before we start + // Reset bolus data before we start bolusSalineVolumeDelivered = 0.0; bolusSalineVolumeDelivered_Safety = 0.0; bolusSalineMotorCount = 0; @@ -996,12 +996,12 @@ // end dialyzer bypass and resume dialysis if no alarms triggered if ( FALSE == errorFound ) { - // resume UF if appropriate + // Resume UF if appropriate if ( TRUE == salineBolusAutoResumeUF ) { currentUFState = UF_RUNNING_STATE; } - // resume dialysis + // Resume dialysis startDialysis(); } } @@ -1076,7 +1076,7 @@ { if ( ++uFAccuracyCheckTimerCtr >= UF_ACCURACY_CHECK_INTERVAL ) { - // reset for next check interval + // Reset for next check interval lastUFVolumeChecked = measUFVolume; uFAccuracyCheckTimerCtr = 0; } Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -rac05209d7b6c65b22359754eced5ad2672d3092a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision ac05209d7b6c65b22359754eced5ad2672d3092a) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -118,7 +118,7 @@ *************************************************************************/ void signalAlarmActionToPreTreatmentMode( ALARM_ACTION_T action ) { - + // TODO - implement } /**@}*/ Index: firmware/App/Modes/ModeService.c =================================================================== diff -u -r7325348a8b5fce9101d0f68d89c791d48e1a3575 -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Modes/ModeService.c (.../ModeService.c) (revision 7325348a8b5fce9101d0f68d89c791d48e1a3575) +++ firmware/App/Modes/ModeService.c (.../ModeService.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -78,7 +78,7 @@ *************************************************************************/ void signalAlarmActionToServiceMode( ALARM_ACTION_T action ) { - + // TODO - implement } /**@}*/ Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -rac05209d7b6c65b22359754eced5ad2672d3092a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision ac05209d7b6c65b22359754eced5ad2672d3092a) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -69,7 +69,7 @@ *************************************************************************/ void transitionToStandbyMode( void ) { - // re-initialize when transitioning to standby mode + // Re-initialize when transitioning to standby mode initStandbyMode(); initDGInterface(); resetAirTrap(); @@ -324,7 +324,7 @@ *************************************************************************/ void signalAlarmActionToStandbyMode( ALARM_ACTION_T action ) { - + // TODO - implement } /**@}*/ Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -rac05209d7b6c65b22359754eced5ad2672d3092a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision ac05209d7b6c65b22359754eced5ad2672d3092a) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -558,7 +558,7 @@ F32 rateDiff = 0.0; HD_OP_MODE_T currMode = getCurrentOperationMode(); - // reset pending UF/time settings changes to current values in case request is rejected + // Reset pending UF/time settings changes to current values in case request is rejected pendingUFVolumeChange = presMaxUFVolumeML; pendingUFRateChange = presUFRate; pendingTreatmentTimeChange = presTreatmentTimeSecs / SEC_PER_MIN; @@ -637,7 +637,7 @@ rejectReason = REQUEST_REJECT_REASON_TREATMENT_TOO_CLOSE_TO_FINISHED; } } - // respond to UF settings change request + // Respond to UF settings change request sendChangeUFSettingsResponse( result, rejectReason, pendingUFVolumeChange, pendingTreatmentTimeChange, pendingUFRateChange, timeDiff, rateDiff, presUFRate ); return result; @@ -698,7 +698,7 @@ rejectReason = REQUEST_REJECT_REASON_TIMEOUT_WAITING_FOR_USER_CONFIRM; } } - // respond to UF settings change confirmation + // Respond to UF settings change confirmation sendChangeUFSettingsOptionResponse( result, rejectReason, presMaxUFVolumeML, presTreatmentTimeSecs / SEC_PER_MIN, presUFRate ); // send new ranges for settings broadcastTreatmentSettingsRanges(); @@ -844,7 +844,7 @@ setTreatmentParameterS32( TREATMENT_PARAM_VEN_PRESSURE_HIGH_LIMIT, data->venHighLimit ); } - // read back limits for transmit to UI. + // Read back limits for transmit to UI. respRecord.artLowLimit = getTreatmentParameterS32( TREATMENT_PARAM_ART_PRESSURE_LOW_LIMIT ); respRecord.artHighLimit = getTreatmentParameterS32( TREATMENT_PARAM_ART_PRESSURE_HIGH_LIMIT ); respRecord.venLowLimit = getTreatmentParameterS32( TREATMENT_PARAM_VEN_PRESSURE_LOW_LIMIT ); Index: firmware/App/Modes/ModeTreatmentParams.c =================================================================== diff -u -rac05209d7b6c65b22359754eced5ad2672d3092a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision ac05209d7b6c65b22359754eced5ad2672d3092a) +++ firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -115,10 +115,10 @@ *************************************************************************/ void transitionToTreatParamsMode( void ) { - // reset this mode + // Reset this mode initTreatParamsMode(); - // reset all treatment parameters when transitioning to this mode + // Reset all treatment parameters when transitioning to this mode resetAllTreatmentParameters(); validTreatParamsReceived = FALSE; @@ -334,7 +334,7 @@ // TODO - should never get here - s/w fault? } } - // retain original settings for treatment that may be adjusted later during treatment + // Retain original settings for treatment that may be adjusted later during treatment origTreatmentParams.bloodFlowRate_mL_min = getCriticalData( &treatmentParameters[ TREATMENT_PARAM_BLOOD_FLOW ] ).uInt; origTreatmentParams.dialysateFlowRate_mL_min = getCriticalData( &treatmentParameters[ TREATMENT_PARAM_DIALYSATE_FLOW ] ).uInt; origTreatmentParams.treatmentDuration_min = getCriticalData( &treatmentParameters[ TREATMENT_PARAM_TREATMENT_DURATION ] ).uInt; @@ -371,7 +371,7 @@ * volume treatment parameter. * @details Inputs: none * @details Outputs: - * @param params payload record from treatment parameters message received from UI + * @param uFVolumeMl UF volume (in mL) from UI to validate * @return TRUE if received UF volume parameter is valid, FALSE if not *************************************************************************/ BOOL validateAndSetUFVolume( F32 uFVolumeMl ) @@ -387,7 +387,7 @@ rejReason = REQUEST_REJECT_REASON_UF_VOLUME_OUT_OF_RANGE; } - // respond to set treatment parameters request message + // Respond to set treatment parameters request message uFVolumeL = getTreatmentParameterF32( TREATMENT_PARAM_UF_VOLUME ); uFVolumeMl = uFVolumeL * (F32)ML_PER_LITER; sendUFVolumeSetResponseMsg( accepted, rejReason, uFVolumeMl ); @@ -413,7 +413,7 @@ // extract treatment parameters from given payload to staging array so we can more easily work with them extractTreatmentParamsFromPayload( params ); - // range check each treatment parameter + // Range check each treatment parameter paramsAreInRange = checkTreatmentParamsInRange( &rejReasons[0] ); // validate dependencies @@ -426,7 +426,7 @@ validTreatParamsReceived = TRUE; } - // respond to set treatment parameters request message + // Respond to set treatment parameters request message sendTreatmentParamsResponse( paramsAreInvalid, &rejReasons[0] ); return !paramsAreInvalid; @@ -446,7 +446,7 @@ BOOL result = TRUE; TREATMENT_PARAM_T param; - // range check treatment parameters up to (but not including) UF volume + // Range check treatment parameters up to (but not including) UF volume for ( param = TREATMENT_PARAM_FIRST_UINT; param < TREATMENT_PARAM_UF_VOLUME; param++ ) { BOOL isParamInRange = isTreatmentParamInRange( param, stagedParams[ param ] ); Index: firmware/App/Modes/OperationModes.h =================================================================== diff -u -rf6888c7e4e05cb84b11fceb4340458d8af543ce8 -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision f6888c7e4e05cb84b11fceb4340458d8af543ce8) +++ firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -35,7 +35,7 @@ void initOperationModes( void ); // initialize this module void execOperationModes( void ); // execute the operation modes state machine (scheduled periodic call) -void requestNewOperationMode( HD_OP_MODE_T newMode ); // request a transition to a new operation mode +void requestNewOperationMode( HD_OP_MODE_T newMode ); // Request a transition to a new operation mode HD_OP_MODE_T getCurrentOperationMode( void ); // get the current operation mode void initiateAlarmAction( ALARM_ACTION_T action ); // initiate an alarm or alarm recovery action according to current op mode Index: firmware/App/Modes/TreatmentStop.c =================================================================== diff -u -rac05209d7b6c65b22359754eced5ad2672d3092a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision ac05209d7b6c65b22359754eced5ad2672d3092a) +++ firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -58,7 +58,7 @@ setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); - // reset saline bolus state in case alarm interrupted one + // Reset saline bolus state in case alarm interrupted one resetSalineBolus(); // stop air trap control endAirTrapControl(); Index: firmware/App/Services/CommBuffers.c =================================================================== diff -u -rc67def50892f9a7c2f1f22985b5351465a8f6773 -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision c67def50892f9a7c2f1f22985b5351465a8f6773) +++ firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -57,7 +57,7 @@ { S32 b; - // reset and zero out all buffers + // Reset and zero out all buffers for ( b = 0; b < NUM_OF_COMM_BUFFERS; b++ ) { clearBuffer( (COMM_BUFFER_T)b ); @@ -90,7 +90,7 @@ memset( &commBuffers[ buffer ][ d ][ 0 ], 0, COMM_BUFFER_LENGTH ); } - // release thread protection + // Release thread protection _enable_IRQ(); } } @@ -146,7 +146,7 @@ { bufferFull = TRUE; } - // release thread protection + // Release thread protection _enable_IRQ(); } @@ -239,7 +239,7 @@ result += remNumOfBytes; } } - // release thread protection + // Release thread protection _enable_IRQ(); } else // invalid buffer given @@ -296,7 +296,7 @@ numOfBytesPeeked = bytesInInactiveBuffer + remNumOfBytes; } } - // release thread protection + // Release thread protection _enable_IRQ(); } else // invalid buffer given @@ -358,7 +358,7 @@ // switch buffers activeDoubleBuffer[ buffer ] = inactiveBuffer; - // return the new active buffer (was just inactive) + // Return the new active buffer (was just inactive) return inactiveBuffer; } @@ -389,7 +389,7 @@ // move un-consumed data in inactive buffer to start of inactive buffer memcpy( &commBuffers[ buffer ][ inactiveBuffer ][ 0 ], endPtr, ( bytesInInactiveBuffer - len ) ); - // reduce byte count for inactive buffer by # of bytes consumed + // Reduce byte count for inactive buffer by # of bytes consumed commBufferByteCount[ buffer ][ inactiveBuffer ] -= len; } else Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rab529a77ce03051a5940ee59b7542837778f8788 -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision ab529a77ce03051a5940ee59b7542837778f8788) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -98,7 +98,7 @@ U08 accelCmd; ///< Reg 10. Command passed to accelerometer. U08 fpgaSensorTest; ///< Reg 11. Blood leak and bubble detector sensor test register. U16 fpgaPIDControl; ///< Reg 12. Valve PID enables. -} FPGA_HEADER_T; // read only on FPGA +} FPGA_HEADER_T; // Read only on FPGA /// Record structure for FPGA continuous priority reads. typedef struct // TODO - add all sensor readings to this structure per FPGA register map @@ -516,7 +516,7 @@ activateAlarmNoData( ALARM_ID_FPGA_COMM_TIMEOUT ); } - // reset comm flags after processing incoming responses + // Reset comm flags after processing incoming responses resetFPGACommFlags(); } @@ -740,7 +740,7 @@ fpgaCommRetryCount++; } } - else // read command was NAK'd + else // Read command was NAK'd { fpgaCommRetryCount++; } @@ -823,7 +823,7 @@ fpgaCommRetryCount++; } } - else // read command was NAK'd + else // Read command was NAK'd { fpgaCommRetryCount++; } @@ -1069,7 +1069,7 @@ *************************************************************************/ void setAlarmAudioState( ALARM_PRIORITY_T state, U32 volumeLevel ) { - if ( state < NUM_OF_ALARM_PRIORITIES && volumeLevel <= MAX_ALARM_VOLUME_ATTENUATION ) + if ( ( ( state < NUM_OF_ALARM_PRIORITIES ) && ( volumeLevel ) ) <= MAX_ALARM_VOLUME_ATTENUATION ) { U08 audioCmd = (U08)state; Index: firmware/App/Services/MsgQueues.c =================================================================== diff -u -rc67def50892f9a7c2f1f22985b5351465a8f6773 -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Services/MsgQueues.c (.../MsgQueues.c) (revision c67def50892f9a7c2f1f22985b5351465a8f6773) +++ firmware/App/Services/MsgQueues.c (.../MsgQueues.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -46,7 +46,7 @@ { U32 q, m; - // reset message queues + // Reset message queues for ( q = 0; q < NUM_OF_MSG_QUEUES; q++ ) { msgQueueCounts[ q ] = 0; @@ -129,7 +129,7 @@ } else // message queue is empty { - // result already set to FALSE + // Result already set to FALSE } } else // invalid message queue Index: firmware/App/Services/PIControllers.c =================================================================== diff -u -rd91a24c730aeb5cd7e3eba9ef4eca78e442911f8 -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Services/PIControllers.c (.../PIControllers.c) (revision d91a24c730aeb5cd7e3eba9ef4eca78e442911f8) +++ firmware/App/Services/PIControllers.c (.../PIControllers.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -30,7 +30,7 @@ /// minimum integral coefficient - cannot be zero. #define MIN_KI NEARLY_ZERO -/// record for PI controller. +/// Record for PI controller. typedef struct { // -- PI's parameters -- F32 Kp; ///< Proportional Value. Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r6a414654391c1729525d55812abbf111ddef7d6a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 6a414654391c1729525d55812abbf111ddef7d6a) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -636,7 +636,7 @@ { // we're transmitting another packet - signal transmitter is busy signalCANXmitsInitiated(); - // remember packet data being transmitted here in case transmission fails and we need to re-send + // Remember packet data being transmitted here in case transmission fails and we need to re-send memcpy( lastCANPacketSent, data, CAN_MESSAGE_PAYLOAD_SIZE ); lastCANPacketSentChannel = mBox; lastCANPacketSentTimeStamp = getMSTimerCount(); @@ -987,7 +987,7 @@ _disable_IRQ(); // slot selection needs interrupt protection if ( FALSE == pendingAckList[ i ].used ) { - S16 seqNo = msg->hdr.seqNo * -1; // remove ACK bit from seq # + S16 seqNo = msg->hdr.seqNo * -1; // Remove ACK bit from seq # pendingAckList[ i ].used = TRUE; _enable_IRQ(); @@ -1030,7 +1030,7 @@ for ( i = 0; i < PENDING_ACK_LIST_SIZE; i++ ) { if ( ( TRUE == pendingAckList[ i ].used ) && ( pendingAckList[ i ].seqNo == seqNo ) ) - { // remove message pending ACK from list + { // Remove message pending ACK from list pendingAckList[ i ].used = FALSE; result = TRUE; break; @@ -1059,7 +1059,7 @@ if ( ( TRUE == pendingAckList[ i ].used ) && ( TRUE == didTimeout( pendingAckList[ i ].timeStamp, MSG_NOT_ACKED_TIMEOUT_MS ) ) ) { // if retries left, reset and resend pending message if ( pendingAckList[ i ].retries > 0 ) - { // re-queue message for transmit + { // Re-queue message for transmit pendingAckList[ i ].retries--; pendingAckList[ i ].timeStamp = getMSTimerCount(); addToCommBuffer( pendingAckList[ i ].channel, (U08*)pendingAckList[ i ].msg, pendingAckList[ i ].msgSize ); Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r6a414654391c1729525d55812abbf111ddef7d6a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 6a414654391c1729525d55812abbf111ddef7d6a) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -2227,7 +2227,7 @@ { testerLoggedIn = FALSE; } - // respond to would be tester + // Respond to would be tester sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, testerLoggedIn ); } @@ -2260,7 +2260,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2292,7 +2292,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2324,7 +2324,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2356,7 +2356,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2388,7 +2388,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2420,7 +2420,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2445,7 +2445,7 @@ result = testSetTargetBloodFlowRateOverride( payload.setPt, payload.ctrlMode ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2477,7 +2477,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2509,7 +2509,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2541,7 +2541,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2573,7 +2573,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2605,7 +2605,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2637,7 +2637,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2669,7 +2669,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2694,7 +2694,7 @@ result = testSetTargetDialInFlowRateOverride( payload.setPt, payload.ctrlMode ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2719,7 +2719,7 @@ result = testSetTargetDialOutFlowRateOverride( payload.setPt, payload.ctrlMode ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2751,7 +2751,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2783,7 +2783,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2815,7 +2815,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2847,7 +2847,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2879,7 +2879,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2911,7 +2911,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2943,7 +2943,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -2975,7 +2975,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3007,7 +3007,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3039,7 +3039,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3071,7 +3071,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3103,7 +3103,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3135,7 +3135,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3165,7 +3165,7 @@ result = setRTCTimestamp( seconds, minutes, hours, days, months, years ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3197,7 +3197,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3230,7 +3230,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3263,7 +3263,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3296,7 +3296,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3329,7 +3329,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3361,7 +3361,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3393,7 +3393,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3425,7 +3425,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3457,7 +3457,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3489,7 +3489,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3521,7 +3521,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3553,7 +3553,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3579,7 +3579,7 @@ result = setAccelCalibration( payload.xOffset, payload.yOffset, payload.zOffset ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3605,7 +3605,7 @@ result = setBloodFlowCalibration( payload.gain, payload.offset ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3631,7 +3631,7 @@ result = setDialInFlowCalibration( payload.gain, payload.offset ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3657,7 +3657,7 @@ result = testSetTreatmentParameter( (TREATMENT_PARAM_T)payload[0].uInt, payload[1] ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3684,7 +3684,7 @@ result = TRUE; } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3716,7 +3716,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3743,7 +3743,7 @@ result = TRUE; } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3775,7 +3775,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3808,7 +3808,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } #endif @@ -3841,7 +3841,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3873,7 +3873,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3896,14 +3896,14 @@ // tester must be logged in if ( TRUE == isTestingActivated() ) { // s/w reset of processor - result = TRUE; // reset will prevent this from getting transmitted though + result = TRUE; // Reset will prevent this from getting transmitted though #ifndef _VECTORCAST_ - systemREG1->SYSECR = (0x2) << 14; // reset processor + systemREG1->SYSECR = (0x2) << 14; // Reset processor #endif } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3926,7 +3926,7 @@ result = homeBloodPump(); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3949,7 +3949,7 @@ result = homeDialInPump(); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3972,7 +3972,7 @@ result = homeDialOutPump(); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -4000,7 +4000,7 @@ result = TRUE; } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -4040,7 +4040,7 @@ } } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -4067,7 +4067,7 @@ result = testResetCalibrationData( key ); } - // respond to request + // Respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } Index: firmware/App/Services/WatchdogMgmt.c =================================================================== diff -u -rac05209d7b6c65b22359754eced5ad2672d3092a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision ac05209d7b6c65b22359754eced5ad2672d3092a) +++ firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -288,7 +288,7 @@ // pulse the watchdog signal toggleCPLDWatchdog(); - // remember when we last pet the watchdog + // Remember when we last pet the watchdog lastWatchdogPetTime = getMSTimerCount(); } Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -rac05209d7b6c65b22359754eced5ad2672d3092a -r78c03fb021407eaf8d17dd0f74f6969443b397ce --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision ac05209d7b6c65b22359754eced5ad2672d3092a) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 78c03fb021407eaf8d17dd0f74f6969443b397ce) @@ -66,7 +66,7 @@ // monitor pressure/occlusion sensors execPresOccl(); - // run operation mode state machine + // Run operation mode state machine execOperationModes(); // control air trap valve