Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -rc5b653fce3854c9c80a94d72aa5a0a04ab21a476 -rc9b434898a8bbe9143b243627ea081e5e0f7a861 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision c5b653fce3854c9c80a94d72aa5a0a04ab21a476) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision c9b434898a8bbe9143b243627ea081e5e0f7a861) @@ -229,6 +229,7 @@ // TODO remove for testing only static S32 testPos[ NUM_OF_VALVES ][300]; +static F32 testCurr[ NUM_OF_VALVES ][ 300 ]; static U32 idx[ NUM_OF_VALVES ] = {0,0,0,0}; // TODO remove for testing only @@ -271,19 +272,7 @@ *************************************************************************/ void initValves( void ) { - // TODO remove - memset(testPos[0], 0x0, 300 * sizeof(S32)); - idx[ 0 ] = 0; - memset(testPos[1], 0x0, 300 * sizeof(S32)); - idx[ 1 ] = 0; - memset(testPos[2], 0x0, 300 * sizeof(S32)); - idx[ 2 ] = 0; - memset(testPos[3], 0x0, 300 * sizeof(S32)); - idx[ 3 ] = 0; - // TODO remove - VALVE_T valve; - valveSelfTestState = VALVE_SELF_TEST_ENABLE_VALVES; valvesSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; valveAirTrapStatus = STATE_CLOSED; @@ -737,14 +726,15 @@ // The range from energized to de-energized should be in between 9000 to 13000 steps if ( deltaEdges <= INITIAL_ENERGIZED_EDGE_UPPER_RANGE && deltaEdges >= INITIAL_ENERGIZED_EDGE_LOWER_RANGE ) { - S16 positionB = valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ]; + S16 positionC = currentPosition + INITIAL_EDGE_OFFSET_READ_COUNT; + S16 positionB = valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ] - INITIAL_EDGE_OFFSET_READ_COUNT; // Positions B and C will have an offset from the edge to make sure each time the valve will not hit the edge - valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ] = positionB - INITIAL_EDGE_OFFSET_READ_COUNT; + valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ] = positionB; + valvesStatus[ valve ].positions[ VALVE_POSITION_C_CLOSE ] = positionC; - valvesStatus[ valve ].positions[ VALVE_POSITION_C_CLOSE ] = currentPosition + INITIAL_EDGE_OFFSET_READ_COUNT; // Position A is the average of the Position B that was read last time and position C that was the target of this state - valvesStatus[ valve ].positions[ VALVE_POSITION_A_INSERT_EJECT ] = currentPosition + ( ( valvesStatus[ valve ].positions[ VALVE_POSITION_B_OPEN ] - valvesStatus[ valve ].positions[ VALVE_POSITION_C_CLOSE ] ) / 2 ); + valvesStatus[ valve ].positions[ VALVE_POSITION_A_INSERT_EJECT ] = positionC + ( ( positionB - positionC ) / 2 ); #ifndef _RELEASE_ if ( ( getSoftwareConfigStatus( SW_CONFIG_ENABLE_VBA_SPECIAL_POSITION_C ) == SW_CONFIG_ENABLE_VALUE ) && ( VBA == valve ) ) @@ -1174,6 +1164,7 @@ valvesStatus[ VBV ].currentPositionInCounts.data = (S32)getFPGAValveBloodVenousPosition(); testPos[VDI][ idx[VDI] ] = valvesStatus[ VDI ].currentPositionInCounts.data; + testCurr[VDI][ idx[VDI] ] = valvesStatus[ VDI ].current.data; idx[VDI] = INC_WRAP(idx[VDI], 0, 300); testPos[VDO][ idx[VDO] ] = valvesStatus[ VDO ].currentPositionInCounts.data; @@ -1183,6 +1174,7 @@ idx[VBA] = INC_WRAP(idx[VBA], 0, 300); testPos[VBV][ idx[VBV] ] = valvesStatus[ VBV ].currentPositionInCounts.data; + testCurr[VBV][ idx[VBV] ] = valvesStatus[ VBV ].current.data; idx[VBV] = INC_WRAP(idx[VBV], 0, 300); // Check the position of each valve Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -r575f9b78ced835f11c015d652be1bd8b83fc9578 -rc9b434898a8bbe9143b243627ea081e5e0f7a861 --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision 575f9b78ced835f11c015d652be1bd8b83fc9578) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision c9b434898a8bbe9143b243627ea081e5e0f7a861) @@ -34,7 +34,7 @@ #include "Temperatures.h" #include "Voltages.h" #include "WatchdogMgmt.h" - + /** * @addtogroup TaskGeneral * @{ Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -r575f9b78ced835f11c015d652be1bd8b83fc9578 -rc9b434898a8bbe9143b243627ea081e5e0f7a861 --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 575f9b78ced835f11c015d652be1bd8b83fc9578) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision c9b434898a8bbe9143b243627ea081e5e0f7a861) @@ -33,6 +33,7 @@ #include "Valves.h" #include "WatchdogMgmt.h" #include "TaskPriority.h" + /** * @addtogroup TaskPriority