Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -ra6737c3bcc8286c153b778c2c395f465e76aaafb -rc21aee456ffbfed5aba9a5983c295acf0595afa3 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision a6737c3bcc8286c153b778c2c395f465e76aaafb) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision c21aee456ffbfed5aba9a5983c295acf0595afa3) @@ -133,14 +133,14 @@ static OVERRIDE_U32_T concentratePumpDataPublishInterval; ///< Concentrate pump data publish interval. static CONCENTRATE_PUMP_T concentratePumps[ NUM_OF_CONCENTRATE_PUMPS ]; ///< Array of concentrate pumps' data structure. -static OVERRIDE_U32_T hasParkBeenRequested[ NUM_OF_CONCENTRATE_PUMPS ]; ///< Flag indicates a request to park the pump. static OVERRIDE_F32_T pumpTargetSpeed[ NUM_OF_CONCENTRATE_PUMPS ]; ///< Target concentrate pumps' speed (mL/min). static OVERRIDE_U32_T pumpTargetRevCnt[ NUM_OF_CONCENTRATE_PUMPS ]; ///< Target concentrate pump revolution count static OVERRIDE_U32_T pumpMesauredRevCnt[ NUM_OF_CONCENTRATE_PUMPS ]; ///< Current measured concentrate pump revolution count static OVERRIDE_F32_T measuredPumpSpeed[ NUM_OF_CONCENTRATE_PUMPS ]; ///< Measured concentrate pump speed (mL/min). static OVERRIDE_U32_T parked[ NUM_OF_CONCENTRATE_PUMPS ]; ///< Concentrate pump is currently parked (T/F). static OVERRIDE_U32_T parkFaulted[ NUM_OF_CONCENTRATE_PUMPS ]; ///< Concentrate pump park command has faulted (T/F). static BOOL isDosingCompleted[ NUM_OF_CONCENTRATE_PUMPS ]; ///< Flag indicating dosing completed status (T/F). +static BOOL hasParkBeenRequested[ NUM_OF_CONCENTRATE_PUMPS ]; ///< Flag indicates a request to park the pump (T/F). //static DD_ACID_CONCENTRATES_RECORD_T acidConcentrateCalRecord; ///< Acid concentrate calibration record. //static DD_BICARB_CONCENTRATES_RECORD_T bicarbConcentrateCalRecord; ///< Bicarb concentrate calibration record. @@ -185,10 +185,6 @@ measuredPumpSpeed[ pumpId ].ovData = 0.0F; measuredPumpSpeed[ pumpId ].override = OVERRIDE_RESET; concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested = FALSE; - hasParkBeenRequested[ pumpId ].data = FALSE; - hasParkBeenRequested[ pumpId ].ovInitData = FALSE; - hasParkBeenRequested[ pumpId ].ovData = FALSE; - hasParkBeenRequested[ pumpId ].override = OVERRIDE_RESET; parked[ pumpId ].data = FALSE; parked[ pumpId ].ovInitData = FALSE; parked[ pumpId ].ovData = FALSE; @@ -214,6 +210,7 @@ concentratePumps[ pumpId ].isConcPumpParkInProgress = FALSE; stopConcentratePump( pumpId ); isDosingCompleted[ pumpId ] = FALSE; + hasParkBeenRequested[ pumpId ] = FALSE; } concentratePumpDataPublishInterval.data = CONCENTRATE_PUMP_DATA_PUBLISH_INTERVAL; @@ -516,7 +513,7 @@ if ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) { concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested = FALSE; - hasParkBeenRequested[ pumpId ].data = park; + hasParkBeenRequested[ pumpId ] = park; stopConcentratePump( pumpId ); concentratePumps[ pumpId ].execState = CONCENTRATE_PUMP_OFF_STATE; } @@ -720,7 +717,7 @@ if ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) { - result = (BOOL)getU32OverrideValue( &hasParkBeenRequested[ pumpId ] ); + result = hasParkBeenRequested[ pumpId ]; } else { @@ -847,7 +844,7 @@ { BOOL parkPump = getConcPumpParkRequest( pumpId ); - hasParkBeenRequested[ pumpId ].data = FALSE; // reset park request for next time + hasParkBeenRequested[ pumpId ] = FALSE; // reset park request for next time concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested = FALSE; // Just to make sure pump is in Off state. concentratePumps[ pumpId ].currentPumpSpeed = 0.0F; // set target rate to zero pumpTargetSpeed[ pumpId ].data = 0.0F; @@ -1470,46 +1467,31 @@ BOOL testConcentratePumpParkRequestOverride( MESSAGE_T *message ) { BOOL result = FALSE; - TEST_OVERRIDE_ARRAY_PAYLOAD_T override; - OVERRIDE_TYPE_T ovType = getOverrideArrayPayloadFromMessage( message, &override ); - // Verify tester has logged in with DD and override type is valid - if ( ( TRUE == isTestingActivated() ) && ( ovType != OVERRIDE_INVALID ) && ( ovType < NUM_OF_OVERRIDE_TYPES ) ) + // Verify tester has logged in with DD and payload length is valid + if ( ( TRUE == isTestingActivated() ) && ( sizeof( U32 ) == message->hdr.payloadLen ) ) { - U32 pumpId = override.index; + U32 pumpId; - // Verify concentrate pump index of override + memcpy( &pumpId, message->payload, sizeof(U32) ); + if ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) { - if ( OVERRIDE_OVERRIDE == ovType ) - { - U32 value = override.state.u32; + hasParkBeenRequested[ pumpId ] = TRUE; - hasParkBeenRequested[ pumpId ].ovData = value; - hasParkBeenRequested[ pumpId ].override = OVERRIDE_KEY; - - if ( TRUE == hasParkBeenRequested[ pumpId ].ovData ) - { - // If pump is running, stop it w/ park option - if ( TRUE == concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested ) - { - requestConcentratePumpOff( (CONCENTRATE_PUMPS_T)pumpId, TRUE ); - } - // If pump is already stopped, just send park command - else - { - stopConcentratePump( (CONCENTRATE_PUMPS_T)pumpId ); - } - } + // If pump is running, stop it w/ park option + if ( TRUE == concentratePumps[ pumpId ].hasTurnOnPumpsBeenRequested ) + { + requestConcentratePumpOff( (CONCENTRATE_PUMPS_T)pumpId, TRUE ); } + // If pump is already stopped, just send park command else { - hasParkBeenRequested[ pumpId ].override = OVERRIDE_RESET; - hasParkBeenRequested[ pumpId ].ovData = hasParkBeenRequested[ pumpId ].ovInitData; + stopConcentratePump( (CONCENTRATE_PUMPS_T)pumpId ); } - - result = TRUE; } + + result = TRUE; } return result;