Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r4778daea54641e73f72322ba660a673f9ba6dfb8 -rd466db5e5f2d865456aa12140b3d1bb56335730b --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 4778daea54641e73f72322ba660a673f9ba6dfb8) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision d466db5e5f2d865456aa12140b3d1bb56335730b) @@ -37,11 +37,12 @@ #define VALVES_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Valves data publish interval. #define DATA_PUBLISH_COUNTER_START_COUNT 13 ///< Valves data publish start counter. -#define VALVE_TRANSITION_MIN_TGT_DELTA 5 ///< Minimum encoder position delta from target position to end transition state. +#define VALVE_TRANSITION_MIN_TGT_DELTA 5 ///< Minimum encoder position delta from target position to end transition state. #define VALVE_HOME_MIN_POS_CHG 3 ///< Minimum encoder position change to indicate a home operation is still moving toward edge. #define VALVE_HOME_BACK_OFF_EDGE 3 ///< Encoder counts to back off of detected edge position. #define MAX_HOME_FULL_TRAVEL_DIFF 10U ///< Maximum allowed difference in full travel encoder counts between expected and measured during home operation. #define VALVE_TRANSITION_TIMEOUT_MS ( 3 * MS_PER_SECOND ) ///< Valves transition time out in ms. +#define VALVE_HOMING_TIMEOUT_MS ( 15 * MS_PER_SECOND ) #define HOMING_EDGE_DETECTION_TIMEOUT_MS ( 0.5 * MS_PER_SECOND ) ///< Valves homing edge detection timeout in milliseconds. #define VALVE_FORCE_HOME TRUE ///< Force valve to home even if already homed. #define ZERO_ENC_DEBOUNCE_THRESHOLD_CNT 5 ///< Valves zero encoder debounce threshold count. @@ -63,7 +64,7 @@ // Homing variables BOOL hasHomingBeenRequested; ///< Valve homing request flag. BOOL hasValveBeenHomed; ///< Valve homing completed flag. - BOOL homingOperationActive; + BOOL homingOperationActive; ///< Valve homing active flag. } VALVE_STATUS_T; /// Payload record structure for pinch valve set position request @@ -399,7 +400,7 @@ nextState = VALVE_STATE_IDLE; } else if ( ( TRUE == currentValveStates[ valve ].homingOperationActive ) && - ( TRUE == didTimeout( currentValveStates[ valve ].valveOpsStartTime, VALVE_TRANSITION_TIMEOUT_MS ) ) && + ( TRUE == didTimeout( currentValveStates[ valve ].valveOpsStartTime, VALVE_HOMING_TIMEOUT_MS ) ) && ( TRUE != getCPLDACPowerLossDetected() ) ) { currentValveStates[ valve ].homingOperationActive = FALSE; @@ -548,7 +549,6 @@ data.posA = (S16)getPinchValveStoredPosition( valve, VALVE_POSITION_A_INSERT_EJECT ); data.posB = (S16)getPinchValveStoredPosition( valve, VALVE_POSITION_B_OPEN ); data.posC = (S16)getPinchValveStoredPosition( valve, VALVE_POSITION_C_CLOSE ); - broadcastData( MSG_ID_TD_VALVES_DATA, COMM_BUFFER_OUT_CAN_TD_BROADCAST, (U08*)&data, sizeof( TD_VALVE_DATA_T ) ); } Index: firmware/App/Controllers/Valves.h =================================================================== diff -u -r8fc5ef2c8ca8e8438b1eaf388b6b9ee5190ae76b -rd466db5e5f2d865456aa12140b3d1bb56335730b --- firmware/App/Controllers/Valves.h (.../Valves.h) (revision 8fc5ef2c8ca8e8438b1eaf388b6b9ee5190ae76b) +++ firmware/App/Controllers/Valves.h (.../Valves.h) (revision d466db5e5f2d865456aa12140b3d1bb56335730b) @@ -45,7 +45,6 @@ S16 posA; ///< Position A (count) S16 posB; ///< Position B (count) S16 posC; ///< Position C (count) - S16 maxHomingPos; ///< Maximum homing position } TD_VALVE_DATA_T; #pragma pack(pop) Index: firmware/App/Drivers/PinchValve.c =================================================================== diff -u -rc0b93a6de34d38d42e7a678b6ced59220e1d14da -rd466db5e5f2d865456aa12140b3d1bb56335730b --- firmware/App/Drivers/PinchValve.c (.../PinchValve.c) (revision c0b93a6de34d38d42e7a678b6ced59220e1d14da) +++ firmware/App/Drivers/PinchValve.c (.../PinchValve.c) (revision d466db5e5f2d865456aa12140b3d1bb56335730b) @@ -21,7 +21,6 @@ #include "Timers.h" #include "Utilities.h" - /** * @addtogroup PinchValve * @{ @@ -72,7 +71,7 @@ static const S32 H1_HOMING_VELOCITY_SECOND = 3342; ///< Second H1 homing movement velocity ( Forward Direction ) static const S32 H19_HOMING_VELOCITY_FIRST = 3342; ///< First H19 homing movement velocity ( Forward Direction ) static const S32 H19_HOMING_VELOCITY_SECOND = -3342; ///< Second H19 homing movement velocity ( Reverse Direction ) -static const S32 POSITION_VELOCITY = 50000; ///< Velocity used for normal stored position movement +static const S32 POSITION_VELOCITY = 70000; ///< Velocity used for normal stored position movement #define PINCH_VALVE_EVENT_MOTION_COMPLETE_MASK 0x0001 ///< Event Status bit 0: motion complete. #define PINCH_VALVE_EVENT_MOTION_ERROR_MASK 0x0010 ///< Event Status bit 4: motion error. @@ -147,7 +146,7 @@ // ********** private data ********** -// This array is used for both H1_VALV +/// This array is used for both H1_VALV static PINCH_VALVE_COMMAND_T h1HomingCommands[ NUM_OF_PINCH_VALVE_HOMING_COMMANDS ] = { { PINCH_VALVE_PMD_CMD_SET_PROFILE_MODE, PINCH_VALVE_PROFILE_MODE_VELOCITY, 0, 0, 1, 0, TRUE }, // Selects velocity profile mode for homing @@ -170,7 +169,7 @@ { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE } // Polls event status until the third movement completes }; -// This array is used for both H19_VALV +/// This array is used for both H19_VALV static PINCH_VALVE_COMMAND_T h19HomingCommands[ NUM_OF_PINCH_VALVE_HOMING_COMMANDS ] = { { PINCH_VALVE_PMD_CMD_SET_PROFILE_MODE, PINCH_VALVE_PROFILE_MODE_VELOCITY, 0, 0, 1, 0, TRUE }, // Selects velocity profile mode for homing @@ -193,6 +192,7 @@ { PINCH_VALVE_PMD_CMD_GET_EVENT_STATUS, 0, 0, 0, 0, 1, FALSE } // Polls event status until the third movement completes }; +/// This array is used for position commands static PINCH_VALVE_COMMAND_T positionCommands[ NUM_OF_PINCH_VALVE_POSITION_COMMANDS ] = { { PINCH_VALVE_PMD_CMD_RESET_EVENT_STATUS, PINCH_VALVE_RESET_EVENT_STATUS_VALUE, 0, 0, 1, 0, TRUE }, // Clears event bits before position movement Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r4778daea54641e73f72322ba660a673f9ba6dfb8 -rd466db5e5f2d865456aa12140b3d1bb56335730b --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 4778daea54641e73f72322ba660a673f9ba6dfb8) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision d466db5e5f2d865456aa12140b3d1bb56335730b) @@ -24,12 +24,17 @@ #include "ModeTreatment.h" #include "ModeStandby.h" #include "OperationModes.h" +#include "PinchValve.h" #include "Switches.h" #include "SystemCommTD.h" #include "TxParams.h" #include "Valve3Way.h" #include "Valves.h" +//#if 1 +//#include "PinchValve.h" +//#endif + /** * @addtogroup TDStandbyMode * @{ @@ -48,10 +53,15 @@ static FLUID_TYPE_T fluidType; ///< Fluid type assigned based on user selection. static TREATMENT_TYPE_T modality; ///< Modality from the treatment initiation. + // ********** private function prototypes ********** static TD_STANDBY_STATE_T handleStandbyModeStartState( void ); static TD_STANDBY_STATE_T handleStandbyModeWaitForTreatmentState( void ); +//#if 1 +//static BOOL startTest = FALSE; +//static BOOL startPos = FALSE; +//#endif /*********************************************************************//** * @brief @@ -67,6 +77,8 @@ homingInitiated = FALSE; fluidType = FLUID_TYPE_UNKNOWN; modality = TREATMENT_MODALITY_HD_SALINE_FLUID; +// startTest = FALSE; +// startPos = FALSE; } /*********************************************************************//** @@ -113,6 +125,9 @@ // sendDGServiceRequestToDG(); // sendDGUsageInfoRequestToDG(); +//#if 1 +// initPinchValveDriver(); +//#endif return currentStandbyState; } @@ -132,6 +147,41 @@ { // Ignore stop button in this mode. } +//#if 1 +// if ( TRUE == startTest ) +// { +// startTest = FALSE; +// startPos = TRUE; +// homePinchValve(H1_VALV); +// homePinchValve(H19_VALV); +// } +// if ( ( TRUE == isPinchValveHomed( H1_VALV ) ) && ( TRUE == isPinchValveHomed( H19_VALV ) ) && startPos == TRUE ) +// { +// static U32 p = 1; +// static U32 d = 0; +// +// if ( ( TRUE != isPinchValveBusy( H1_VALV ) ) && ( TRUE != isPinchValveBusy( H19_VALV ) ) ) +// { +// if ( ++d > 40 ) +// { +// d = 0; +// setPinchValvePosition( H1_VALV, (VALVE_POSITION_T)p ); +// setPinchValvePosition( H19_VALV, (VALVE_POSITION_T)p ); +// p++; +// if ( p >= NUM_OF_VALVE_POSITIONS ) +// { +// p = 1; +// } +// } +// } +// } +// if ( TRUE == startPos ) +// { +// startPos = FALSE; +// setPinchValvePosition ( H1_VALV, VALVE_POSITION_C_CLOSE ); +// setPinchValvePosition ( H19_VALV, VALVE_POSITION_B_OPEN ); +// } +//#endif // State machine for standby mode @@ -223,6 +273,7 @@ DD_OP_MODE_T ddOperationMode = getDDOpMode(); F32 bicarbConvFactor = BICARBONATE_CONVERSION_FACTOR; + // switch ( dgOperationMode ) // { // case DG_MODE_GENE: @@ -290,6 +341,7 @@ return state; } + /*********************************************************************//** * @brief * The setFluidType function sets the fluid type based on the user's Index: firmware/App/Services/SystemCommTD.c =================================================================== diff -u -rcff19e1c44fd570e139a2a3f49b5a05f0193367d -rd466db5e5f2d865456aa12140b3d1bb56335730b --- firmware/App/Services/SystemCommTD.c (.../SystemCommTD.c) (revision cff19e1c44fd570e139a2a3f49b5a05f0193367d) +++ firmware/App/Services/SystemCommTD.c (.../SystemCommTD.c) (revision d466db5e5f2d865456aa12140b3d1bb56335730b) @@ -256,7 +256,7 @@ #endif { #ifndef TEST_DISABLE_UI_ALARMS - activateAlarmNoData( ALARM_ID_TD_UI_COMM_TIMEOUT ); + //activateAlarmNoData( ALARM_ID_TD_UI_COMM_TIMEOUT ); #endif } } Index: firmware/App/TDCommon.h =================================================================== diff -u -rcff19e1c44fd570e139a2a3f49b5a05f0193367d -rd466db5e5f2d865456aa12140b3d1bb56335730b --- firmware/App/TDCommon.h (.../TDCommon.h) (revision cff19e1c44fd570e139a2a3f49b5a05f0193367d) +++ firmware/App/TDCommon.h (.../TDCommon.h) (revision d466db5e5f2d865456aa12140b3d1bb56335730b) @@ -39,7 +39,7 @@ // #define TEST_UI_ONLY 1 // Alpha test with TD and UI only - no DD // #define TEST_DISABLE_UI_ALARMS 1 // Disable UI alarms // #define TEST_USE_OFF_AS_STOP_BUTTON 1 // Alpha test re-purposing off button as a stop button -// #define TEST_NO_PRESSURE_CHECKS 1 // Alpha test with no pressure sensor checks +// #define TEST_NO_PRESSURE_CHECKS 1 // Alpha test with no pressure sensor checks // #define TEST_NO_STOP_CONSUME_CHECK 1 // Alpha test with no check for stop button timeout // #define ASN_DEMO 1 Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -re0060cd79d971c0ed94b8aed6949d2754480fe92 -rd466db5e5f2d865456aa12140b3d1bb56335730b --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision e0060cd79d971c0ed94b8aed6949d2754480fe92) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision d466db5e5f2d865456aa12140b3d1bb56335730b) @@ -111,7 +111,7 @@ execAirTrapController(); // Control pinch valves - //execValvesController(); + execValvesController(); // Control ejector execEjectorController();