Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -rf20a9bea362aeea79a6d57f0a9e7035162c39f7f -r5fef605363d4f8023b3db2989b097b6c5f58db1a --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision f20a9bea362aeea79a6d57f0a9e7035162c39f7f) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 5fef605363d4f8023b3db2989b097b6c5f58db1a) @@ -167,12 +167,16 @@ /// Interval (in ms) at which to publish syringe pump data to CAN bus. static OVERRIDE_U32_T syringePumpDataPublishInterval = { SYRINGE_PUMP_DATA_PUB_INTERVAL, SYRINGE_PUMP_DATA_PUB_INTERVAL, 0, 0 }; -static OVERRIDE_F32_T syringePumpMeasRate = {0.0, 0.0, 0.0, 0 }; ///< Measured rate for syringe pump (in mL/hr). -static OVERRIDE_F32_T syringePumpMeasForce = {0.0, 0.0, 0.0, 0 }; ///< Measured driver force (in V). -static OVERRIDE_F32_T syringePumpMeasSyringeDetectionSwitch = {0, 0, 0, 0 }; ///< Measured syringe detect switch (in V). -static OVERRIDE_F32_T syringePumpMeasHome = {0.0, 0.0, 0.0, 0 }; ///< Measured optical home (in V). -static OVERRIDE_S32_T syringePumpPosition = {0, 0, 0, 0 }; ///< Encoder based position (in steps). -static OVERRIDE_F32_T syringePumpVolumeDelivered = {0.0, 0.0, 0.0, 0 }; ///< Measured volume delivered (in mL). +static OVERRIDE_F32_T syringePumpMeasRate = { 0.0, 0.0, 0.0, 0 }; ///< Measured rate for syringe pump (in mL/hr). +static OVERRIDE_F32_T syringePumpMeasForce = { 0.0, 0.0, 0.0, 0 }; ///< Measured driver force (in V). +static OVERRIDE_F32_T syringePumpMeasSyringeDetectionSwitch = { 0, 0, 0, 0 }; ///< Measured syringe detect switch (in V). +static OVERRIDE_F32_T syringePumpMeasHome = { 0.0, 0.0, 0.0, 0 }; ///< Measured optical home (in V). +static OVERRIDE_S32_T syringePumpPosition = { 0, 0, 0, 0 }; ///< Encoder based position (in steps). +static OVERRIDE_F32_T syringePumpVolumeDelivered = { 0.0, 0.0, 0.0, 0 }; ///< Measured volume delivered (in mL). +static OVERRIDE_U32_T syringePumpStatus = {0, 0, 0, 0}; ///< Syringe pump status reported by FPGA. +static OVERRIDE_U32_T syringePumpEncoderStatus = {0, 0, 0, 0}; ///< Syringe pump encoder status reported by FPGA. +static OVERRIDE_U32_T syringePumpADCandDACStatus = {0, 0, 0, 0}; ///< Syringe pump ADC and DAC status reported by FPGA. +static OVERRIDE_U32_T syringePumpADCReadCtr = {0, 0, 0, 0}; ///< Syringe pump ADC read counter reported by FPGA. static F32 syringePumpSetRate; ///< Set rate for syringe pump (in mL/hr). static U32 syringePumpSetToggleTime; ///< Set rate for syringe pump (in uSec/toggle). @@ -212,6 +216,10 @@ static F32 getSyringePumpSyringeDetectorV( void ); static F32 getSyringePumpHomeDetectorV( void ); static F32 getSyringePumpForceV( void ); +static U08 getSyringePumpStatus( void ); +static U08 getSyringePumpEncoderStatus( void ); +static U08 getSyringePumpADCReadCounter( void ); +static U08 getSyringePumpADCandDACStatus( void ); static SYRINGE_PUMP_STATE_T handleSyringePumpInitState( void ); static SYRINGE_PUMP_STATE_T handleSyringePumpOffState( void ); static SYRINGE_PUMP_STATE_T handleSyringePumpRetractState( void ); @@ -719,6 +727,83 @@ /*********************************************************************//** * @brief + * The getSyringePumpForceV function gets the current syringe pump force. + * @details Inputs: syringePumpMeasForce + * @details Outputs: none + * @return the current syringe pump force (in V). + *************************************************************************/ +static U08 getSyringePumpStatus() +{ + U08 result = (U08)(syringePumpStatus.data & MASK_OFF_U32_MSBS); + + if ( OVERRIDE_KEY == syringePumpStatus.override ) + { + result = (U08)(syringePumpStatus.ovData & MASK_OFF_U32_MSBS); + } + + return result; +} + +/*********************************************************************//** + * @brief + * The getSyringePumpForceV function gets the current syringe pump force. + * @details Inputs: syringePumpMeasForce + * @details Outputs: none + * @return the current syringe pump force (in V). + *************************************************************************/ +static U08 getSyringePumpEncoderStatus() +{ + U08 result = (U08)(syringePumpEncoderStatus.data & MASK_OFF_U32_MSBS); + + if ( OVERRIDE_KEY == syringePumpEncoderStatus.override ) + { + result = (U08)(syringePumpEncoderStatus.ovData & MASK_OFF_U32_MSBS); + } + + return result; +} + +/*********************************************************************//** + * @brief + * The getSyringePumpForceV function gets the current syringe pump force. + * @details Inputs: syringePumpMeasForce + * @details Outputs: none + * @return the current syringe pump force (in V). + *************************************************************************/ +static U08 getSyringePumpADCReadCounter() +{ + U08 result = (U08)(syringePumpADCReadCtr.data & MASK_OFF_U32_MSBS); + + if ( OVERRIDE_KEY == syringePumpADCReadCtr.override ) + { + result = (U08)(syringePumpADCReadCtr.ovData & MASK_OFF_U32_MSBS); + } + + return result; +} + +/*********************************************************************//** + * @brief + * The getSyringePumpADCandDACStatus function gets the current syringe pump + * ADC and DAC status reported by the FPGA. + * @details Inputs: syringePumpADCandDACStatus + * @details Outputs: none + * @return the current syringe pump ADC and DAC status. + *************************************************************************/ +static U08 getSyringePumpADCandDACStatus() +{ + U08 result = (U08)(syringePumpADCandDACStatus.data & MASK_OFF_U32_MSBS); + + if ( OVERRIDE_KEY == syringePumpADCandDACStatus.override ) + { + result = (U08)(syringePumpADCandDACStatus.ovData & MASK_OFF_U32_MSBS); + } + + return result; +} + +/*********************************************************************//** + * @brief * The isSyringeDetected function determines whether a syringe is currently * detected. * @details Inputs: syringePumpMeasSyringeDetectionSwitch @@ -827,10 +912,13 @@ static void execSyringePumpMonitor( void ) { S32 encPosition = getFPGASyringePumpEncoderPosition(); - U08 pmpStatus = getFPGASyringePumpStatus(); - U08 encStatus = getFPGASyringePumpEncoderStatus(); - U08 adcReadCtr = getFPGASyringePumpADCReadCounter(); + // Get latest FPGA status + syringePumpStatus.data = (U32)getFPGASyringePumpStatus(); + syringePumpEncoderStatus.data = (U32)getFPGASyringePumpEncoderStatus(); + syringePumpADCandDACStatus.data = (U32)getFPGASyringePumpADCandDACStatus(); + syringePumpADCReadCtr.data = (U32)getFPGASyringePumpADCReadCounter(); + // Get latest ADC data and convert to V syringePumpMeasHome.data = ( (F32)getFPGASyringePumpADCChannel2() * SYRINGE_PUMP_ADC_REF_V ) / SYRINGE_PUMP_ADC_FULL_SCALE_BITS; syringePumpMeasSyringeDetectionSwitch.data = ( (F32)getFPGASyringePumpADCChannel1() * SYRINGE_PUMP_ADC_REF_V ) / SYRINGE_PUMP_ADC_FULL_SCALE_BITS; @@ -844,7 +932,7 @@ // Calculate measured rate (mL/hr) calcMeasRate(); // Get measured direction - syringePumpControllerMeasuredDirection = ( ( encStatus & SYRINGE_PUMP_ENCODER_DIRECTION_BIT ) != 0 ? MOTOR_DIR_REVERSE : MOTOR_DIR_FORWARD ); + syringePumpControllerMeasuredDirection = ( ( getSyringePumpEncoderStatus() & SYRINGE_PUMP_ENCODER_DIRECTION_BIT ) != 0 ? MOTOR_DIR_REVERSE : MOTOR_DIR_FORWARD ); // Calculate direction from encoder position relative to last syringePumpEncoderMeasuredDirection = ( getSyringePumpPosition() - syringePumpLastPosition >= 0 ? MOTOR_DIR_FORWARD : MOTOR_DIR_REVERSE ); @@ -863,17 +951,17 @@ { // Check ADC read is fresh (takes FPGA a while to configure ADC so don't check until after init/POST mode if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_SYRINGE_PUMP_ADC_ERROR, - ( ( getCurrentOperationMode() > MODE_INIT ) && ( lastSyringePumpADCReadCtr == adcReadCtr ) ) ) ) + ( ( getCurrentOperationMode() > MODE_INIT ) && ( lastSyringePumpADCReadCtr == getSyringePumpADCReadCounter() ) ) ) ) { activateAlarmNoData( ALARM_ID_HD_SYRINGE_PUMP_ADC_ERROR ); } - lastSyringePumpADCReadCtr = adcReadCtr; + lastSyringePumpADCReadCtr = getSyringePumpADCReadCounter(); // Check pump status - if ( pmpStatus != 0 ) + if ( getSyringePumpStatus() != 0 ) { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_SYRINGE_PUMP_FAULT, (U32)pmpStatus ); + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_SYRINGE_PUMP_FAULT, (U32)getSyringePumpStatus() ); } } } @@ -1136,9 +1224,6 @@ // Has syringe been removed? stopPump = checkSyringeRemoved( stopPump ); - // Check for occlusion - stopPump = checkOcclusionOrEmpty( stopPump ); - // Check max position > empty + 0.5 mL stopPump = checkMaxTravel( stopPump, SYRINGE_PUMP_EMPTY_POS + SYRINGE_PUMP_EMPTY_POS_MARGIN ); @@ -1309,10 +1394,10 @@ static SYRINGE_PUMP_STATE_T handleSyringePumpCalibrateForceSensorState( void ) { SYRINGE_PUMP_STATE_T result = SYRINGE_PUMP_CONFIG_FORCE_SENSOR_STATE; - U08 adcDACStatus= getFPGASyringePumpADCandDACStatus(); + U08 adcDACStatus= getSyringePumpADCandDACStatus(); // Wait for DAC setting write to EEPROM to complete - if ( ( getFPGASyringePumpADCandDACStatus() & SYRINGE_PUMP_ADC_DAC_ERROR_COUNT_DAC_WR_DONE ) != 0 ) + if ( ( adcDACStatus & SYRINGE_PUMP_ADC_DAC_ERROR_COUNT_DAC_WR_DONE ) != 0 ) { syringePumpDACVrefWriteInProgress = FALSE; // Switch back from DAC to ADC control @@ -1617,6 +1702,10 @@ data.heparinDeliveryState = (U32)heparinDeliveryState; data.syringePumpVolumeDelivered = getSyringePumpVolumeDelivered(); data.syringePumpSafetyVolume = syringePumpSafetyVolumeDelivered; + data.syringePumpStatus = ( (U32)getSyringePumpStatus() << SHIFT_24_BITS ) | + ( (U32)getSyringePumpEncoderStatus() << SHIFT_16_BITS_FOR_WORD_SHIFT ) | + ( (U32)getSyringePumpADCandDACStatus() << SHIFT_8_BITS_FOR_BYTE_SHIFT ) | + ( (U32)getSyringePumpADCReadCounter() ); broadcastSyringePumpData( data ); broadcastHeparinData( data.syringePumpVolumeDelivered ); @@ -2002,4 +2091,184 @@ return result; } +/*********************************************************************//** + * @brief + * The testSetSyringePumpStatus function overrides the syringe pump + * status. + * @details Inputs: none + * @details Outputs: syringePumpStatus + * @param status override syringe pump status with this value + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetSyringePumpStatus( U32 status ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + syringePumpStatus.ovData = status; + syringePumpStatus.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetSyringePumpStatus function resets the override of the + * syringe pump status. + * @details Inputs: none + * @details Outputs: syringePumpStatus + * @return TRUE if reset successful, FALSE if not + *************************************************************************/ +BOOL testResetSyringePumpStatus( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + syringePumpStatus.override = OVERRIDE_RESET; + syringePumpStatus.ovData = syringePumpStatus.ovInitData; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testSetSyringePumpEncoderStatus function overrides the syringe + * pump encoder status. + * @details Inputs: none + * @details Outputs: syringePumpEncoderStatus + * @param status override syringe pump encoder status with this value + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetSyringePumpEncoderStatus( U32 status ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + syringePumpEncoderStatus.ovData = status; + syringePumpEncoderStatus.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetSyringePumpEncoderStatus function resets the override + * of the syringe pump encoder status. + * @details Inputs: none + * @details Outputs: syringePumpEncoderStatus + * @return TRUE if reset successful, FALSE if not + *************************************************************************/ +BOOL testResetSyringePumpEncoderStatus( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + syringePumpEncoderStatus.override = OVERRIDE_RESET; + syringePumpEncoderStatus.ovData = syringePumpEncoderStatus.ovInitData; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testSetSyringePumpADCandDACStatus function overrides the syringe + * pump ADC and DAC status. + * @details Inputs: none + * @details Outputs: syringePumpADCandDACStatus + * @param status override syringe pump ADC and DAC status with this value + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetSyringePumpADCandDACStatus( U32 status ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + syringePumpADCandDACStatus.ovData = status; + syringePumpADCandDACStatus.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetSyringePumpADCandDACStatus function resets the override + * of the syringe pump ADC and DAC status. + * @details Inputs: none + * @details Outputs: syringePumpADCandDACStatus + * @return TRUE if reset successful, FALSE if not + *************************************************************************/ +BOOL testResetSyringePumpADCandDACStatus( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + syringePumpADCandDACStatus.override = OVERRIDE_RESET; + syringePumpADCandDACStatus.ovData = syringePumpADCandDACStatus.ovInitData; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testSetSyringePumpADCReadCounter function overrides the syringe + * pump ADC read counter. + * @details Inputs: none + * @details Outputs: syringePumpADCReadCtr + * @param ctr override syringe pump ADC read counter with this value + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetSyringePumpADCReadCounter( U32 ctr ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + syringePumpADCReadCtr.ovData = ctr; + syringePumpADCReadCtr.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetSyringePumpADCReadCounter function resets the override + * of the syringe pump ADC read counter. + * @details Inputs: none + * @details Outputs: syringePumpADCReadCtr + * @return TRUE if reset successful, FALSE if not + *************************************************************************/ +BOOL testResetSyringePumpADCReadCounter( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + syringePumpADCReadCtr.override = OVERRIDE_RESET; + syringePumpADCReadCtr.ovData = syringePumpADCReadCtr.ovInitData; + } + + return result; +} + /**@}*/ Index: firmware/App/Controllers/SyringePump.h =================================================================== diff -u -r8bb5474344cbef873941f2ac0d22962fdeda9d80 -r5fef605363d4f8023b3db2989b097b6c5f58db1a --- firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision 8bb5474344cbef873941f2ac0d22962fdeda9d80) +++ firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision 5fef605363d4f8023b3db2989b097b6c5f58db1a) @@ -65,6 +65,7 @@ F32 syringePumpMeasSwitch; F32 syringePumpMeasForce; F32 syringePumpSafetyVolume; + U32 syringePumpStatus; } SYRINGE_PUMP_DATA_PAYLOAD_T; // ********** public function prototypes ********** @@ -108,6 +109,14 @@ BOOL testResetSyringePumpMeasuredPositionOverride( void ); BOOL testSetSyringePumpMeasuredVolumeOverride( F32 value ); BOOL testResetSyringePumpMeasuredVolumeOverride( void ); +BOOL testSetSyringePumpStatus( U32 status ); +BOOL testResetSyringePumpStatus( void ); +BOOL testSetSyringePumpEncoderStatus( U32 status ); +BOOL testResetSyringePumpEncoderStatus( void ); +BOOL testSetSyringePumpADCandDACStatus( U32 status ); +BOOL testResetSyringePumpADCandDACStatus( void ); +BOOL testSetSyringePumpADCReadCounter( U32 ctr ); +BOOL testResetSyringePumpADCReadCounter( void ); /**@}*/ Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -re11a13817641163361996836c7ca8441cdbced87 -r5fef605363d4f8023b3db2989b097b6c5f58db1a --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision e11a13817641163361996836c7ca8441cdbced87) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 5fef605363d4f8023b3db2989b097b6c5f58db1a) @@ -37,7 +37,7 @@ /// Interval to control lamp and audio and to publish alarm status data. static const U32 ALARM_STATUS_PUBLISH_INTERVAL = ( ALARM_LAMP_AND_AUDIO_CONTROL_INTERVAL_MS / TASK_GENERAL_INTERVAL ); /// Interval (ms/task time) at which the alarm information is published on the CAN bus. -static const U32 ALARM_INFO_PUB_INTERVAL = ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ); +#define ALARM_INFO_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) #define ALARM_SILENCE_EXPIRES_IN_SECS (60) ///< Alarm silence expiration time in seconds. Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rd4e699aba5ad4e197ef97cba4bc6ebebf210d1b3 -r5fef605363d4f8023b3db2989b097b6c5f58db1a --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision d4e699aba5ad4e197ef97cba4bc6ebebf210d1b3) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 5fef605363d4f8023b3db2989b097b6c5f58db1a) @@ -1600,6 +1600,22 @@ handleTestAlarmBackupAudioCurrentOverrideRequest( message ); break; + case MSG_ID_HD_SYRINGE_PUMP_STATUS_OVERRIDE: + handleTestSyringePumpStatusOverrideRequest( message ); + break; + + case MSG_ID_HD_SYRINGE_PUMP_ENCODER_STATUS_OVERRIDE: + handleTestSyringePumpEncoderStatusOverrideRequest( message ); + break; + + case MSG_ID_HD_SYRINGE_PUMP_ADC_DAC_STATUS_OVERRIDE: + handleTestSyringePumpADCandDACStatusOverrideRequest( message ); + break; + + case MSG_ID_HD_SYRINGE_PUMP_ADC_READ_COUNTER_OVERRIDE: + handleTestSyringePumpADCReadCtrOverrideRequest( message ); + break; + default: // Unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r6d05f4b1484a9271d8cf3b529dbb7e5080e7c954 -r5fef605363d4f8023b3db2989b097b6c5f58db1a --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 6d05f4b1484a9271d8cf3b529dbb7e5080e7c954) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5fef605363d4f8023b3db2989b097b6c5f58db1a) @@ -5708,4 +5708,132 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The handleTestSyringePumpStatusOverrideRequest function handles a + * request to override the syringe pump status. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSyringePumpStatusOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetSyringePumpStatus( payload.state.u32 ); + } + else + { + result = testResetSyringePumpStatus(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestSyringePumpEncoderStatusOverrideRequest function handles a + * request to override the syringe pump encoder status. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSyringePumpEncoderStatusOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetSyringePumpEncoderStatus( payload.state.u32 ); + } + else + { + result = testResetSyringePumpEncoderStatus(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestSyringePumpADCandDACStatusOverrideRequest function handles a + * request to override the syringe pump ADC & DAC status. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSyringePumpADCandDACStatusOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetSyringePumpADCandDACStatus( payload.state.u32 ); + } + else + { + result = testResetSyringePumpADCandDACStatus(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestSyringePumpADCReadCtrOverrideRequest function handles a + * request to override the syringe pump ADC read counter. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestSyringePumpADCReadCtrOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof(TEST_OVERRIDE_PAYLOAD_T) ); + if ( FALSE == payload.reset ) + { + result = testSetSyringePumpADCReadCounter( payload.state.u32 ); + } + else + { + result = testResetSyringePumpADCReadCounter(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r1dbf106beb5d056601ee9f296e165d993d683ce0 -r5fef605363d4f8023b3db2989b097b6c5f58db1a --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 1dbf106beb5d056601ee9f296e165d993d683ce0) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 5fef605363d4f8023b3db2989b097b6c5f58db1a) @@ -632,6 +632,18 @@ // MSG_ID_HD_ALARM_BACKUP_AUDIO_CURRENT_OVERRIDE void handleTestAlarmBackupAudioCurrentOverrideRequest( MESSAGE_T *message ); +// MSG_ID_HD_SYRINGE_PUMP_STATUS_OVERRIDE +void handleTestSyringePumpStatusOverrideRequest( MESSAGE_T *message ); + +// MSG_ID_HD_SYRINGE_PUMP_ENCODER_STATUS_OVERRIDE +void handleTestSyringePumpEncoderStatusOverrideRequest( MESSAGE_T *message ); + +// MSG_ID_HD_SYRINGE_PUMP_ADC_DAC_STATUS_OVERRIDE +void handleTestSyringePumpADCandDACStatusOverrideRequest( MESSAGE_T *message ); + +// MSG_ID_HD_SYRINGE_PUMP_ADC_READ_COUNTER_OVERRIDE +void handleTestSyringePumpADCReadCtrOverrideRequest( MESSAGE_T *message ); + /**@}*/ #endif