Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r3e24cbff2cbf0ce9af2e998e6a9a2ed4733bbe27 -rc282822f36836a8127f447c8ac5b8a50e851be63 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 3e24cbff2cbf0ce9af2e998e6a9a2ed4733bbe27) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -14,9 +14,10 @@ * @date (original) 08-Apr-2020 * ***************************************************************************/ - -#include "DialInFlow.h" + +#include "DialInFlow.h" #include "DGDefs.h" +#include "ModeInitPOST.h" #include "ModeTreatment.h" #include "OperationModes.h" #include "SystemCommMessages.h" @@ -36,8 +37,8 @@ #define RESERVOIR_SETTLE_TIME_MS 5000 ///< Time (in ms) allotted for reservoir to settle (after fill, before drain). #define SIZE_OF_SMALL_LOAD_CELL_AVG 8 ///< Small load cell moving average has 8 samples. -#define SIZE_OF_LARGE_LOAD_CELL_AVG 32 ///< Large load cell moving average has 32 samples. - +#define SIZE_OF_LARGE_LOAD_CELL_AVG 32 ///< Large load cell moving average has 32 samples. + /// States of the treatment reservoir management state machine. typedef enum TreatmentReservoirMgmt_States { @@ -83,14 +84,14 @@ static F32 lgFilteredReservoirWeightInGrams[ NUM_OF_DG_RESERVOIRS ]; // Load cell filtering data -/// Holds load cell samples for small load cell moving average +/// Holds load cell samples for small load cell moving average. static F32 smLoadCellReadings[ NUM_OF_DG_RESERVOIRS ][ SIZE_OF_SMALL_LOAD_CELL_AVG ]; -static U32 smLoadCellReadingsIdx = 0; ///< index for next sample in small load cell rolling average sample array -static F32 smLoadCellReadingsTotal[ NUM_OF_DG_RESERVOIRS ]; ///< rolling total - used to calc small load cell moving average -/// Holds load cell samples for large load cell moving average +static U32 smLoadCellReadingsIdx = 0; ///< Index for next sample in small load cell rolling average sample array. +static F32 smLoadCellReadingsTotal[ NUM_OF_DG_RESERVOIRS ]; ///< Rolling total - used to calc small load cell moving average. +/// Holds load cell samples for large load cell moving average. static F32 lgLoadCellReadings[ NUM_OF_DG_RESERVOIRS ][ SIZE_OF_LARGE_LOAD_CELL_AVG ]; -static U32 lgLoadCellReadingsIdx = 0; ///< index for next sample in large load cell rolling average sample array -static F32 lgLoadCellReadingsTotal[ NUM_OF_DG_RESERVOIRS ]; ///< rolling total - used to calc large load cell moving average +static U32 lgLoadCellReadingsIdx = 0; ///< Index for next sample in large load cell rolling average sample array. +static F32 lgLoadCellReadingsTotal[ NUM_OF_DG_RESERVOIRS ]; ///< Rolling total - used to calc large load cell moving average. // DG pumps data static F32 dgROPumpFlowRateMlMin = 0.0; ///< Latest RO water flow rate reported by the DG. @@ -456,7 +457,7 @@ * @param loadCellID ID of load cell to get * @return the current load cell weight in grams *************************************************************************/ -F32 getLoadCellWeightInGrams( LOAD_CELL_T loadCellID ) +F32 getLoadCellWeightInGrams( LOAD_CELL_ID_T loadCellID ) { F32 result = 0.0; @@ -665,6 +666,8 @@ void setNewLoadCellReadings( F32 res1Primary, F32 res1Backup, F32 res2Primary, F32 res2Backup ) { DG_RESERVOIR_ID_T res; + DG_RESERVOIR_ID_T activeRes = getDGActiveReservoir(); + BOOL inTreatment = ( MODE_TREA == getCurrentOperationMode() ? TRUE : FALSE ); loadCellWeightInGrams[ LOAD_CELL_RESERVOIR_1_PRIMARY ].data = res1Primary; loadCellWeightInGrams[ LOAD_CELL_RESERVOIR_1_BACKUP ].data = res1Backup; @@ -674,8 +677,7 @@ // feed new weight samples into filters and update moving averages for ( res = DG_RESERVOIR_1; res < NUM_OF_DG_RESERVOIRS; res++ ) { - F32 wt = ( res == DG_RESERVOIR_1 ? res1Primary : res2Primary ); - + F32 wt = ( res == DG_RESERVOIR_1 ? res1Primary : res2Primary ); smLoadCellReadingsTotal[ res ] -= smLoadCellReadings[ res ][ smLoadCellReadingsIdx ]; lgLoadCellReadingsTotal[ res ] -= lgLoadCellReadings[ res ][ lgLoadCellReadingsIdx ]; smLoadCellReadings[ res ][ smLoadCellReadingsIdx ] = wt; Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -rd4a90fda6c1f463633a4e7d45424acd2d2a0bce8 -rc282822f36836a8127f447c8ac5b8a50e851be63 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision d4a90fda6c1f463633a4e7d45424acd2d2a0bce8) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -39,32 +39,14 @@ #define FILL_RESERVOIR_TO_VOLUME_ML 1300 ///< Fill reservoir to this volume (in mL) during treatment. #endif -/// Enumeration of load cell sensors. -typedef enum Load_Cells -{ - LOAD_CELL_RESERVOIR_1_PRIMARY = 0, ///< Primary load cell for reservoir 1. - LOAD_CELL_RESERVOIR_1_BACKUP, ///< Backup load cell for reservoir 1. - LOAD_CELL_RESERVOIR_2_PRIMARY, ///< Primary load cell for reservoir 2. - LOAD_CELL_RESERVOIR_2_BACKUP, ///< Backup load cell for reservoir 2. - NUM_OF_LOAD_CELLS ///< Number of load cell sensors. -} LOAD_CELL_T; - -/// Enumeration of DG reservoirs. -typedef enum DG_Reservoirs -{ - DG_RESERVOIR_1 = 0, ///< Reservoir #1. - DG_RESERVOIR_2, ///< Reservoir #2. - NUM_OF_DG_RESERVOIRS ///< Number of reservoirs. -} DG_RESERVOIR_ID_T; - /// Enumeration of DG pressure sensors. typedef enum DG_PressureSensors { - DG_PRESSURE_SENSOR_RO_PUMP_INLET = 0, ///< RO pump pressure sensor. - DG_PRESSURE_SENSOR_RO_PUMP_OUTLET, ///< RO pump pressure sensor. - DG_PRESSURE_SENSOR_DRAIN_PUMP_INLET, ///< drain pump inlet pressure. - DG_PRESSURE_SENSOR_DRAIN_PUMP_OUTLET, ///< drain pump outlet pressure. - NUM_OF_DG_PRESSURE_SENSORS ///< Number of pressure sensors. + DG_PRESSURE_SENSOR_RO_PUMP_INLET = 0, ///< RO pump pressure sensor. + DG_PRESSURE_SENSOR_RO_PUMP_OUTLET, ///< RO pump pressure sensor. + DG_PRESSURE_SENSOR_DRAIN_PUMP_INLET, ///< Drain pump inlet pressure. + DG_PRESSURE_SENSOR_DRAIN_PUMP_OUTLET, ///< Drain pump outlet pressure. + NUM_OF_DG_PRESSURE_SENSORS ///< Number of pressure sensors. } DG_PRESSURE_SENSORS_T; /// Payload record structure for an RO pump data message. @@ -123,6 +105,14 @@ BOOL tareLoadCells; } DRAIN_RESERVOIR_CMD_PAYLOAD_T; +/// DG command response data record structure. +typedef struct +{ + U32 commandID; ///< The command DG is responding to + BOOL rejected; ///< Flag indicates if the command has been rejected + U32 rejectCode; ///< Reason code for rejecting the command +} DG_CMD_RESPONSE_T; + // ********** public function prototypes ********** void initDGInterface( void ); @@ -140,7 +130,7 @@ U32 getDGROPumpPressureSetPt( void ); F32 getDGROPumpFlowRateMlMin( void ); U32 getDGDrainPumpRPMSetPt( void ); -F32 getLoadCellWeightInGrams( LOAD_CELL_T loadCellID ); +F32 getLoadCellWeightInGrams( LOAD_CELL_ID_T loadCellID ); F32 getReservoirWeightSmallFilter( DG_RESERVOIR_ID_T resID ); F32 getReservoirWeightLargeFilter( DG_RESERVOIR_ID_T resID ); @@ -163,6 +153,9 @@ void cmdStopDGTrimmerHeater( void ); void cmdDGSampleWater( void ); +void handleDGCommandResponse( U08 *cmdRespPtr ); +void getDGCommandResponse( DG_CMD_RESPONSE_T *cmdRespPtr ); + BOOL testSetDialOutLoadCellWeightOverride( U32 sensor, F32 value ); BOOL testResetDialOutLoadCellWeightOverride( U32 sensor ); Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r766708fceb0bdf1af8c7897df29d4f5036bfd3db -rc282822f36836a8127f447c8ac5b8a50e851be63 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 766708fceb0bdf1af8c7897df29d4f5036bfd3db) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -44,14 +44,14 @@ #define MAX_DIAL_OUT_FLOW_RATE 650 ///< Maximum dialysate outlet pump flow rate in mL/min. #define MIN_DIAL_OUT_FLOW_RATE 100 ///< Minimum dialysate outlet pump flow rate in mL/min. -#define DPO_FLOW_ADJ_DUE_TO_HIGHER_INLET_PRES 0.875 ///< Adjustment factor to account for higher pump inlet pressure (than DPi pump inlet). +#define DPO_FLOW_ADJ_DUE_TO_HIGHER_INLET_PRES 1.000 ///< Adjustment factor to account for higher pump inlet pressure (than DPi pump inlet). #define MAX_DIAL_OUT_PUMP_PWM_STEP_UP_CHANGE 0.0133 ///< Maximum duty cycle change when ramping up ~ 200 mL/min/s. #define MAX_DIAL_OUT_PUMP_PWM_STEP_DN_CHANGE 0.02 ///< Maximum duty cycle change when ramping down ~ 300 mL/min/s. #define MAX_DIAL_OUT_PUMP_PWM_DUTY_CYCLE 0.88 ///< Controller will error if PWM duty cycle > 90%, so set max to 88%. #define MIN_DIAL_OUT_PUMP_PWM_DUTY_CYCLE 0.12 ///< Controller will error if PWM duty cycle < 10%, so set min to 12%. -#define DOP_CONTROL_INTERVAL ( 1000 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the dialysate outlet pump is controlled. +#define DOP_CONTROL_INTERVAL ( 2000 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the dialysate outlet pump is controlled. #define DOP_P_COEFFICIENT 0.0050 ///< P term for dialysate outlet pump control. #define DOP_I_COEFFICIENT 0.0001 ///< I term for dialysate outlet pump control. Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -r9df8618dfd95d3af354e6cbb590ebe6f6fd7ccdd -rc282822f36836a8127f447c8ac5b8a50e851be63 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 9df8618dfd95d3af354e6cbb590ebe6f6fd7ccdd) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -53,6 +53,8 @@ #define MIN_SALINE_BOLUS_VOLUME_PCT 0.8 ///< Minimum saline bolus volume measured by independent means (as % of target). #define MAX_SALINE_BOLUS_VOLUME_PCT 1.2 ///< Maximum saline bolus volume measured by independent means (as % of target). +#define MAX_ACTIVE_LOAD_CELL_CHANGE_G 50.0 ///< Maximum delta between new and previous measured UF volume. + // ********** private data ********** static DIALYSIS_STATE_T currentDialysisState; ///< Current state of the dialysis sub-mode state machine. @@ -1105,11 +1107,23 @@ { DG_RESERVOIR_ID_T activeRes = getDGActiveReservoir(); F32 latestResVolume = getReservoirWeightSmallFilter( activeRes ); +#ifndef DISABLE_UF_ALARMS + F32 deltaVolume = latestResVolume - resFinalVolume[ activeRes ]; - // Calculate UF volumes and provide to dialysate outlet pump controller - measUFVolume = measUFVolumeFromPriorReservoirs + ( latestResVolume - resStartVolume[ activeRes ] ); - resFinalVolume[ activeRes ] = latestResVolume; - setDialOutUFVolumes( refUFVolume, measUFVolume ); + // ensure volume change is not too excessive - indication that load cell was impacted by some kind of shock + if ( fabs(deltaVolume) > MAX_ACTIVE_LOAD_CELL_CHANGE_G ) + { + ALARM_ID_T deltaAlarm = ( getDGActiveReservoir() == DG_RESERVOIR_1 ? ALARM_ID_HD_LOAD_CELL_ACCELERATION_RES_1_ALARM : ALARM_ID_HD_LOAD_CELL_ACCELERATION_RES_2_ALARM ); + SET_ALARM_WITH_1_F32_DATA( deltaAlarm, deltaVolume ); + } + else +#endif + { + // Calculate UF volumes and provide to dialysate outlet pump controller + measUFVolume = measUFVolumeFromPriorReservoirs + ( latestResVolume - resStartVolume[ activeRes ] ); + resFinalVolume[ activeRes ] = latestResVolume; + setDialOutUFVolumes( refUFVolume, measUFVolume ); + } } /*********************************************************************//** Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -r351ae8d56096982a68f7df1b69a3bf4dd5785094 -rc282822f36836a8127f447c8ac5b8a50e851be63 --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 351ae8d56096982a68f7df1b69a3bf4dd5785094) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -15,6 +15,7 @@ * ***************************************************************************/ +#include "AlarmMgmt.h" #include "ModePreTreat.h" #include "OperationModes.h" #include "Prime.h" @@ -25,18 +26,33 @@ * @{ */ +// ********** private definitions ********** + +#define BLOOD_PUMP_RECIRC_FLOW_RATE 100 ///< Blood pump flow rate during recirculation in mL/min. +#define DIALYSATE_PUMP_RECIRC_FLOW_RATE 100 ///< Dialysate pump flow rate during recirculation in mL/min. + // ********** private data ********** static BOOL treatStartReqReceived = FALSE; ///< Flag indicates user requests treatment begin. +static BOOL patientConnectionStartReqReceived = FALSE; ///< Flag indicates user requests patient connection. +static BOOL alarmActionStopReceived = FALSE; ///< Flag indicates alarm action stop received. +static BOOL alarmActionResumeReceived = FALSE; ///< Flag indicates alarm action resume received. static HD_PRE_TREATMENT_MODE_STATE_T currentPreTreatmentState; ///< Current state of pre-treatment mode state machine. +static HD_PRE_TREATMENT_MODE_STATE_T resumePreTreatmentState; ///< Pre-treatment mode state to be resumed when alarm action resume signal receives. // ********** private function prototypes ********** +static void handleAlarmActionStop( void ); +static void handleAlarmActionResume( void ); + static HD_PRE_TREATMENT_MODE_STATE_T handleSelfTestNoCartState( void ); static HD_PRE_TREATMENT_MODE_STATE_T handleSelfTestDryState( void ); static HD_PRE_TREATMENT_MODE_STATE_T handlePrimeState( void ); +static HD_PRE_TREATMENT_MODE_STATE_T handleRecirculateStartState( void ); +static HD_PRE_TREATMENT_MODE_STATE_T handleRecirculateState( void ); static HD_PRE_TREATMENT_MODE_STATE_T handlePatientConnectionState( void ); +static HD_PRE_TREATMENT_MODE_STATE_T handlePretreatmentPauseState( void ); /*********************************************************************//** * @brief @@ -47,7 +63,12 @@ *************************************************************************/ void initPreTreatmentMode( void ) { + treatStartReqReceived = FALSE; + patientConnectionStartReqReceived = FALSE; + alarmActionStopReceived = FALSE; + alarmActionResumeReceived = FALSE; currentPreTreatmentState = HD_PRE_TREATMENT_START_STATE; + resumePreTreatmentState = HD_PRE_TREATMENT_START_STATE; } /*********************************************************************//** @@ -60,13 +81,17 @@ *************************************************************************/ void transitionToPreTreatmentMode( void ) { - treatStartReqReceived = FALSE; - currentPreTreatmentState = HD_PRE_TREATMENT_START_STATE; + // Set user alarm recovery actions allowed in this mode + setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, TRUE ); + setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); + setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, TRUE ); + + initPreTreatmentMode(); } /*********************************************************************//** * @brief - * The execFaultMode function executes the Pre-Treatment Mode state machine. + * The execPreTreatmentMode function executes the Pre-Treatment Mode state machine. * @details Inputs: none * @details Outputs: none * @return current state (sub-mode) @@ -103,7 +128,7 @@ break; case HD_PRE_TREATMENT_RECIRCULATE_STATE: - currentPreTreatmentState = HD_PRE_TREATMENT_PATIENT_CONNECTION_STATE; + currentPreTreatmentState = handleRecirculateState(); break; case HD_PRE_TREATMENT_PATIENT_CONNECTION_STATE: @@ -131,47 +156,165 @@ { BOOL result = FALSE; - if ( MODE_PRET == getCurrentOperationMode() ) + if ( ( MODE_PRET == getCurrentOperationMode() ) && ( HD_PRE_TREATMENT_PATIENT_CONNECTION_STATE == currentPreTreatmentState ) ) { treatStartReqReceived = TRUE; result = TRUE; } + sendTreatmentStartResponseMsg( result, 0 ); // TODO - provide reason code if rejected return result; } /*********************************************************************//** * @brief - * The handleSelfTestNoCartState function handles self-test with no cartrige. + * The signalAlarmActionToPreTreatmentMode function executes the given alarm action + * as appropriate while in PreTreatment Mode. * @details Inputs: none + * @details Outputs: given alarm action executed + * @param action ID of alarm action to execute + * @return none + *************************************************************************/ +void signalAlarmActionToPreTreatmentMode( ALARM_ACTION_T action ) +{ + switch( action ) + { + case ALARM_ACTION_STOP: + handleAlarmActionStop(); + break; + + case ALARM_ACTION_RESUME: + handleAlarmActionResume(); + break; + + case ALARM_ACTION_END_TREATMENT: + requestNewOperationMode( MODE_POST ); + break; + + case ALARM_ACTION_ACK: + // Nothing to be done here + break; + + default: + // Ignore + break; + } +} + +/*********************************************************************//** + * @brief + * The handleAlarmActionStop function forwards the alarm action to corresponding + * sub-mode and sets appropriate flag to allow corresponding sub-mode handles. + * @details Inputs: currentPreTreatmentState + * @details Outputs: signals corresponding sub-mode of alarm action + * @return none + *************************************************************************/ +static void handleAlarmActionStop( void ) +{ + switch ( currentPreTreatmentState ) + { + case HD_PRE_TREATMENT_PRIME_STATE: + signalAlarmActionToPrimeMode( ALARM_ACTION_STOP ); + break; + + case HD_PRE_TREATMENT_RECIRCULATE_STATE: + // The corresponding sub-mode will handle the signal + alarmActionStopReceived = TRUE; + break; + + case HD_PRE_TREATMENT_START_STATE: + case HD_PRE_TREATMENT_WATER_SAMPLE_STATE: + case HD_PRE_TREATMENT_SELF_TEST_NO_CART_STATE: + case HD_PRE_TREATMENT_SELF_TEST_DRY_STATE: + case HD_PRE_TREATMENT_CART_INSTALL_STATE: + case HD_PRE_TREATMENT_PATIENT_CONNECTION_STATE: + // do nothing + break; + + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_MODE_PRE_TREATMENT_INVALID_STATE, (U32)currentPreTreatmentState ); + break; + } +} + +/*********************************************************************//** + * @brief + * The handleAlarmActionResume function forwards the alarm action to corresponding + * sub-mode and sets appropriate flag to allow corresponding sub-mode handles. + * @details Inputs: currentPreTreatmentState + * @details Outputs: signals corresponding sub-mode of alarm action + * @return none + *************************************************************************/ +static void handleAlarmActionResume( void ) +{ + switch ( currentPreTreatmentState ) + { + case HD_PRE_TREATMENT_PRIME_STATE: + signalAlarmActionToPrimeMode( ALARM_ACTION_RESUME ); + break; + + case HD_PRE_TREATMENT_RECIRCULATE_STATE: + case HD_PRE_TREATMENT_SELF_TEST_NO_CART_STATE: + case HD_PRE_TREATMENT_SELF_TEST_DRY_STATE: + case HD_PRE_TREATMENT_START_STATE: + case HD_PRE_TREATMENT_WATER_SAMPLE_STATE: + case HD_PRE_TREATMENT_CART_INSTALL_STATE: + case HD_PRE_TREATMENT_PATIENT_CONNECTION_STATE: + // do nothing + break; + + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_MODE_PRE_TREATMENT_INVALID_STATE, (U32)currentPreTreatmentState ); + break; + } +} + +/*********************************************************************//** + * @brief + * The handleSelfTestNoCartState function handles self-test with no cartridge. + * @details Inputs: none * @details Outputs: home blood pump and dialysate pumps * @return current state (sub-mode) *************************************************************************/ static HD_PRE_TREATMENT_MODE_STATE_T handleSelfTestNoCartState( void ) { // TODO: Prompt user to close door + VALVE_T valve; + + for ( valve = VDI; valve < NUM_OF_VALVES; ++valve ) + { + homeValve( valve ); + } + homeBloodPump(); homeDialInPump(); homeDialOutPump(); // TODO: Prompt user to open door - return HD_PRE_TREATMENT_CART_INSTALL_STATE; + return HD_PRE_TREATMENT_CART_INSTALL_STATE; } /*********************************************************************//** * @brief - * The handleSelfTestDryState function handles dry self-tests after cartridge - * is loaded. + * The handleSelfTestDryState function performs dry self-test. * @details Inputs: none * @details Outputs: transition to prime state on user request * @return current state (sub-mode) *************************************************************************/ static HD_PRE_TREATMENT_MODE_STATE_T handleSelfTestDryState( void ) { - return HD_PRE_TREATMENT_PRIME_STATE; + HD_PRE_TREATMENT_MODE_STATE_T state = HD_PRE_TREATMENT_CART_INSTALL_STATE; + + if ( FALSE == isBloodPumpRunning() ) + { + transitionToPrime(); + state = HD_PRE_TREATMENT_PRIME_STATE; + } + + return state; } /*********************************************************************//** @@ -181,36 +324,85 @@ * @details Outputs: transition to self test wet state after priming passed * @return current state (sub-mode) *************************************************************************/ -static HD_PRE_TREATMENT_MODE_STATE_T handlePrimeState( void ) +static HD_PRE_TREATMENT_MODE_STATE_T handlePrimeState( void ) { - HD_PRE_TREATMENT_MODE_STATE_T state = HD_PRE_TREATMENT_PRIME_STATE; + HD_PRE_TREATMENT_MODE_STATE_T state = HD_PRE_TREATMENT_PRIME_STATE; execPrime(); - if ( TRUE == isPrimingPassed() ) + if ( TRUE == isWetSelfTestsPassed() ) { state = HD_PRE_TREATMENT_RECIRCULATE_STATE; + activateAlarmNoData( ALARM_ID_PRIME_COMPLETED_LOW_PRIORITY ); } return state; } /*********************************************************************//** * @brief + * The handleRecirculateStartState function change valves and heater settings + * for recirculation state during pre-treatment mode. + * @details Inputs: none + * @details Outputs: controlled valves and pumps + * @return current state (sub-mode) + *************************************************************************/ +static HD_PRE_TREATMENT_MODE_STATE_T handleRecirculateStartState( void ) +{ + setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); + setValvePosition( VBA, VALVE_POSITION_B_OPEN ); + setValvePosition( VBV, VALVE_POSITION_B_OPEN ); + setValveAirTrap( STATE_CLOSED ); + cmdSetDGActiveReservoir( DG_RESERVOIR_1 ); + cmdStartDGTrimmerHeater(); + + setBloodPumpTargetFlowRate( BLOOD_PUMP_RECIRC_FLOW_RATE, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + setDialInPumpTargetFlowRate( DIALYSATE_PUMP_RECIRC_FLOW_RATE, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); + signalDialOutPumpHardStop(); + + return HD_PRE_TREATMENT_RECIRCULATE_STATE; +} + +/*********************************************************************//** + * @brief + * The handleRecirculateState function handles blood and dialysate circuits + * recirculation state during pre-treatment mode. + * @details Inputs: none + * @details Outputs: controlled valves and pumps + * @return current state (sub-mode) + *************************************************************************/ +static HD_PRE_TREATMENT_MODE_STATE_T handleRecirculateState( void ) +{ + HD_PRE_TREATMENT_MODE_STATE_T state = HD_PRE_TREATMENT_RECIRCULATE_STATE; + + // TODO Add handler to UI interaction + patientConnectionStartReqReceived = TRUE; + + if ( TRUE == patientConnectionStartReqReceived ) + { + state = HD_PRE_TREATMENT_PATIENT_CONNECTION_STATE; + } + + return state; +} + +/*********************************************************************//** + * @brief * The handlePatientConnectionState function handles patient connection state * during pre-treatment mode. * @details Inputs: none * @details Outputs: requested mode transition to treatment mode * @return current state (sub-mode) *************************************************************************/ -static HD_PRE_TREATMENT_MODE_STATE_T handlePatientConnectionState( void ) +static HD_PRE_TREATMENT_MODE_STATE_T handlePatientConnectionState( void ) { if ( TRUE == treatStartReqReceived ) { requestNewOperationMode( MODE_TREA ); } - return HD_PRE_TREATMENT_PATIENT_CONNECTION_STATE; + return HD_PRE_TREATMENT_PATIENT_CONNECTION_STATE; } /**@}*/ Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -r9f5e68247ff2f5214e8828a1b8152ea16941fe39 -rc282822f36836a8127f447c8ac5b8a50e851be63 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 9f5e68247ff2f5214e8828a1b8152ea16941fe39) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -156,28 +156,6 @@ /*********************************************************************//** * @brief - * The userRequestEndTreatment function conveys a user request to end the - * treatment. - * @details Inputs: currentTreatmentState - * @details Outputs: response to user request sent - * @return TRUE if request accepted, FALSE if not - *************************************************************************/ -BOOL userRequestEndTreatment( void ) -{ - BOOL result = FALSE; - - if ( TREATMENT_STOP_STATE == currentTreatmentState ) - { - pendingUserEndTreatmentRequest = TRUE; - result = TRUE; - } - sendTreatmentEndResponseMsg( result ); - - return result; -} - -/*********************************************************************//** - * @brief * The signalAlarmActionToTreatmentMode function executes the given alarm action * as appropriate while in Treatment Mode. * @details Inputs: none @@ -287,10 +265,6 @@ // TODO - implement break; - case TREATMENT_DIALYSIS_END_STATE: - // TODO - implement - break; - case TREATMENT_END_STATE: // TODO - implement endAirTrapControl(); // TODO - move to appropriate place @@ -454,7 +428,7 @@ // Check if we are in an appropriate treatment state for settings adjustment if ( ( MODE_TREA == currMode ) && - ( currentTreatmentState > TREATMENT_START_STATE ) && ( currentTreatmentState < TREATMENT_DIALYSIS_END_STATE ) && + ( currentTreatmentState > TREATMENT_START_STATE ) && ( currentTreatmentState < TREATMENT_END_STATE ) && ( CALC_ELAPSED_TREAT_TIME_IN_MIN() < treatmentTime ) && ( treatmentTime >= MIN_TREATMENT_TIME_MINUTES ) ) { F32 uFVolume; @@ -494,7 +468,7 @@ rejectReason = REQUEST_REJECT_REASON_NOT_IN_TREATMENT_MODE; } else if ( ( currentTreatmentState <= TREATMENT_START_STATE ) || - ( currentTreatmentState >= TREATMENT_DIALYSIS_END_STATE ) ) + ( currentTreatmentState >= TREATMENT_END_STATE ) ) { rejectReason = REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE; } @@ -541,7 +515,7 @@ // Check if we are in an appropriate treatment state for settings adjustment if ( ( MODE_TREA == currMode ) && - ( currentTreatmentState > TREATMENT_START_STATE ) && ( currentTreatmentState < TREATMENT_DIALYSIS_END_STATE ) && + ( currentTreatmentState > TREATMENT_START_STATE ) && ( currentTreatmentState < TREATMENT_END_STATE ) && ( uFVolume <= MAX_UF_VOLUME_ML ) && ( CALC_TREAT_TIME_REMAINING_IN_SECS() >= PREVENT_UF_VOL_CHANGE_IF_NEARLY_DONE_SEC ) ) { @@ -600,7 +574,7 @@ rejectReason = REQUEST_REJECT_REASON_TREATMENT_TIME_OUT_OF_RANGE; } else if ( ( currentTreatmentState <= TREATMENT_START_STATE ) || - ( currentTreatmentState >= TREATMENT_DIALYSIS_END_STATE ) ) + ( currentTreatmentState >= TREATMENT_END_STATE ) ) { rejectReason = REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE; } @@ -849,7 +823,7 @@ { stopDialysis(); elapsedTreatmentTimeInSecs = presTreatmentTimeSecs; - currentTreatmentState = TREATMENT_DIALYSIS_END_STATE; + currentTreatmentState = TREATMENT_END_STATE; } // Broadcast treatment time and state data at interval if ( ++treatmentTimeBroadcastTimerCtr >= TREATMENT_TIME_DATA_PUB_INTERVAL ) Index: firmware/App/Modes/ModeTreatment.h =================================================================== diff -u -ra2bc96881a5fc3d8f779246b2abebf15a8de9384 -rc282822f36836a8127f447c8ac5b8a50e851be63 --- firmware/App/Modes/ModeTreatment.h (.../ModeTreatment.h) (revision a2bc96881a5fc3d8f779246b2abebf15a8de9384) +++ firmware/App/Modes/ModeTreatment.h (.../ModeTreatment.h) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -85,7 +85,6 @@ TREATMENT_STATE_T getTreatmentState( void ); // Determine the current treatment sub-mode (state) -BOOL userRequestEndTreatment( void ); // User has requested to end the treatment void broadcastTreatmentTimeAndState( void ); // Broadcast the times and states of this treatment BOOL verifyTreatmentDurationSettingChange( U32 treatmentTime ); Index: firmware/App/Services/PIControllers.c =================================================================== diff -u -r766708fceb0bdf1af8c7897df29d4f5036bfd3db -rc282822f36836a8127f447c8ac5b8a50e851be63 --- firmware/App/Services/PIControllers.c (.../PIControllers.c) (revision 766708fceb0bdf1af8c7897df29d4f5036bfd3db) +++ firmware/App/Services/PIControllers.c (.../PIControllers.c) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -64,7 +64,7 @@ /// PI Controllers -- initial configurations. static PI_CONTROLLER_T piControllers[ NUM_OF_PI_CONTROLLERS_IDS ] = { // Kp Ki uMax uMin ref meas err esw esum ctrl Ilimit controller type - { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.0, CONTROLLER_UNIDIRECTIONAL }, // PI_CONTROLLER_ID_ULTRAFILTRATION + { 0.0, 0.0, 0.90, 0.10, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 50.0, CONTROLLER_UNIDIRECTIONAL }, // PI_CONTROLLER_ID_ULTRAFILTRATION { 0.0, 0.0, 0.90, 0.10, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 100.0, CONTROLLER_UNIDIRECTIONAL }, // PI_CONTROLLER_ID_BLOOD_FLOW { 0.0, 0.0, 0.90, 0.10, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 100.0, CONTROLLER_UNIDIRECTIONAL } // PI_CONTROLLER_ID_DIALYSATE_FLOW }; @@ -195,18 +195,22 @@ controller->errorSum += controller->errorSignal; } - // Calculate control signal + // Calculate control signal from i term controller->errorSumBeforeWindUp = controller->errorSum; - controlSignalBeforeWindup = ( controller->Kp * controller->errorSignal ) + ( controller->Ki * controller->errorSum ); + controlSignalBeforeWindup = ( controller->Ki * controller->errorSum ); controller->controlSignal = RANGE( controlSignalBeforeWindup, controller->uMin, controller->uMax ); // Handle anti-windup for i term windupError = controlSignalBeforeWindup - controller->controlSignal; if ( fabs( windupError ) > NEARLY_ZERO ) { controller->errorSum -= ( windupError / controller->Ki ); - } - + } + + // Add p term adjustment to control signal and re-apply range limits + controller->controlSignal += ( controller->Kp * controller->errorSignal ); + controller->controlSignal = RANGE( controller->controlSignal, controller->uMin, controller->uMax ); + result = controller->controlSignal; } else Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r98f34c2ab63d51a1bf248db454ebc04e184d4748 -rc282822f36836a8127f447c8ac5b8a50e851be63 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 98f34c2ab63d51a1bf248db454ebc04e184d4748) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -1187,10 +1187,6 @@ handleUIUserConfirmTreatmentParameters( message ); break; - case MSG_ID_UI_TREATMENT_END_REQUEST: - handleUIUserEndTreatmentRequest( message ); - break; - case MSG_ID_UI_PRESSURE_LIMITS_CHANGE_REQUEST: handleChangePressureLimitsRequest( message ); break; @@ -1373,18 +1369,6 @@ handleTestHDAccelBroadcastIntervalOverrideRequest( message ); break; - case MSG_ID_HD_ACCEL_SET_CALIBRATION: - handleSetAccelCalibration( message ); - break; - - case MSG_ID_HD_BLOOD_FLOW_SET_CALIBRATION: - handleSetBloodFlowCalibration( message ); - break; - - case MSG_ID_HD_DIALYSATE_FLOW_SET_CALIBRATION: - handleSetDialysateFlowCalibration( message ); - break; - case MSG_ID_DIAL_OUT_FLOW_SET_PT_OVERRIDE: handleTestDialOutFlowSetPointOverrideRequest( message ); break; @@ -1451,14 +1435,6 @@ handleTestSuperClearAlarmsRequest( message ); break; - case MSG_ID_HD_REQUEST_CALIBRATION_DATA: - handleTestHDCalibrationDataRequest( message ); - break; - - case MSG_ID_HD_ERASE_CALIBRATION_DATA: - handleTestEraseHDCalibrationDataRequest( message ); - break; - default: // TODO - unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r1a5aa1dff6978966ecda860b09c07a84e80399fe -rc282822f36836a8127f447c8ac5b8a50e851be63 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1a5aa1dff6978966ecda860b09c07a84e80399fe) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -1734,56 +1734,6 @@ /*********************************************************************//** * @brief - * The handleUIUserEndTreatmentRequest function handles a treatment end - * request message from the UI. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleUIUserEndTreatmentRequest( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - if ( message->hdr.payloadLen == 0 ) - { - result = userRequestEndTreatment(); - } - - sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); -} - -/*********************************************************************//** - * @brief - * The sendTreatmentEndResponseMsg function constructs a treatment end - * request response message to the UI and queues the msg for transmit on - * the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: Treatment end response msg constructed and queued. - * @param accepted T/F - request accepted? - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL sendTreatmentEndResponseMsg( BOOL accepted ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_TREATMENT_END_RESPONSE; - msg.hdr.payloadLen = sizeof( BOOL ); - - memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); - - // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief * The handleTreatmentParametersFromUI function handles a treatment parameters * set and validate request message from the UI. * @details Inputs: none @@ -4053,71 +4003,4 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/*********************************************************************//** - * @brief - * The handleTestHDCalibrationDataRequest function handles a request for - * HD calibration data. - * @details - * Inputs : none - * Outputs : message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleTestHDCalibrationDataRequest( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - if ( 0 == message->hdr.payloadLen ) - { - CALIBRATION_DATA_T cal; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // Get calibration data - result = getCalibrationData( &cal ); - if ( TRUE == result ) - { - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_CALIBRATION_DATA; - msg.hdr.payloadLen = sizeof( CALIBRATION_DATA_T ); - - memcpy( payloadPtr, &cal, sizeof( CALIBRATION_DATA_T ) ); - - // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); - } - } - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** - * @brief - * The handleTestEraseHDCalibrationDataRequest function handles a request for - * HD calibration data erasure. - * @details - * Inputs : none - * Outputs : message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleTestEraseHDCalibrationDataRequest( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - if ( message->hdr.payloadLen == sizeof(U32) ) - { - U32 key; - - memcpy( &key, message->payload, sizeof(U32) ); - - result = testResetCalibrationData( key ); - } - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r1a5aa1dff6978966ecda860b09c07a84e80399fe -rc282822f36836a8127f447c8ac5b8a50e851be63 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 1a5aa1dff6978966ecda860b09c07a84e80399fe) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -97,12 +97,6 @@ // MSG_ID_HD_START_TREATMENT_RESPONSE BOOL sendTreatmentStartResponseMsg( BOOL accepted, U32 reason ); -// MSG_ID_UI_TREATMENT_END_REQUEST -void handleUIUserEndTreatmentRequest( MESSAGE_T *message ); - -// MSG_ID_HD_TREATMENT_END_RESPONSE -BOOL sendTreatmentEndResponseMsg( BOOL accepted ); - // MSG_ID_UI_NEW_TREATMENT_PARAMS void handleTreatmentParametersFromUI( MESSAGE_T *message ); @@ -199,6 +193,9 @@ // MSG_ID_ALARM_TRIGGERED BOOL broadcastAlarmTriggered( U32 alarm, ALARM_DATA_T almData1, ALARM_DATA_T almData2 ); +// MSG_ID_ALARM_CONDITION_CLEARED +BOOL broadcastAlarmConditionCleared( U32 alarm ); + // MSG_ID_ALARM_CLEARED BOOL broadcastAlarmCleared( U32 alarm ); Index: results/Build_Status_Report.csv =================================================================== diff -u -raf02c3139b58ff98e2beb38704955d748e30ea35 -rc282822f36836a8127f447c8ac5b8a50e851be63 --- results/Build_Status_Report.csv (.../Build_Status_Report.csv) (revision af02c3139b58ff98e2beb38704955d748e30ea35) +++ results/Build_Status_Report.csv (.../Build_Status_Report.csv) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -1,5 +1,16 @@ Running Project, hdfirmware +<<<<<<< HEAD +Date, Thu Feb 18 13:15:32 PST 2021 + +VectorCAST Pass/Fail Status, Passed + +Unit Test Coverage, Passed + + +Integration Test Coverage, Passed + +======= Date, Mon Jan 4 13:01:58 PST 2021 VectorCAST Pass/Fail Status, Failed @@ -170,6 +181,7 @@ bloodflow,execBloodFlowTest bloodflow,getBloodFlowCalibration rtc,getRTCTimestamp +>>>>>>> staging List of Untested Modules InternalADC, Missing Unit Test and Integration Test @@ -182,6 +194,7 @@ TaskPriority, Missing Unit Test and Integration Test ModeInitPOST, Missing Unit Test and Integration Test TreatmentStop, Missing Unit Test and Integration Test +Prime, Missing Unit Test and Integration Test ModeStandby, Missing Unit Test and Integration Test ModeService, Missing Unit Test and Integration Test ModePreTreat, Missing Unit Test and Integration Test Index: results/cppcheck.log =================================================================== diff -u -raf02c3139b58ff98e2beb38704955d748e30ea35 -rc282822f36836a8127f447c8ac5b8a50e851be63 --- results/cppcheck.log (.../cppcheck.log) (revision af02c3139b58ff98e2beb38704955d748e30ea35) +++ results/cppcheck.log (.../cppcheck.log) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -1,117 +1,162 @@ Checking hdfirmware/firmware/App/Controllers/AirTrap.c ... -1/46 files checked 2% done +1/47 files checked 2% done Checking hdfirmware/firmware/App/Controllers/AlarmLamp.c ... -2/46 files checked 4% done +2/47 files checked 4% done Checking hdfirmware/firmware/App/Controllers/BloodFlow.c ... Checking hdfirmware/firmware/App/Controllers/BloodFlow.c: RAW_FLOW_SENSOR_DATA... -3/46 files checked 6% done +3/47 files checked 6% done Checking hdfirmware/firmware/App/Controllers/Buttons.c ... Checking hdfirmware/firmware/App/Controllers/Buttons.c: SIMULATE_UI... -4/46 files checked 8% done +4/47 files checked 8% done Checking hdfirmware/firmware/App/Controllers/DGInterface.c ... Checking hdfirmware/firmware/App/Controllers/DGInterface.c: V1_5_SYSTEM... -5/46 files checked 10% done +5/47 files checked 10% done Checking hdfirmware/firmware/App/Controllers/DialInFlow.c ... Checking hdfirmware/firmware/App/Controllers/DialInFlow.c: RAW_FLOW_SENSOR_DATA... -6/46 files checked 12% done +6/47 files checked 12% done Checking hdfirmware/firmware/App/Controllers/DialOutFlow.c ... +<<<<<<< HEAD +Checking hdfirmware/firmware/App/Controllers/DialOutFlow.c: BREADBOARD_TARGET... +7/47 files checked 14% done +======= 7/46 files checked 14% done +>>>>>>> staging Checking hdfirmware/firmware/App/Controllers/PresOccl.c ... -8/46 files checked 17% done +8/47 files checked 16% done Checking hdfirmware/firmware/App/Controllers/Valves.c ... Checking hdfirmware/firmware/App/Controllers/Valves.c: DEBUG_ENABLED... Checking hdfirmware/firmware/App/Controllers/Valves.c: TST_3WAY_VALVES_ALWAYS_OPEN... -9/46 files checked 19% done +9/47 files checked 18% done Checking hdfirmware/firmware/App/Drivers/CPLD.c ... +<<<<<<< HEAD +Checking hdfirmware/firmware/App/Drivers/CPLD.c: RM46_EVAL_BOARD_TARGET... +10/47 files checked 20% done +======= 10/46 files checked 21% done +>>>>>>> staging Checking hdfirmware/firmware/App/Drivers/Comm.c ... Checking hdfirmware/firmware/App/Drivers/Comm.c: DEBUG_ENABLED... -11/46 files checked 23% done +11/47 files checked 23% done Checking hdfirmware/firmware/App/Drivers/InternalADC.c ... +<<<<<<< HEAD +Checking hdfirmware/firmware/App/Drivers/InternalADC.c: RM46_EVAL_BOARD_TARGET... +12/47 files checked 25% done +======= 12/46 files checked 25% done +>>>>>>> staging Checking hdfirmware/firmware/App/Drivers/SafetyShutdown.c ... -13/46 files checked 27% done +13/47 files checked 27% done Checking hdfirmware/firmware/App/Modes/Dialysis.c ... Checking hdfirmware/firmware/App/Modes/Dialysis.c: RUN_PUMPS_OPEN_LOOP... -14/46 files checked 29% done +14/47 files checked 29% done Checking hdfirmware/firmware/App/Modes/ModeFault.c ... Checking hdfirmware/firmware/App/Modes/ModeFault.c: EMC_TEST_BUILD... -15/46 files checked 32% done +15/47 files checked 31% done Checking hdfirmware/firmware/App/Modes/ModeInitPOST.c ... Checking hdfirmware/firmware/App/Modes/ModeInitPOST.c: DISABLE_ACCELS... Checking hdfirmware/firmware/App/Modes/ModeInitPOST.c: SKIP_POST... -16/46 files checked 34% done +16/47 files checked 33% done Checking hdfirmware/firmware/App/Modes/ModePostTreat.c ... +<<<<<<< HEAD +Checking hdfirmware/firmware/App/Modes/ModePostTreat.c: DISABLE_UI_TREATMENT_WORKFLOW... +Checking hdfirmware/firmware/App/Modes/ModePostTreat.c: RM46_EVAL_BOARD_TARGET... +17/47 files checked 35% done +Checking hdfirmware/firmware/App/Modes/ModePreTreat.c ... +18/47 files checked 37% done +======= 17/46 files checked 36% done Checking hdfirmware/firmware/App/Modes/ModePreTreat.c ... 18/46 files checked 38% done +>>>>>>> staging Checking hdfirmware/firmware/App/Modes/ModeService.c ... -19/46 files checked 40% done +19/47 files checked 39% done Checking hdfirmware/firmware/App/Modes/ModeStandby.c ... Checking hdfirmware/firmware/App/Modes/ModeStandby.c: EMC_TEST_BUILD... Checking hdfirmware/firmware/App/Modes/ModeStandby.c: EMC_TEST_BUILD;RUN_WITHOUT_DG... Checking hdfirmware/firmware/App/Modes/ModeStandby.c: RUN_WITHOUT_DG... -20/46 files checked 42% done +20/47 files checked 41% done Checking hdfirmware/firmware/App/Modes/ModeTreatment.c ... +<<<<<<< HEAD +Checking hdfirmware/firmware/App/Modes/ModeTreatment.c: DISABLE_UI_TREATMENT_WORKFLOW... +Checking hdfirmware/firmware/App/Modes/ModeTreatment.c: RM46_EVAL_BOARD_TARGET... +21/47 files checked 43% done +Checking hdfirmware/firmware/App/Modes/ModeTreatmentParams.c ... +Checking hdfirmware/firmware/App/Modes/ModeTreatmentParams.c: DISABLE_UI_TREATMENT_WORKFLOW... +Checking hdfirmware/firmware/App/Modes/ModeTreatmentParams.c: RM46_EVAL_BOARD_TARGET... +22/47 files checked 46% done +======= 21/46 files checked 44% done Checking hdfirmware/firmware/App/Modes/ModeTreatmentParams.c ... 22/46 files checked 47% done +>>>>>>> staging Checking hdfirmware/firmware/App/Modes/OperationModes.c ... -23/46 files checked 49% done +23/47 files checked 48% done +Checking hdfirmware/firmware/App/Modes/Prime.c ... +24/47 files checked 50% done Checking hdfirmware/firmware/App/Modes/TreatmentStop.c ... -24/46 files checked 51% done +25/47 files checked 52% done Checking hdfirmware/firmware/App/Services/AlarmMgmt.c ... Checking hdfirmware/firmware/App/Services/AlarmMgmt.c: ALARMS_DEBUG;DEBUG_ENABLED... Checking hdfirmware/firmware/App/Services/AlarmMgmt.c: DEBUG_ENABLED... Checking hdfirmware/firmware/App/Services/AlarmMgmt.c: EMC_TEST_BUILD... -25/46 files checked 53% done +26/47 files checked 54% done Checking hdfirmware/firmware/App/Services/CommBuffers.c ... Checking hdfirmware/firmware/App/Services/CommBuffers.c: DEBUG_ENABLED... Checking hdfirmware/firmware/App/Services/CommBuffers.c: EMC_TEST_BUILD... -26/46 files checked 55% done +27/47 files checked 56% done Checking hdfirmware/firmware/App/Services/FPGA.c ... Checking hdfirmware/firmware/App/Services/FPGA.c: DEBUG_ENABLED... Checking hdfirmware/firmware/App/Services/FPGA.c: EMC_TEST_BUILD... Checking hdfirmware/firmware/App/Services/FPGA.c: READ_FPGA_ASYNC_DATA... +<<<<<<< HEAD +Checking hdfirmware/firmware/App/Services/FPGA.c: RM46_EVAL_BOARD_TARGET... +28/47 files checked 58% done +======= 27/46 files checked 57% done +>>>>>>> staging Checking hdfirmware/firmware/App/Services/Interrupts.c ... Checking hdfirmware/firmware/App/Services/Interrupts.c: DEBUG_ENABLED... Checking hdfirmware/firmware/App/Services/Interrupts.c: EMC_TEST_BUILD... -28/46 files checked 59% done +29/47 files checked 60% done Checking hdfirmware/firmware/App/Services/MsgQueues.c ... -29/46 files checked 62% done +30/47 files checked 62% done Checking hdfirmware/firmware/App/Services/PIControllers.c ... Checking hdfirmware/firmware/App/Services/PIControllers.c: DEBUG_ENABLED... Checking hdfirmware/firmware/App/Services/PIControllers.c: EMC_TEST_BUILD... -30/46 files checked 64% done +31/47 files checked 64% done Checking hdfirmware/firmware/App/Services/SystemComm.c ... Checking hdfirmware/firmware/App/Services/SystemComm.c: DEBUG_ENABLED... Checking hdfirmware/firmware/App/Services/SystemComm.c: EMC_TEST_BUILD... +<<<<<<< HEAD +Checking hdfirmware/firmware/App/Services/SystemComm.c: RM46_EVAL_BOARD_TARGET... +32/47 files checked 66% done +======= 31/46 files checked 66% done +>>>>>>> staging Checking hdfirmware/firmware/App/Services/SystemCommMessages.c ... Checking hdfirmware/firmware/App/Services/SystemCommMessages.c: DEBUG_ENABLED... Checking hdfirmware/firmware/App/Services/SystemCommMessages.c: EMC_TEST_BUILD... -32/46 files checked 68% done +33/47 files checked 69% done Checking hdfirmware/firmware/App/Services/WatchdogMgmt.c ... Checking hdfirmware/firmware/App/Services/WatchdogMgmt.c: DEBUG_ENABLED... Checking hdfirmware/firmware/App/Services/WatchdogMgmt.c: EMC_TEST_BUILD... -33/46 files checked 70% done +34/47 files checked 71% done Checking hdfirmware/firmware/App/Tasks/TaskBG.c ... -34/46 files checked 72% done +35/47 files checked 73% done Checking hdfirmware/firmware/App/Tasks/TaskGeneral.c ... Checking hdfirmware/firmware/App/Tasks/TaskGeneral.c: TASK_TIMING_OUTPUT_ENABLED... -35/46 files checked 74% done +36/47 files checked 75% done Checking hdfirmware/firmware/App/Tasks/TaskPriority.c ... Checking hdfirmware/firmware/App/Tasks/TaskPriority.c: TASK_TIMING_OUTPUT_ENABLED... -36/46 files checked 76% done +37/47 files checked 77% done Checking hdfirmware/firmware/App/Tasks/TaskTimer.c ... Checking hdfirmware/firmware/App/Tasks/TaskTimer.c: TASK_TIMING_OUTPUT_ENABLED... -37/46 files checked 79% done +38/47 files checked 79% done Checking hdfirmware/firmware/FWCommon/Accel.c ... Checking hdfirmware/firmware/FWCommon/Accel.c: _DG_... Checking hdfirmware/firmware/FWCommon/Accel.c: _HD_... Checking hdfirmware/firmware/FWCommon/Accel.c: _VECTORCAST_... -38/46 files checked 81% done +39/47 files checked 81% done Checking hdfirmware/firmware/FWCommon/FlashDrvr/Fapi_UserDefinedFunctions.c ... Checking hdfirmware/firmware/FWCommon/FlashDrvr/Fapi_UserDefinedFunctions.c: CPU_BYTE_ORDER... Checking hdfirmware/firmware/FWCommon/FlashDrvr/Fapi_UserDefinedFunctions.c: F021... @@ -124,33 +169,33 @@ Checking hdfirmware/firmware/FWCommon/FlashDrvr/Fapi_UserDefinedFunctions.c: _LITTLE_ENDIAN;__little_endian__... Checking hdfirmware/firmware/FWCommon/FlashDrvr/Fapi_UserDefinedFunctions.c: __ARMCC_VERSION... Checking hdfirmware/firmware/FWCommon/FlashDrvr/Fapi_UserDefinedFunctions.c: __GNUC__... -39/46 files checked 83% done +40/47 files checked 83% done Checking hdfirmware/firmware/FWCommon/NVDataMgmt.c ... Checking hdfirmware/firmware/FWCommon/NVDataMgmt.c: _DG_... Checking hdfirmware/firmware/FWCommon/NVDataMgmt.c: _HD_... Checking hdfirmware/firmware/FWCommon/NVDataMgmt.c: _VECTORCAST_... -40/46 files checked 85% done +41/47 files checked 85% done Checking hdfirmware/firmware/FWCommon/PersistentAlarm.c ... Checking hdfirmware/firmware/FWCommon/PersistentAlarm.c: _DG_... Checking hdfirmware/firmware/FWCommon/PersistentAlarm.c: _HD_... Checking hdfirmware/firmware/FWCommon/PersistentAlarm.c: _VECTORCAST_... -41/46 files checked 87% done +42/47 files checked 87% done Checking hdfirmware/firmware/FWCommon/RTC.c ... Checking hdfirmware/firmware/FWCommon/RTC.c: _DG_... Checking hdfirmware/firmware/FWCommon/RTC.c: _VECTORCAST_... -42/46 files checked 89% done +43/47 files checked 90% done Checking hdfirmware/firmware/FWCommon/Timers.c ... Checking hdfirmware/firmware/FWCommon/Timers.c: _VECTORCAST_... -43/46 files checked 91% done +44/47 files checked 92% done Checking hdfirmware/firmware/FWCommon/Utilities.c ... Checking hdfirmware/firmware/FWCommon/Utilities.c: _DG_... Checking hdfirmware/firmware/FWCommon/Utilities.c: _HD_... Checking hdfirmware/firmware/FWCommon/Utilities.c: _VECTORCAST_... -44/46 files checked 94% done +45/47 files checked 94% done Checking hdfirmware/firmware/FWCommon/irqDispatch_c.c ... Checking hdfirmware/firmware/FWCommon/irqDispatch_c.c: __TI_VIM_128CH__... Checking hdfirmware/firmware/FWCommon/irqDispatch_c.c: __TI_VIM_96CH__... Checking hdfirmware/firmware/FWCommon/irqDispatch_c.c: __TI_VIM_96CH__;__TI_VIM_96CH__;__TI_VIM_96CH__;__TI_VIM_96CH__;__TI_VIM_96CH__... -45/46 files checked 96% done +46/47 files checked 96% done Checking hdfirmware/firmware/source/sys_main.c ... -46/46 files checked 100% done +47/47 files checked 100% done Index: results/cppcheckError.csv =================================================================== diff -u -r766708fceb0bdf1af8c7897df29d4f5036bfd3db -rc282822f36836a8127f447c8ac5b8a50e851be63 --- results/cppcheckError.csv (.../cppcheckError.csv) (revision 766708fceb0bdf1af8c7897df29d4f5036bfd3db) +++ results/cppcheckError.csv (.../cppcheckError.csv) (revision c282822f36836a8127f447c8ac5b8a50e851be63) @@ -1,4 +1,12 @@ File, Line No., Severity, Issue, Description +<<<<<<< HEAD +hdfirmware/firmware/App/Controllers/DGInterface.c,658,style,unreadVariable,Variable 'activeRes' is assigned a value that is never used. +hdfirmware/firmware/App/Controllers/DGInterface.c,659,style,unreadVariable,Variable 'inTreatment' is assigned a value that is never used. +hdfirmware/firmware/App/Modes/ModePostTreat.c,74,style,unreadVariable,Variable 'stop' is assigned a value that is never used. +hdfirmware/firmware/App/Modes/ModeTreatment.c,784,style,unreadVariable,Variable 'dialysisState' is assigned a value that is never used. +hdfirmware/firmware/App/Services/Interrupts.c,175,style,variableScope,The scope of the variable 'debugStr' can be reduced. +hdfirmware/firmware/App/Services/SystemCommMessages.c,3825,style,redundantAssignment,Variable 'result' is reassigned a value before the old one has been used. +======= hdfirmware/firmware/App/Modes/ModeFault.c,72,style,unreadVariable,Variable 'stop' is assigned a value that is never used. hdfirmware/firmware/App/Modes/ModePostTreat.c,71,style,unreadVariable,Variable 'stop' is assigned a value that is never used. hdfirmware/firmware/App/Modes/ModePreTreat.c,78,style,unreadVariable,Variable 'stop' is assigned a value that is never used. @@ -7,6 +15,7 @@ hdfirmware/firmware/App/Services/Interrupts.c,175,style,variableScope,The scope of the variable 'debugStr' can be reduced. hdfirmware/firmware/App/Services/SystemCommMessages.c,4000,style,redundantAssignment,Variable 'result' is reassigned a value before the old one has been used. hdfirmware/firmware/App/Services/SystemCommMessages.c,1412,style,unreadVariable,Variable 'result' is assigned a value that is never used. +>>>>>>> staging hdfirmware/firmware/FWCommon/FlashDrvr/Fapi_UserDefinedFunctions.c,0,information,toomanyconfigs,Too many #ifdef configurations - cppcheck only checks 12 of 21 configurations. Use --force to check all configurations. hdfirmware/firmware/FWCommon/NVDataMgmt.c,1566,style,variableScope,The scope of the variable 'quotient' can be reduced. hdfirmware/firmware/FWCommon/NVDataMgmt.c,1567,style,variableScope,The scope of the variable 'modulus' can be reduced. @@ -21,8 +30,14 @@ hdfirmware/firmware/App/Drivers/InternalADC.c,115,style,unusedFunction,The function 'adcNotification' is never used. hdfirmware/firmware/App/Services/Interrupts.c,172,style,unusedFunction,The function 'canErrorNotification' is never used. hdfirmware/firmware/App/Services/Interrupts.c,152,style,unusedFunction,The function 'canMessageNotification' is never used. +<<<<<<< HEAD +hdfirmware/firmware/App/Services/AlarmMgmt.c,301,style,unusedFunction,The function 'clearAlarmCondition' is never used. +hdfirmware/firmware/App/Controllers/DGInterface.c,818,style,unusedFunction,The function 'cmdDGSampleWater' is never used. +hdfirmware/firmware/App/Controllers/DGInterface.c,722,style,unusedFunction,The function 'cmdStopDG' is never used. +======= hdfirmware/firmware/App/Controllers/DGInterface.c,668,style,unusedFunction,The function 'cmdDGSampleWater' is never used. hdfirmware/firmware/App/Controllers/DGInterface.c,572,style,unusedFunction,The function 'cmdStopDG' is never used. +>>>>>>> staging hdfirmware/firmware/App/Services/Interrupts.c,315,style,unusedFunction,The function 'dmaGroupANotification' is never used. hdfirmware/firmware/App/Services/Interrupts.c,361,style,unusedFunction,The function 'edgeNotification' is never used. hdfirmware/firmware/App/Controllers/AirTrap.c,207,style,unusedFunction,The function 'execAirTrapMonitorPriming' is never used. @@ -33,6 +48,19 @@ hdfirmware/firmware/App/Controllers/BloodFlow.c,1340,style,unusedFunction,The function 'getBloodFlowCalibration' is never used. hdfirmware/firmware/App/Controllers/BloodFlow.c,400,style,unusedFunction,The function 'getBloodPumpRotorCount' is never used. hdfirmware/firmware/FWCommon/NVDataMgmt.c,764,style,unusedFunction,The function 'getBootloaderFlag' is never used. +<<<<<<< HEAD +hdfirmware/firmware/App/Services/AlarmMgmt.c,387,style,unusedFunction,The function 'getCurrentAlarmStatePriority' is never used. +hdfirmware/firmware/App/Controllers/DGInterface.c,434,style,unusedFunction,The function 'getDGDrainPumpRPMSetPt' is never used. +hdfirmware/firmware/App/Controllers/DGInterface.c,380,style,unusedFunction,The function 'getDGPressure' is never used. +hdfirmware/firmware/App/Controllers/DGInterface.c,419,style,unusedFunction,The function 'getDGROPumpFlowRateMlMin' is never used. +hdfirmware/firmware/App/Controllers/DGInterface.c,404,style,unusedFunction,The function 'getDGROPumpPressureSetPt' is never used. +hdfirmware/firmware/App/Controllers/DialInFlow.c,1307,style,unusedFunction,The function 'getDialInFlowCalibration' is never used. +hdfirmware/firmware/FWCommon/NVDataMgmt.c,635,style,unusedFunction,The function 'getDisinfectionDate' is never used. +hdfirmware/firmware/App/Services/FPGA.c,1131,style,unusedFunction,The function 'getFPGABloodPumpHallSensorStatus' is never used. +hdfirmware/firmware/App/Services/FPGA.c,1163,style,unusedFunction,The function 'getFPGADialInPumpHallSensorStatus' is never used. +hdfirmware/firmware/App/Services/FPGA.c,1195,style,unusedFunction,The function 'getFPGADialOutPumpHallSensorStatus' is never used. +hdfirmware/firmware/App/Controllers/DGInterface.c,449,style,unusedFunction,The function 'getLoadCellWeightInGrams' is never used. +======= hdfirmware/firmware/App/Services/AlarmMgmt.c,537,style,unusedFunction,The function 'getCurrentAlarmStatePriority' is never used. hdfirmware/firmware/App/Controllers/DGInterface.c,399,style,unusedFunction,The function 'getDGDrainPumpRPMSetPt' is never used. hdfirmware/firmware/App/Controllers/DGInterface.c,345,style,unusedFunction,The function 'getDGPressure' is never used. @@ -43,15 +71,21 @@ hdfirmware/firmware/App/Services/FPGA.c,1169,style,unusedFunction,The function 'getFPGABloodPumpHallSensorStatus' is never used. hdfirmware/firmware/App/Services/FPGA.c,1201,style,unusedFunction,The function 'getFPGADialInPumpHallSensorStatus' is never used. hdfirmware/firmware/App/Services/FPGA.c,1233,style,unusedFunction,The function 'getFPGADialOutPumpHallSensorStatus' is never used. +>>>>>>> staging hdfirmware/firmware/FWCommon/NVDataMgmt.c,340,style,unusedFunction,The function 'getMfgData' is never used. -hdfirmware/firmware/App/Services/PIControllers.c,229,style,unusedFunction,The function 'getPIControllerSignals' is never used. +hdfirmware/firmware/App/Services/PIControllers.c,233,style,unusedFunction,The function 'getPIControllerSignals' is never used. hdfirmware/firmware/FWCommon/RTC.c,422,style,unusedFunction,The function 'getRTCTimestamp' is never used. hdfirmware/firmware/FWCommon/NVDataMgmt.c,465,style,unusedFunction,The function 'getServiceDate' is never used. hdfirmware/firmware/FWCommon/NVDataMgmt.c,558,style,unusedFunction,The function 'getTreatmentTime' is never used. hdfirmware/firmware/App/Controllers/Valves.c,343,style,unusedFunction,The function 'getValvePosition' is never used. hdfirmware/firmware/FWCommon/NVDataMgmt.c,595,style,unusedFunction,The function 'getWaterConsumption' is never used. hdfirmware/firmware/FWCommon/Utilities.c,418,style,unusedFunction,The function 'hexStrToDec' is never used. +<<<<<<< HEAD +hdfirmware/firmware/App/Modes/Prime.c,83,style,unusedFunction,The function 'initPrime' is never used. +hdfirmware/firmware/App/Services/AlarmMgmt.c,372,style,unusedFunction,The function 'isAlarmActive' is never used. +======= hdfirmware/firmware/App/Services/AlarmMgmt.c,522,style,unusedFunction,The function 'isAlarmActive' is never used. +>>>>>>> staging hdfirmware/firmware/App/Controllers/PresOccl.c,137,style,unusedFunction,The function 'isCartridgeLoaded' is never used. hdfirmware/firmware/App/Modes/ModeInitPOST.c,212,style,unusedFunction,The function 'isPOSTCompleted' is never used. hdfirmware/firmware/App/Modes/ModeInitPOST.c,225,style,unusedFunction,The function 'isPOSTPassed' is never used. @@ -64,13 +98,17 @@ hdfirmware/firmware/App/Services/Interrupts.c,245,style,unusedFunction,The function 'sciNotification' is never used. hdfirmware/firmware/App/Services/AlarmMgmt.c,566,style,unusedFunction,The function 'setAlarmAudioVolume' is never used. hdfirmware/firmware/FWCommon/NVDataMgmt.c,743,style,unusedFunction,The function 'setBootloaderFlag' is never used. +<<<<<<< HEAD +hdfirmware/firmware/App/Controllers/DGInterface.c,563,style,unusedFunction,The function 'setDGDialysateTemperatures' is never used. +======= hdfirmware/firmware/App/Controllers/DGInterface.c,455,style,unusedFunction,The function 'setDGDialysateTemperatures' is never used. +>>>>>>> staging hdfirmware/firmware/FWCommon/NVDataMgmt.c,610,style,unusedFunction,The function 'setDisinfectionDate' is never used. hdfirmware/firmware/FWCommon/NVDataMgmt.c,323,style,unusedFunction,The function 'setMfgData' is never used. hdfirmware/firmware/FWCommon/NVDataMgmt.c,440,style,unusedFunction,The function 'setServiceDate' is never used. hdfirmware/firmware/FWCommon/NVDataMgmt.c,534,style,unusedFunction,The function 'setTreatmentTime' is never used. hdfirmware/firmware/FWCommon/NVDataMgmt.c,572,style,unusedFunction,The function 'setWaterConsumption' is never used. -hdfirmware/firmware/App/Services/AlarmMgmt.c,756,style,unusedFunction,The function 'testResetAlarmStatusPublishIntervalOverride' is never used. -hdfirmware/firmware/App/Services/AlarmMgmt.c,731,style,unusedFunction,The function 'testSetAlarmStatusPublishIntervalOverride' is never used. +hdfirmware/firmware/App/Services/AlarmMgmt.c,781,style,unusedFunction,The function 'testResetAlarmStatusPublishIntervalOverride' is never used. +hdfirmware/firmware/App/Services/AlarmMgmt.c,756,style,unusedFunction,The function 'testSetAlarmStatusPublishIntervalOverride' is never used. hdfirmware/firmware/FWCommon/NVDataMgmt.c,487,style,unusedFunction,The function 'writeLogData' is never used. ,,information,missingInclude,Cppcheck cannot find all the include files (use --check-config for details)