Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r75ecd5ee8a56b8d9faef07cdeb0a8dc7975ff476 -r5126b79e4970ffe2ed9db4cccea18a1216c78570 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 75ecd5ee8a56b8d9faef07cdeb0a8dc7975ff476) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 5126b79e4970ffe2ed9db4cccea18a1216c78570) @@ -56,8 +56,7 @@ static U32 currentBalChamberSwitchingCounter; ///< Counter (in task interval) to monitor the timing spent during balancing chamber fill/drain operation. static BOOL isBalChamberFillInProgress; ///< Flag indicating balancing chamber fill/drain is in progress. static BOOL isPressureStalbilizedDuringFill; ///< Flag indicating that the pressure is stablized due to fill complete. -static BOOL isPressureDroppedDuringState1Fill; ///< Flag indicating that the pressure is dropped due to BC state 1 fill in progress condition. -static BOOL isPressureDroppedDuringState2Fill; ///< Flag indicating that the pressure is dropped due to BC state 2 fill in progress condition. +static BOOL isPressureDroppedDuringFill; ///< Flag indicating that the pressure is dropped due to BC fill (state 1 or state 2) in progress condition. static BAL_CHAMBER_SW_STATE_T balChamberSWState; ///< Current balancing chamber switching state ( state 1 or state 2). static U32 balChamberDataPublicationTimerCounter; ///< Used to schedule balancing chamber data publication to CAN bus. static OVERRIDE_U32_T balChamberDataPublishInterval; ///< Balancing chamber data publish interval. @@ -371,7 +370,7 @@ currentBalChamberSwitchingCounter = 0; isBalChamberFillInProgress = FALSE; isPressureStalbilizedDuringFill = FALSE; - isPressureDroppedDuringState1Fill = FALSE; + isPressureDroppedDuringFill = FALSE; balChamberSWState = BAL_CHAMBER_SW_STATE1; F32 freshDialPressure = getFilteredPressure( D18_PRES ); @@ -392,7 +391,7 @@ isBalChamberFillInProgress = TRUE; // Deliver dosing during generate dialysate mode - if ( FALSE == getBalChamberSwitchingOnlyStatus() ) + if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { // start acid and bicarb pump with the expected quantity setConcentratePumpTargetSpeed( D11_PUMP, CONCENTRATE_PUMP_MAX_SPEED, acidVolume ); @@ -417,7 +416,7 @@ * The handleBalChamberConcentrateControl function handles the Acid and Bicarb * concentrate doisng and checks the conductivity of the dialysate for the treatment. * @details \b Inputs: balChamberSWState , Concentrate volume - * @details \b Outputs: state + * @details \b Outputs: isPressureDroppedDuringFill, state * @return next balancing chamber state. *************************************************************************/ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberConcentrateControl( void ) @@ -428,22 +427,14 @@ F32 spentDialPressure = getFilteredPressure( D51_PRES ); // Pressure drop check during fill process helps to find if there is any issue with valves opening - if ( ( ( freshDialPressure >= BC_FILL_PRESSURE_MAX_PSIG ) && ( freshDialPressure <= BC_FILL_PRESSURE_MIN_PSIG ) ) && - ( ( spentDialPressure >= BC_FILL_PRESSURE_MAX_PSIG ) && ( spentDialPressure <= BC_FILL_PRESSURE_MIN_PSIG ) ) ) + if ( ( freshDialPressure <= BC_FILL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= BC_FILL_PRESSURE_MIN_PSIG ) ) { - if ( BAL_CHAMBER_SW_STATE1 == balChamberSWState ) - { - isPressureDroppedDuringState1Fill = TRUE; - } - else - { - isPressureDroppedDuringState2Fill = TRUE; - } + isPressureDroppedDuringFill = TRUE; } // On dosing completion, transition to next state based on the current switching state - if ( ( ( TRUE == getConcentratePumpDosingStatus( D11_PUMP ) ) && - ( TRUE == getConcentratePumpDosingStatus( D10_PUMP ) ) ) || + if ( ( ( TRUE == isConcentratePumpDosingCompleted( D11_PUMP ) ) && + ( TRUE == isConcentratePumpDosingCompleted( D10_PUMP ) ) ) || ( TRUE == getBalChamberSwitchingOnlyStatus() ) ) { if ( BAL_CHAMBER_SW_STATE1 == balChamberSWState ) @@ -502,9 +493,9 @@ // On completion of cycle time, transition to next state if ( currentBalChamberSwitchingCounter >= balChamberSwitchingPeriod ) { - if ( FALSE == getBalChamberSwitchingOnlyStatus() ) + if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { - if ( TRUE != isPressureDroppedDuringState1Fill ) + if ( TRUE != isPressureDroppedDuringFill ) { // When fill initiated, pressure is not dropped to the expected range, possible valve failures. SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); @@ -548,7 +539,7 @@ currentBalChamberSwitchingCounter = 0; isBalChamberFillInProgress = FALSE; isPressureStalbilizedDuringFill = FALSE; - isPressureDroppedDuringState2Fill = FALSE; + isPressureDroppedDuringFill = FALSE; balChamberSWState = BAL_CHAMBER_SW_STATE2; F32 freshDialPressure = getFilteredPressure( D18_PRES ); @@ -570,7 +561,7 @@ isBalChamberFillInProgress = TRUE; // Deliver dosing during generate dialysate mode - if ( FALSE == getBalChamberSwitchingOnlyStatus() ) + if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { // start acid and bicarb pump with the expected quantity setConcentratePumpTargetSpeed( D11_PUMP, CONCENTRATE_PUMP_MAX_SPEED, acidVolume ); @@ -633,9 +624,9 @@ if ( currentBalChamberSwitchingCounter >= balChamberSwitchingPeriod ) { // Pressure alarm check - if ( FALSE == getBalChamberSwitchingOnlyStatus() ) + if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { - if ( TRUE != isPressureDroppedDuringState2Fill ) + if ( TRUE != isPressureDroppedDuringFill ) { // When fill initiated, pressure is not dropped to the expected range, possible valve failures. SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r5e92cbb2c29854fb60a91dc4abafeb9b08d3272c -r5126b79e4970ffe2ed9db4cccea18a1216c78570 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 5e92cbb2c29854fb60a91dc4abafeb9b08d3272c) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 5126b79e4970ffe2ed9db4cccea18a1216c78570) @@ -589,14 +589,14 @@ /*********************************************************************//** * @brief - * The getConcentratePumpDosingStatus function returns the dosing status + * The isConcentratePumpDosingCompleted function returns the dosing status * for a given concentrate pump. * @details \b Inputs: concentratePumps * @details \b Outputs: none * @param pumpId concentrate pump id to get current dosing status * @return the current doisng status/state for the given conecntrate pump. *************************************************************************/ -BOOL getConcentratePumpDosingStatus( CONCENTRATE_PUMPS_T pumpId ) +BOOL isConcentratePumpDosingCompleted( CONCENTRATE_PUMPS_T pumpId ) { BOOL state = FALSE; Index: firmware/App/Controllers/ConcentratePumps.h =================================================================== diff -u -r6bbe6e35f9c378ad8dd5be2edebb1cc1acd23d37 -r5126b79e4970ffe2ed9db4cccea18a1216c78570 --- firmware/App/Controllers/ConcentratePumps.h (.../ConcentratePumps.h) (revision 6bbe6e35f9c378ad8dd5be2edebb1cc1acd23d37) +++ firmware/App/Controllers/ConcentratePumps.h (.../ConcentratePumps.h) (revision 5126b79e4970ffe2ed9db4cccea18a1216c78570) @@ -92,7 +92,7 @@ U16 getConcPumpCurrentMeasuredRevolutionCount( CONCENTRATE_PUMPS_T pumpId ); BOOL handleConcentratePumpParkRequest( void ); BOOL isConcPumpParkInProgress( CONCENTRATE_PUMPS_T pumpId ); -BOOL getConcentratePumpDosingStatus( CONCENTRATE_PUMPS_T pumpId ); +BOOL isConcentratePumpDosingCompleted( CONCENTRATE_PUMPS_T pumpId ); BOOL testConcentratePumpDataPublishIntervalOverride( MESSAGE_T *message ); BOOL testConcentratePumpTargetSpeedOverride( MESSAGE_T *message ); Index: firmware/App/Controllers/DialysatePumps.c =================================================================== diff -u -r5e92cbb2c29854fb60a91dc4abafeb9b08d3272c -r5126b79e4970ffe2ed9db4cccea18a1216c78570 --- firmware/App/Controllers/DialysatePumps.c (.../DialysatePumps.c) (revision 5e92cbb2c29854fb60a91dc4abafeb9b08d3272c) +++ firmware/App/Controllers/DialysatePumps.c (.../DialysatePumps.c) (revision 5126b79e4970ffe2ed9db4cccea18a1216c78570) @@ -39,17 +39,8 @@ */ // ********** private definitions ********** -#ifndef __OPENSPDTEST__ #define DIALYSATE_PUMP_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the dialysate pump data is published on the CAN bus. -#else -#define DIALYSATE_PUMP_DATA_PUB_INTERVAL ( 50 / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the dialysate pump data is published on the CAN bus. -#endif #define DATA_PUBLISH_COUNTER_START_COUNT 60 ///< Data publish counter start count. -#ifdef __OPENSPDTEST__ -#define DIALYSATE_PUMP_EXEC_INTERVAL ( 2000 / TASK_GENERAL_INTERVAL ) -#define DIALYSATE_PUMP_SPEED_INCREMENT 200.0F ///< Speed increase when controlling dialysate pump to target step speed. -#endif - #define DP_CONTROL_INTERVAL ( 1000 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the dialysate pump is controlled. #define DIALYSATE_PUMP_CONTROL_RUN 0x01 ///< Dialysate pump control run pump. #define DIALYSATE_PUMP_CONTROL_STOP 0x00 ///< Dialysate pump control stop pump. @@ -143,11 +134,6 @@ static OVERRIDE_F32_T pumpTargetPressure[ NUM_OF_DIALYSATE_PUMPS ]; ///< Target dialysate pumps' pressure (PSI). static BOOL dialPumpsReadyToControl; ///< Flag use to indicate the minimum control interval is met for pump control -//Testing -#ifdef __OPENSPDTEST__ -static U32 dialysatePumpExecTimerCounter[ NUM_OF_DIALYSATE_PUMPS ]; ///< Used to schedule dialysate pump data publication to CAN bus. -#endif - //For testing #ifdef __PITEST__ static F32 pIControlSignal[ NUM_OF_CONTROLLER_SIGNAL ]; @@ -174,11 +160,6 @@ void initDialysatePump( void ) { DIALYSATE_PUMPS_T pumpId; -//Testing -#ifdef __OPENSPDTEST__ - dialysatePumpExecTimerCounter[ D12_PUMP ] = 9900; - dialysatePumpExecTimerCounter[ D48_PUMP ] = 9900; -#endif #ifdef __PITEST__ U32 i; @@ -560,10 +541,6 @@ for ( pumpId = DIALYSATE_PUMPS_FIRST; pumpId < NUM_OF_DIALYSATE_PUMPS; pumpId++ ) { -#ifdef __OPENSPDTEST__ - if ( ++dialysatePumpExecTimerCounter[ pumpId ] >= DIALYSATE_PUMP_EXEC_INTERVAL ) - { -#endif switch ( dialysatePumps[ pumpId ].dialysatePumpState ) { case DIALYSATE_PUMP_OFF_STATE: @@ -583,10 +560,6 @@ dialysatePumps[ pumpId ].dialysatePumpState = DIALYSATE_PUMP_OFF_STATE; break; } -#ifdef __OPENSPDTEST__ - dialysatePumpExecTimerCounter[ pumpId ] = 0; - } -#endif } } @@ -724,12 +697,7 @@ { if ( currentToTargetDiff > DIALYSATE_PUMP_RAMP_SPEED_INCREMENT ) { -//Testing -#ifndef __OPENSPDTEST__ speedIncrease = DIALYSATE_PUMP_RAMP_SPEED_INCREMENT; -#else - speedIncrease = DIALYSATE_PUMP_SPEED_INCREMENT; -#endif } else { Index: firmware/App/Controllers/PistonPumpControl.c =================================================================== diff -u -r5e92cbb2c29854fb60a91dc4abafeb9b08d3272c -r5126b79e4970ffe2ed9db4cccea18a1216c78570 --- firmware/App/Controllers/PistonPumpControl.c (.../PistonPumpControl.c) (revision 5e92cbb2c29854fb60a91dc4abafeb9b08d3272c) +++ firmware/App/Controllers/PistonPumpControl.c (.../PistonPumpControl.c) (revision 5126b79e4970ffe2ed9db4cccea18a1216c78570) @@ -363,7 +363,7 @@ { PISTON_PUMP_EXEC_STATE_T state = PISTON_PUMP_FILL_COMPLETE_STATE; - if ( TRUE == getConcentratePumpDosingStatus( (CONCENTRATE_PUMPS_T)pumpId ) ) + if ( TRUE == isConcentratePumpDosingCompleted( (CONCENTRATE_PUMPS_T)pumpId ) ) { // Close Inlet and Outlet valve pistonPumpInletOutletValveControl( pumpId, VALVE_STATE_CLOSED, VALVE_STATE_CLOSED ); @@ -429,7 +429,7 @@ { PISTON_PUMP_EXEC_STATE_T state = PISTON_PUMP_DISPENSE_COMPLETE_STATE; - if ( TRUE == getConcentratePumpDosingStatus( (CONCENTRATE_PUMPS_T)pumpId ) ) + if ( TRUE == isConcentratePumpDosingCompleted( (CONCENTRATE_PUMPS_T)pumpId ) ) { // Close Inlet and Outlet valve pistonPumpInletOutletValveControl( pumpId, VALVE_STATE_CLOSED, VALVE_STATE_CLOSED ); Index: firmware/App/DDCommon.h =================================================================== diff -u -re0fc678329b0cb25dd76fa5e23cc1f487851f0ec -r5126b79e4970ffe2ed9db4cccea18a1216c78570 --- firmware/App/DDCommon.h (.../DDCommon.h) (revision e0fc678329b0cb25dd76fa5e23cc1f487851f0ec) +++ firmware/App/DDCommon.h (.../DDCommon.h) (revision 5126b79e4970ffe2ed9db4cccea18a1216c78570) @@ -42,10 +42,6 @@ //Uncomment below for PI testing //#define __PITEST__ 1 -//Dialysate speed Open loop speed and pressure test -#define __OPENSPDTEST__ 1 - - #include #include #endif Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r5e92cbb2c29854fb60a91dc4abafeb9b08d3272c -r5126b79e4970ffe2ed9db4cccea18a1216c78570 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 5e92cbb2c29854fb60a91dc4abafeb9b08d3272c) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 5126b79e4970ffe2ed9db4cccea18a1216c78570) @@ -625,19 +625,6 @@ /*********************************************************************//** * @brief - * The setCurrentGenDialysateState function sets the current state of the - * gen dialysate mode. - * @details \b Inputs: genDialysateState - * @details \b Outputs: genDialysateState - * @return the current state of gen dialysate mode - *************************************************************************/ -void setCurrentGenDialysateState( DD_GEND_MODE_STATE_T state ) -{ - genDialysateState = state; -} - -/*********************************************************************//** - * @brief * The setTreatmentParamUpdate function sets the flag to indicate one or more * treatement parameters updated. * gen dialysate mode. @@ -867,8 +854,11 @@ if ( payload.execStateSet < NUM_OF_DD_GEND_MODE_STATES ) { //set the GenD exec state machine - setCurrentGenDialysateState( (DD_GEND_MODE_STATE_T)payload.execStateSet); + DD_GEND_MODE_STATE_T state = (DD_GEND_MODE_STATE_T)payload.execStateSet; + setModeGenDStateTransition( state ); + genDialysateState = state; + result = TRUE; } } Index: firmware/App/Monitors/Level.c =================================================================== diff -u -re0fc678329b0cb25dd76fa5e23cc1f487851f0ec -r5126b79e4970ffe2ed9db4cccea18a1216c78570 --- firmware/App/Monitors/Level.c (.../Level.c) (revision e0fc678329b0cb25dd76fa5e23cc1f487851f0ec) +++ firmware/App/Monitors/Level.c (.../Level.c) (revision 5126b79e4970ffe2ed9db4cccea18a1216c78570) @@ -197,8 +197,6 @@ processPistonPumpDosingTrigger(); #endif publishLevelsData(); - - } /*********************************************************************//** Index: firmware/App/Monitors/Pressure.c =================================================================== diff -u -re0fc678329b0cb25dd76fa5e23cc1f487851f0ec -r5126b79e4970ffe2ed9db4cccea18a1216c78570 --- firmware/App/Monitors/Pressure.c (.../Pressure.c) (revision e0fc678329b0cb25dd76fa5e23cc1f487851f0ec) +++ firmware/App/Monitors/Pressure.c (.../Pressure.c) (revision 5126b79e4970ffe2ed9db4cccea18a1216c78570) @@ -29,11 +29,7 @@ // ********** private definitions ********** //TODO : Increasing the publish interval -#ifndef __OPENSPDTEST__ #define PRESSURES_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the pressures data is published on the CAN bus. -#else -#define PRESSURES_DATA_PUB_INTERVAL ( 50 / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the pressures data is published on the CAN bus. -#endif #define DATA_PUBLISH_COUNTER_START_COUNT ( 5 ) ///< Data publish counter start count. #define PRESSURE_SAMPLE_FILTER_MS ( 50 ) ///< Filter pressure data for given time #define PRESSURE_TEMP_SAMPLE_FILTER_MS ( 50 ) @@ -491,23 +487,13 @@ data.d51Pressure = getFilteredPressure( D51_PRES ); data.d18Pressure = getFilteredPressure( D18_PRES ); data.d41Pressure = getFilteredPressure( D41_PRES ); -#ifndef __OPENSPDTEST__ data.m1PresTemp = getFilteredPressureSensorTemperature( M1_PRES ); data.m3PresTemp = getFilteredPressureSensorTemperature( M3_PRES ); data.d9PresTemp = getFilteredPressureSensorTemperature( D9_PRES ); data.d66PresTemp = getFilteredPressureSensorTemperature( D66_PRES ); data.d51PresTemp = getFilteredPressureSensorTemperature( D51_PRES ); data.d18PresTemp = getFilteredPressureSensorTemperature( D18_PRES ); data.d41PresTemp = getFilteredPressureSensorTemperature( D41_PRES ); -#else - data.m1PresTemp = (F32)getPressureSensorErrorCount( D9_PRES ); - data.m3PresTemp = (F32)getPressureSensorReadCount( D9_PRES ); - data.d9PresTemp = getPressure( D9_PRES ); - data.d66PresTemp = (F32)getPressureSensorErrorCount( D18_PRES ); - data.d51PresTemp = (F32)getPressureSensorReadCount( D18_PRES ); - data.d18PresTemp = getPressure( D18_PRES ); - data.d41PresTemp = getPressure( D41_PRES ); -#endif pressuresDataPublicationTimerCounter = 0; broadcastData( MSG_ID_DD_PRESSURES_DATA, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&data, sizeof( PRESSURE_TEMP_DATA_T ) );