Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -rba882c318a6bedb3abe2f1fa4656dedbf2c60d9e -r5a04a1445b684aedd199e0294311db468635c152 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision ba882c318a6bedb3abe2f1fa4656dedbf2c60d9e) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 5a04a1445b684aedd199e0294311db468635c152) @@ -343,7 +343,7 @@ * position. * @details Inputs: valveAirTrapStatus * @details Outputs: valveAirTrapStatus - * @param: state enumeration of open or close for valve + * @param state enumeration of open or close for valve * @return: none *************************************************************************/ void setValveAirTrap( OPN_CLS_STATE_T state ) @@ -1336,6 +1336,7 @@ * TEST SUPPORT FUNCTIONS *************************************************************************/ + /*********************************************************************//** * @brief * The testSetValvesDataPublishInterval function overrides the valves data Index: firmware/App/Controllers/Valves.h =================================================================== diff -u -ra4f5ed3748870d287a4c2c6fcc003fc4d3b9233f -r5a04a1445b684aedd199e0294311db468635c152 --- firmware/App/Controllers/Valves.h (.../Valves.h) (revision a4f5ed3748870d287a4c2c6fcc003fc4d3b9233f) +++ firmware/App/Controllers/Valves.h (.../Valves.h) (revision 5a04a1445b684aedd199e0294311db468635c152) @@ -8,7 +8,8 @@ /** * @defgroup Valves Valves * @brief Valves module - * Driver that runs the valves in HD. + * Driver that runs the valves in HD. The driver can home the valves + * as well as setting a position. * * @addtogroup Valves * @{ @@ -50,8 +51,10 @@ S16 posA; ///< Calculated Position A S16 posB; ///< Calculated Position B U32 pwm; ///< Valve PWM in the bypass mode + U32 airTrapValve; ///< Air trap valve status } HD_VALVE_DATA_T; +#pragma pack(pop) /// HD valves PWM override payload typedef struct @@ -62,17 +65,6 @@ U32 direction; ///< Valve direction } OVERRIDE_VALVES_PWM_DIR_SET_PAYLOAD_T; -// TODO REMOVE the struct -typedef struct -{ - S16 currentPos; - F32 current; - S16 cmdPosition; -} HD_VALVE_FAST_DATA_T; -#pragma pack(pop) -HD_VALVE_FAST_DATA_T fastDataRemoveLater; -// TODO REMOVE THE struct - // ********** public function prototypes ********* void initValves( void ); @@ -81,14 +73,16 @@ void execValves( void ); -void homeValve( VALVE_T valve ); +BOOL homeValve( VALVE_T valve ); BOOL setValvePosition( VALVE_T valve, VALVE_POSITION_T position ); VALVE_POSITION_T getValvePosition( VALVE_T valve ); void setValveAirTrap( OPN_CLS_STATE_T state ); +OPN_CLS_STATE_T getValveAirTrapStatus( void ); + BOOL testSetValvesDataPublishInterval( U32 value ); BOOL testResetValvesDataPublishInterval( void ); Index: firmware/App/HDCommon.h =================================================================== diff -u -rd286dd58ea2a68b9f92be9312e83034b4a4a44da -r5a04a1445b684aedd199e0294311db468635c152 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision d286dd58ea2a68b9f92be9312e83034b4a4a44da) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 5a04a1445b684aedd199e0294311db468635c152) @@ -23,16 +23,16 @@ // ********** version ********** #define HD_VERSION_MAJOR 0 -#define HD_VERSION_MINOR 3 -#define HD_VERSION_MICRO 4 -#define HD_VERSION_BUILD 556 +#define HD_VERSION_MINOR 4 +#define HD_VERSION_MICRO 5 +#define HD_VERSION_BUILD 0 // ********** development build switches ********** #ifndef _RELEASE_ -#define UF_TEST_ENABLED 1 // ultrafiltration test build (hard codes treatment params, re-purposes off/stop buttons) -#define UF_TEST_WITH_DG 1 // ultrafiltration test build (sets up DG in standby mode) #ifndef _VECTORCAST_ +// #define RUN_WITHOUT_DG 1 // run HD w/o DG +// #define DISABLE_UI_TREATMENT_WORKFLOW 1 // disable UI treatment workflow // #define RM46_EVAL_BOARD_TARGET 1 // limited build runs on RM46 eval board // #define BREADBOARD_TARGET 1 // old breadboard system build - no longer used? #define SIMULATE_UI 1 // build w/o requirement that UI be there @@ -48,12 +48,13 @@ #define DISABLE_PUMP_FLOW_CHECKS 1 // do not error on HD pump flow checks #define DISABLE_PUMP_SPEED_CHECKS 1 // do not error on HD pump speed checks #define DISABLE_PUMP_DIRECTION_CHECKS 1 // do not error on HD pump direction checks + #define DISABLE_SALINE_BOLUS_CHECKS 1 // do not error on HD saline bolus checks #define DISABLE_PRESSURE_CHECKS 1 // do not error on HD pressure checks #define DISABLE_UF_ALARMS 1 // do not error on HD ultrafiltration checks - #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) + #define DISABLE_VALVE_ALARMS 1 // do not error on HD valve position +// #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) // #define RAW_FLOW_SENSOR_DATA 1 // test build will not filter flow sensor data // #define READ_FPGA_ASYNC_DATA 1 // test build reads non-priority register page every other time -// #define FLOW_DEBUG 1 // test build sends flow, signal strength, and occlusion readings to debug UART // #define EMC_TEST_BUILD 1 // EMC test build - HD/DG run separately but connected, HD pumps toggle on/off w/ stop button #define ALARMS_DEBUG 1 // triggered alarms sent to debug UART Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -r2acda0ccdd00334bec87bfbe61c4e78e867925de -r5a04a1445b684aedd199e0294311db468635c152 --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 2acda0ccdd00334bec87bfbe61c4e78e867925de) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 5a04a1445b684aedd199e0294311db468635c152) @@ -195,8 +195,12 @@ SW_FAULT_ID_PERSISTENT_ALARM_INVALID_INDEX, SW_FAULT_ID_HD_VALVES_INVALID_SELF_TEST_STATE, SW_FAULT_ID_HD_VALVES_INVALID_EXEC_STATE, - SW_FAULT_ID_AIR_TRAP_INVALID_STATE, // 85 - SW_FAULT_ID_AIR_TRAP_INVALID_LEVEL_SENSOR, + SW_FAULT_ID_HD_VALVES_INVALID_VALVE_SELECTED, // 85 + SW_FAULT_ID_HD_VALVES_INVALID_AIR_TRAP_REQUEST, + SW_FAULT_ID_HD_VALVES_INVALID_CONTROL_MODE_SELECTED, + SW_FAULT_ID_HD_VAVLES_INVALID_POSITION_SELECTED, + SW_FAULT_ID_AIR_TRAP_INVALID_STATE, + SW_FAULT_ID_AIR_TRAP_INVALID_LEVEL_SENSOR, // 90 SW_FAULT_ID_DIALYSIS_INVALID_SALINE_BOLUS_STATE, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r39bff5f9647203d9eb86e18048728057dc68b4eb -r5a04a1445b684aedd199e0294311db468635c152 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 39bff5f9647203d9eb86e18048728057dc68b4eb) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 5a04a1445b684aedd199e0294311db468635c152) @@ -78,6 +78,9 @@ #define FPGA_ADC1_AUTO_READ_ENABLE 0x01 ///< Auto-read enable bit for ADC1 control register. +#define FPGA_AIRTRAP_LEVEL_LOW_MASK 0x0008 ///< Bit mask for air trap lower level sensor. +#define FPGA_AIRTRAP_LEVEL_HIGH_MASK 0x0004 ///< Bit mask for air trap upper level sensor. + // FPGA Sensors Record #pragma pack(push,1) /// Record structure for FPGA header read. @@ -286,9 +289,8 @@ /*********************************************************************//** * @brief * The initFPGA function initializes the FPGA module. - * @details - * Inputs : none - * Outputs : FPGA module initialized. + * @details Inputs: none + * @details Outputs: FPGA module initialized. * @return none *************************************************************************/ void initFPGA( void ) @@ -397,9 +399,8 @@ * @brief * The resetFPGACommFlags function resets the various fpga comm flags and * counters. - * @details - * Inputs : none - * Outputs : fpga comm flags & counters reset + * @details Inputs: none + * @details Outputs: fpga comm flags & counters reset * @return none *************************************************************************/ static void resetFPGACommFlags( void ) @@ -417,9 +418,8 @@ * @brief * The signalFPGAReceiptCompleted function increments a counter to indicate * that another DMA receipt from the FPGA has completed. - * @details - * Inputs : none - * Outputs : fpgaReceiptCounter + * @details Inputs: none + * @details Outputs: fpgaReceiptCounter * @return none *************************************************************************/ void signalFPGAReceiptCompleted( void ) @@ -452,9 +452,8 @@ * @brief * The signalFPGATransmitCompleted function increments a counter to indicate * that another DMA transmit to the FPGA has completed. - * @details - * Inputs : none - * Outputs : fpgaReceiptCounter + * @details Inputs: none + * @details Outputs: fpgaReceiptCounter * @return none *************************************************************************/ void signalFPGATransmitCompleted( void ) @@ -465,9 +464,8 @@ /*********************************************************************//** * @brief * The execFPGA function manages incoming data exchanges with the FPGA. - * @details - * Inputs : fpgaState - * Outputs : fpgaState + * @details Inputs: fpgaState + * @details Outputs: fpgaState * @return none *************************************************************************/ void execFPGAIn( void ) @@ -524,9 +522,8 @@ /*********************************************************************//** * @brief * The execFPGAOut function manages outgoing data exchanges with the FPGA. - * @details - * Inputs : fpgaState - * Outputs : fpgaState + * @details Inputs: fpgaState + * @details Outputs: fpgaState * @return none *************************************************************************/ void execFPGAOut( void ) @@ -571,9 +568,8 @@ * @brief * The handleFPGAReadHeaderState function handles the FPGA state where * the read header registers command is sent to the FPGA. - * @details - * Inputs : none - * Outputs : read command sent to FPGA + * @details Inputs: none + * @details Outputs: read command sent to FPGA * @return next FPGA state *************************************************************************/ static FPGA_STATE_T handleFPGAReadHeaderState( void ) @@ -603,9 +599,8 @@ * @brief * The handleFPGAReceiveHeaderState function handles the FPGA state * where the header registers read response should be ready to take in. - * @details - * Inputs : none - * Outputs : header register values updated + * @details Inputs: none + * @details Outputs: header register values updated * @return next FPGA state *************************************************************************/ static FPGA_STATE_T handleFPGAReceiveHeaderState( void ) @@ -655,9 +650,8 @@ * @brief * The handleFPGAWriteAllActuatorsState function handles the FPGA state * where the bulk write command is sent to the FPGA. - * @details - * Inputs : actuator set points - * Outputs : actuator set points sent to FPGA + * @details Inputs: actuator set points + * @details Outputs: actuator set points sent to FPGA * @return next FPGA state *************************************************************************/ static FPGA_STATE_T handleFPGAWriteAllActuatorsState( void ) @@ -704,9 +698,8 @@ * @brief * The handleFPGAReceiveAllSensorsState function handles the FPGA state * where the bulk read response should be ready to parse. - * @details - * Inputs : none - * Outputs : sensor values updated + * @details Inputs: none + * @details Outputs: sensor values updated * @return next FPGA state *************************************************************************/ static FPGA_STATE_T handleFPGAReceiveAllSensorsState( void ) @@ -767,9 +760,8 @@ * @brief * The handleFPGAReadAllSensorsAsyncState function handles the FPGA state where * the read async sensors command is sent to the FPGA. - * @details - * Inputs : none - * Outputs : read async sensors command sent to FPGA + * @details Inputs: none + * @details Outputs: read async sensors command sent to FPGA * @return next FPGA state *************************************************************************/ static FPGA_STATE_T handleFPGAReadAllSensorsAsyncState( void ) @@ -799,9 +791,8 @@ * @brief * The handleFPGAReceiveAllSensorsAsyncState function handles the FPGA state * where the bulk async read response should be ready to parse. - * @details - * Inputs : none - * Outputs : async sensor values updated + * @details Inputs: none + * @details Outputs: async sensor values updated * @return next FPGA state *************************************************************************/ static FPGA_STATE_T handleFPGAReceiveAllSensorsAsyncState( void ) @@ -851,9 +842,8 @@ /*********************************************************************//** * @brief * The execFPGATest function executes the FPGA self-test. - * @details - * Inputs : fpgaHeader - * Outputs : none + * @details Inputs: fpgaHeader + * @details Outputs: none * @return passed, or failed *************************************************************************/ SELF_TEST_STATUS_T execFPGATest( void ) @@ -880,11 +870,30 @@ /*********************************************************************//** * @brief + * The consumeUnexpectedData function checks to see if a byte is sitting in + * the SCI2 received data register. + * @details Inputs: fpgaHeader + * @details Outputs: none + * @return fpgaDiag + *************************************************************************/ +static void consumeUnexpectedData( void ) +{ + // clear any errors + sciRxError( scilinREG ); + + // if a byte is pending read, read it + if ( sciIsRxReady( scilinREG ) != 0 ) + { + sciReceiveByte( scilinREG ); + } +} + +/*********************************************************************//** + * @brief * The setupDMAForWriteCmd function sets the byte count for the next DMA * write command to the FPGA. - * @details - * Inputs : none - * Outputs : number of bytes for next FPGA write command is set + * @details Inputs: none + * @details Outputs: number of bytes for next FPGA write command is set * @param bytes2Transmit number of bytes to be transmitted via DMA to the FPGA * @return none *************************************************************************/ @@ -905,9 +914,8 @@ * @brief * The startDMAWriteCmd function initiates the DMA transmit for the next * DMA write command to the FPGA. - * @details - * Inputs : none - * Outputs : DMA write command to FPGA is initiated + * @details Inputs: none + * @details Outputs: DMA write command to FPGA is initiated * @return none *************************************************************************/ static void startDMAWriteCmd( void ) @@ -921,9 +929,8 @@ * @brief * The setupDMAForWriteResp function sets the expected byte count for the * next DMA write command response from the FPGA. - * @details - * Inputs : none - * Outputs : number of expected bytes for next FPGA write command response is set + * @details Inputs: none + * @details Outputs: number of expected bytes for next FPGA write command response is set * @param bytes2Receive number of bytes expected to be transmitted via DMA from the FPGA * @return none *************************************************************************/ @@ -944,9 +951,8 @@ * @brief * The startDMAReceiptOfWriteResp function initiates readiness of the DMA * receiver for the next DMA write command response from the FPGA. - * @details - * Inputs : none - * Outputs : DMA write command response is ready to be received from the FPGA + * @details Inputs: none + * @details Outputs: DMA write command response is ready to be received from the FPGA * @return none *************************************************************************/ static void startDMAReceiptOfWriteResp( void ) @@ -960,9 +966,8 @@ * @brief * The setupDMAForReadCmd function sets the byte count for the next DMA * read command to the FPGA. - * @details - * Inputs : none - * Outputs : number of bytes for next FPGA read command is set + * @details Inputs: none + * @details Outputs: number of bytes for next FPGA read command is set * @param bytes2Transmit number of bytes to be transmitted via DMA to the FPGA * @return none *************************************************************************/ @@ -983,9 +988,8 @@ * @brief * The startDMAReadCmd function initiates the DMA transmit for the next * DMA read command to the FPGA. - * @details - * Inputs : none - * Outputs : DMA read command to FPGA is initiated + * @details Inputs: none + * @details Outputs: DMA read command to FPGA is initiated * @return none *************************************************************************/ static void startDMAReadCmd( void ) @@ -999,9 +1003,8 @@ * @brief * The setupDMAForReadResp function sets the expected byte count for the * next DMA read command response from the FPGA. - * @details - * Inputs : none - * Outputs : number of expected bytes for next FPGA read command response is set + * @details Inputs: none + * @details Outputs: number of expected bytes for next FPGA read command response is set * @param bytes2Receive number of expected bytes to be transmitted via DMA from the FPGA * @return none *************************************************************************/ @@ -1022,9 +1025,8 @@ * @brief * The startDMAReceiptOfReadResp function initiates readiness of the DMA * receiver for the next DMA read command response from the FPGA. - * @details - * Inputs : none - * Outputs : DMA read command response is ready to be received from the FPGA + * @details Inputs: none + * @details Outputs: DMA read command response is ready to be received from the FPGA * @return none *************************************************************************/ static void startDMAReceiptOfReadResp( void ) @@ -1037,9 +1039,8 @@ /*********************************************************************//** * @brief * The getFPGAVersions function gets the fpga version numbers. - * @details - * Inputs : fpgaHeader - * Outputs : none + * @details Inputs: fpgaHeader + * @details Outputs: none * @return none *************************************************************************/ void getFPGAVersions( U08 *Id, U08 *Maj, U08 *Min, U08 *Lab ) @@ -1054,9 +1055,8 @@ * @brief * The getFPGABloodFlowSignalStrength function gets the latest blood flow * signal strength reading. - * @details - * Inputs : fpgaSensorReadings2 - * Outputs : none + * @details Inputs: fpgaSensorReadings2 + * @details Outputs: none * @return last blood flow signal strength reading *************************************************************************/ F32 getFPGABloodFlowSignalStrength( void ) @@ -1068,9 +1068,8 @@ * @brief * The getFPGADialysateFlowSignalStrength function gets the latest dialysate * flow signal strength reading. - * @details - * Inputs : fpgaSensorReadings2 - * Outputs : none + * @details Inputs: fpgaSensorReadings2 + * @details Outputs: none * @return last dialysate flow signal strength reading *************************************************************************/ F32 getFPGADialysateFlowSignalStrength( void ) @@ -1081,9 +1080,8 @@ /*********************************************************************//** * @brief * The getFPGABloodFlow function gets the latest blood flow reading. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last blood flow reading *************************************************************************/ F32 getFPGABloodFlow( void ) @@ -1094,9 +1092,8 @@ /*********************************************************************//** * @brief * The getFPGADialysateFlow function gets the latest dialysate flow reading. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last dialysate flow reading *************************************************************************/ F32 getFPGADialysateFlow( void ) @@ -1111,9 +1108,8 @@ * counting up, indicates motor is running in forward direction. If counter is * counting down, indicates motor is running in reverse direction. Counter will * wrap at 0/65535. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last blood pump hall sensor count reading. *************************************************************************/ U16 getFPGABloodPumpHallSensorCount( void ) @@ -1128,9 +1124,8 @@ * Bit 0 - Derived direction of the blood pump motor (0=Fwd, 1=Rev) * Bit 1 - A direction error was detected in the current hall sensor phase * Bit 2 - A direction error was detected since the last read of this register - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last blood pump hall sensor status reading. *************************************************************************/ U08 getFPGABloodPumpHallSensorStatus( void ) @@ -1145,9 +1140,8 @@ * counting up, indicates motor is running in forward direction. If counter is * counting down, indicates motor is running in reverse direction. Counter will * wrap at 0/65535. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last dialysate inlet pump hall sensor count reading. *************************************************************************/ U16 getFPGADialInPumpHallSensorCount( void ) @@ -1162,9 +1156,8 @@ * Bit 0 - Derived direction of the dialyste inlet pump motor (0=Fwd, 1=Rev) * Bit 1 - A direction error was detected in the current hall sensor phase * Bit 2 - A direction error was detected since the last read of this register - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last dialysate inlet pump hall sensor status reading. *************************************************************************/ U08 getFPGADialInPumpHallSensorStatus( void ) @@ -1179,9 +1172,8 @@ * counting up, indicates motor is running in forward direction. If counter is * counting down, indicates motor is running in reverse direction. Counter will * wrap at 0/65535. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last dialysate outlet pump hall sensor count reading. *************************************************************************/ U16 getFPGADialOutPumpHallSensorCount( void ) @@ -1196,9 +1188,8 @@ * Bit 0 - Derived direction of the dialysate outlet pump motor (0=Fwd, 1=Rev) * Bit 1 - A direction error was detected in the current hall sensor phase * Bit 2 - A direction error was detected since the last read of this register - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last dialysate outlet pump hall sensor status reading. *************************************************************************/ U08 getFPGADialOutPumpHallSensorStatus( void ) @@ -1209,9 +1200,8 @@ /*********************************************************************//** * @brief * The getFPGABloodPumpOcclusion function gets the latest blood occlusion reading. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last blood occlusion reading *************************************************************************/ U16 getFPGABloodPumpOcclusion( void ) @@ -1223,9 +1213,8 @@ * @brief * The getFPGADialInPumpOcclusion function gets the latest dialysate * inlet occlusion reading. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last dialysate inlet occlusion reading *************************************************************************/ U16 getFPGADialInPumpOcclusion( void ) @@ -1237,9 +1226,8 @@ * @brief * The getFPGADialOutPumpOcclusion function gets the latest dialysate * outlet occlusion reading. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last dialysate outlet occlusion reading *************************************************************************/ U16 getFPGADialOutPumpOcclusion( void ) @@ -1250,9 +1238,8 @@ /*********************************************************************//** * @brief * The getFPGAArterialPressure function gets the latest arterial pressure reading. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last arterial pressure reading *************************************************************************/ S32 getFPGAArterialPressure( void ) @@ -1263,9 +1250,8 @@ /*********************************************************************//** * @brief * The getFPGAVenousPressure function gets the venous arterial pressure reading. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @return last venous pressure reading *************************************************************************/ U16 getFPGAVenousPressure( void ) @@ -1278,9 +1264,8 @@ * @brief * The getFPGAAccelAxes function gets the accelerometer axis readings. * Axis readings are in ADC counts. 0.004 g per LSB. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @param x Populate this param with X axis reading * @param y Populate this param with Y axis reading * @param z Populate this param with Z axis reading @@ -1298,9 +1283,8 @@ * The getFPGAAccelMaxes function gets the maximum accelerometer axis readings. * from last FPGA read (every 10ms). * Axis readings are in ADC counts. 0.004 g per LSB. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @param x Populate this param with maximum X axis reading * @param y Populate this param with maximum Y axis reading * @param z Populate this param with maximum Z axis reading @@ -1317,9 +1301,8 @@ * @brief * The getFPGAAccelStatus function gets the accelerometer reading count * and error register values. - * @details - * Inputs : fpgaSensorReadings - * Outputs : none + * @details Inputs: fpgaSensorReadings + * @details Outputs: none * @param cnt Populate this param with latest sample counter value * @param err Populate this param with latest error * @return none @@ -1652,20 +1635,18 @@ * @brief * The consumeUnexpectedData function checks to see if a byte is sitting in * the SCI2 received data register. - * @details - * Inputs : fpgaHeader - * Outputs : none + * @details Inputs: fpgaHeader + * @details Outputs: none * @return fpgaDiag *************************************************************************/ -static void consumeUnexpectedData( void ) +void getFPGAAirTrapLevels( BOOL *airAtLower, BOOL *airAtUpper ) { - // clear any errors - sciRxError( scilinREG ); - // if a byte is pending read, read it - if ( sciIsRxReady( scilinREG ) != 0 ) - { - sciReceiveByte( scilinREG ); - } + U16 fpgaGPIO = fpgaSensorReadings.fpgaGPIO; + U16 lower = fpgaGPIO & FPGA_AIRTRAP_LEVEL_LOW_MASK; + U16 upper = fpgaGPIO & FPGA_AIRTRAP_LEVEL_HIGH_MASK; + + *airAtLower = ( 0 == lower ? FALSE : TRUE ); + *airAtUpper = ( 0 == upper ? FALSE : TRUE ); } /**@}*/ Index: firmware/App/Services/FPGA.h =================================================================== diff -u -ra4f5ed3748870d287a4c2c6fcc003fc4d3b9233f -r5a04a1445b684aedd199e0294311db468635c152 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision a4f5ed3748870d287a4c2c6fcc003fc4d3b9233f) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 5a04a1445b684aedd199e0294311db468635c152) @@ -89,18 +89,18 @@ S16 getFPGAValveBloodArterialPosition( void ); U16 getFPGAValveBloodArterialCurrentCounts( void ); -// The PWM functions only used during debugging +// The PWM functions are only used during debugging #ifdef DEBUG_ENABLED - void setFPGAValveDialyzerInletPWM( U16 count ); - U16 getFPGAValveDialyzerInletPWM( void ); - void setFPGAValveDialyzerOutletPWM( U16 count ); - U16 getFPGAValveDialyzerOutletPWM( void ); - void setFPGAValveBloodVenousPWM( U16 count ); - U16 getFPGAValveBloodVenousPWM( void ); - void setFPGAValveBloodArterialPWM( U16 count ); - U16 getFPGAValveBloodArterialPWM( void ); +void setFPGAValveDialyzerInletPWM( U16 count ); +U16 getFPGAValveDialyzerInletPWM( void ); +void setFPGAValveDialyzerOutletPWM( U16 count ); +U16 getFPGAValveDialyzerOutletPWM( void ); +void setFPGAValveBloodVenousPWM( U16 count ); +U16 getFPGAValveBloodVenousPWM( void ); +void setFPGAValveBloodArterialPWM( U16 count ); +U16 getFPGAValveBloodArterialPWM( void ); #endif -/**@}*/ - -#endif +/**@}*/ + +#endif Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r1fb58baf6e7e3d1f054b2a3634e233da7609dad9 -r5a04a1445b684aedd199e0294311db468635c152 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 1fb58baf6e7e3d1f054b2a3634e233da7609dad9) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 5a04a1445b684aedd199e0294311db468635c152) @@ -1158,6 +1158,10 @@ case MSG_ID_USER_UF_SETTINGS_CHANGE_REQUEST: handleChangeUFSettingsRequest( message ); + break; + + case MSG_ID_USER_SALINE_BOLUS_REQUEST: + handleSalineBolusRequest( message ); break; case MSG_ID_USER_CONFIRM_UF_SETTINGS_CHANGE: @@ -1432,6 +1436,26 @@ handleTestSetTreatmentParameter( message ); break; + case MSG_ID_BLOOD_FLOW_SIG_STRENGTH_OVERRIDE: + handleTestBloodFlowSignalStrengthOverrideRequest( message ); + break; + + case MSG_ID_DIAL_IN_FLOW_SIG_STRENGTH_OVERRIDE: + handleTestDialInFlowSignalStrengthOverrideRequest( message ); + break; + + case MSG_ID_BLOOD_PUMP_HOME_CMD: + handleTestBloodPumpHomeRequest( message ); + break; + + case MSG_ID_DIAL_IN_PUMP_HOME_CMD: + handleTestDialInPumpHomeRequest( message ); + break; + + case MSG_ID_DIAL_OUT_PUMP_HOME_CMD: + handleTestDialOutPumpHomeRequest( message ); + break; + default: // TODO - unrecognized message ID received - ignore break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r39bff5f9647203d9eb86e18048728057dc68b4eb -r5a04a1445b684aedd199e0294311db468635c152 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 39bff5f9647203d9eb86e18048728057dc68b4eb) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5a04a1445b684aedd199e0294311db468635c152) @@ -19,24 +19,21 @@ #include "Accel.h" #include "AlarmLamp.h" -#include "BloodFlow.h" #include "Buttons.h" #include "DGInterface.h" -#include "DialInFlow.h" -#include "Dialysis.h" #include "FPGA.h" #include "MessagePayloads.h" #include "ModeStandby.h" #include "ModeTreatment.h" #include "ModeTreatmentParams.h" #include "PresOccl.h" +#include "RTC.h" #include "SafetyShutdown.h" #include "SystemComm.h" #include "SystemCommMessages.h" #include "Utilities.h" #include "Valves.h" #include "WatchdogMgmt.h" -#include "RTC.h" /** * @addtogroup SystemCommMessages @@ -288,8 +285,8 @@ result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); return result; -} - +} + /*********************************************************************//** * @brief * The sendChangeUFSettingsResponse function constructs a UF change settings @@ -823,37 +820,22 @@ * @details * Inputs : none * Outputs : blood flow data msg constructed and queued. - * @param flowStPt Current set point for blood flow - * @param measFlow Latest measured blood flow - * @param measRotorSpd Latest measured blood pump rotoro speed - * @param measSpd Latest measured blood pump speed - * @param measMCspd Latest measured blood pump motor controller speed - * @param measSpd Latest measured blood pump motor controller current - * @param pwmDC Latest PWM duty cycle % + * @param bloodData blood pump and flow data record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastBloodFlowData( U32 flowStPt, F32 measFlow, F32 measRotorSpd, F32 measSpd, F32 measMCSpd, F32 measMCCurr, F32 pwmDC ) +BOOL broadcastBloodFlowData( BLOOD_PUMP_STATUS_PAYLOAD_T bloodData ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; - PERISTALTIC_PUMP_STATUS_PAYLOAD_T payload; // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_BLOOD_FLOW_DATA; - msg.hdr.payloadLen = sizeof( PERISTALTIC_PUMP_STATUS_PAYLOAD_T ); + msg.hdr.payloadLen = sizeof( BLOOD_PUMP_STATUS_PAYLOAD_T ); - payload.setPoint = flowStPt; - payload.measFlow = measFlow; - payload.measRotorSpd = measRotorSpd; - payload.measPumpSpd = measSpd; - payload.measMCSpd = measMCSpd; - payload.measMCCurr = measMCCurr; - payload.pwmDC = pwmDC; + memcpy( payloadPtr, &bloodData, sizeof( BLOOD_PUMP_STATUS_PAYLOAD_T ) ); - memcpy( payloadPtr, &payload, sizeof( PERISTALTIC_PUMP_STATUS_PAYLOAD_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); @@ -867,37 +849,22 @@ * @details * Inputs : none * Outputs : dialysate flow data msg constructed and queued. - * @param flowStPt Current set point for dialysate flow - * @param measFlow Latest measured dialysate flow - * @param measRotorSpd Latest measured dialysate pump rotor speed - * @param measSpd Latest measured dialysate pump speed - * @param measMCspd Latest measured dialysate pump motor controller speed - * @param measSpd Latest measured dialysate pump motor controller current - * @param pwmDC Latest PWM duty cycle % + * @param dialInData Dialysate inlet pump and flow data record * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastDialInFlowData( U32 flowStPt, F32 measFlow, F32 measRotorSpd, F32 measSpd, F32 measMCSpd, F32 measMCCurr, F32 pwmDC ) +BOOL broadcastDialInFlowData( DIALIN_PUMP_STATUS_PAYLOAD_T dialInData ) { BOOL result; MESSAGE_T msg; U08 *payloadPtr = msg.payload; - PERISTALTIC_PUMP_STATUS_PAYLOAD_T payload; // create a message record blankMessage( &msg ); msg.hdr.msgID = MSG_ID_DIALYSATE_FLOW_DATA; - msg.hdr.payloadLen = sizeof( PERISTALTIC_PUMP_STATUS_PAYLOAD_T ); + msg.hdr.payloadLen = sizeof( DIALIN_PUMP_STATUS_PAYLOAD_T ); - payload.setPoint = flowStPt; - payload.measFlow = measFlow; - payload.measRotorSpd = measRotorSpd; - payload.measPumpSpd = measSpd; - payload.measMCSpd = measMCSpd; - payload.measMCCurr = measMCCurr; - payload.pwmDC = pwmDC; + memcpy( payloadPtr, &dialInData, sizeof( DIALIN_PUMP_STATUS_PAYLOAD_T ) ); - memcpy( payloadPtr, &payload, sizeof( PERISTALTIC_PUMP_STATUS_PAYLOAD_T ) ); - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); @@ -1158,6 +1125,33 @@ return result; } +/***********************************************************************//** + * @brief + * The broadcastSalineBolusData function constructs a saline bolus data msg to + * be broadcast and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: saline bolus data msg constructed and queued + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastSalineBolusData( SALINE_BOLUS_DATA_PAYLOAD_T data ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_SALINE_BOLUS_DATA; + msg.hdr.payloadLen = sizeof( SALINE_BOLUS_DATA_PAYLOAD_T ); + + memcpy( payloadPtr, &data, sizeof( SALINE_BOLUS_DATA_PAYLOAD_T ) ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + #ifdef EMC_TEST_BUILD BOOL broadcastCANErrorCount( U32 count ) { @@ -1461,6 +1455,38 @@ /*********************************************************************//** * @brief + * The sendUFPauseResumeResponse function constructs a UF pause/resume + * response to the UI and queues the msg for transmit on the appropriate CAN + * channel. + * @details Inputs: none + * @details Outputs: UF pause/resume response msg constructed and queued. + * @param accepted was pause/resume request accepted + * @param reason reason rejected (if not accepted) + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendUFPauseResumeResponse( BOOL accepted, U32 reason ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_USER_UF_PAUSE_RESUME_RESPONSE; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + + memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &reason, sizeof( U32) ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief * The handleUIStartTreatmentMsg function handles a treatment start/cancel * message from the UI. * @details @@ -1636,12 +1662,12 @@ * @details * Inputs : none * Outputs : Treatment parameters response msg constructed and queued. - * @param accepted T/F - are settings ok? + * @param rejected T/F - are settings rejected? * @param rejectReasons reasons each parameter was rejected (if not accepted) * @param byteLength number of bytes that array of reject reasons takes * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL sendTreatmentParametersResponseMsg( BOOL accepted, U08 *rejectReasons, U32 byteLength ) +BOOL sendTreatmentParametersResponseMsg( BOOL rejected, U08 *rejectReasons, U32 byteLength ) { BOOL result; MESSAGE_T msg; @@ -1652,7 +1678,7 @@ msg.hdr.msgID = MSG_ID_HD_NEW_TREATMENT_PARAMS_RESPONSE; msg.hdr.payloadLen = sizeof( BOOL ) + byteLength; - memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); + memcpy( payloadPtr, &rejected, sizeof( BOOL ) ); payloadPtr += sizeof( BOOL ); memcpy( payloadPtr, rejectReasons, byteLength ); @@ -1768,6 +1794,72 @@ { sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); } +} + +/*********************************************************************//** + * @brief + * The handleSalineBolusRequest function handles a saline bolus request + * message from the UI. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleSalineBolusRequest( MESSAGE_T *message ) +{ + if ( sizeof(BOOL) == message->hdr.payloadLen ) + { + BOOL start; + + memcpy( &start, &message->payload[0], sizeof(BOOL) ); + + if ( TRUE == start ) + { + signalStartSalineBolus(); + } + else + { + signalAbortSalineBolus(); + } + } + else + { + sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, FALSE ); + } +} + +/*********************************************************************//** + * @brief + * The sendSalineBolusResponse function constructs a saline bolus start/abort + * response to the UI and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: Treatment parameters response msg constructed and queued. + * @param accepted T/F - was saline bolus request accepted? + * @param rejReason reason why request was rejected (or zero if accepted) + * @param bolusVol volume (in mL) currently set for saline bolus + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendSalineBolusResponse( BOOL accepted, U32 rejReason, U32 bolusVol ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_USER_SALINE_BOLUS_RESPONSE; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ) + sizeof( U32 ); + + memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &rejReason, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &bolusVol, sizeof( U32 ) ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_UI, ACK_REQUIRED ); + + return result; } /*********************************************************************//** @@ -1781,7 +1873,7 @@ *************************************************************************/ void handleDGOpMode( MESSAGE_T *message ) { - U32 payloadSize = sizeof(U32) + sizeof(U32); + U32 payloadSize = sizeof(U32) + sizeof(U32); if ( message->hdr.payloadLen == payloadSize ) { @@ -2256,6 +2348,38 @@ // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } + +/*********************************************************************//** + * @brief + * The handleTestBloodFlowSignalStrengthOverrideRequest function handles a + * request to override the measured blood flow signal strength (%). + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestBloodFlowSignalStrengthOverrideRequest( 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 = testSetMeasuredBloodFlowSignalStrengthOverride( payload.state.f32 ); + } + else + { + result = testResetMeasuredBloodFlowSignalStrengthOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} /*********************************************************************//** * @brief @@ -2520,6 +2644,38 @@ // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } + +/*********************************************************************//** + * @brief + * The handleTestDialInFlowSignalStrengthOverrideRequest function handles a + * request to override the measured dialysate inlet flow signal strength (%). + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDialInFlowSignalStrengthOverrideRequest( 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 = testSetMeasuredDialInFlowSignalStrengthOverride( payload.state.f32 ); + } + else + { + result = testResetMeasuredDialInFlowSignalStrengthOverride(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} /*********************************************************************//** * @brief @@ -3393,13 +3549,13 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleHomeHDValve function handles a request to home an HD valve * @details * Inputs: none * Outputs: message handled - * @param message: a pointer to the message to handle + * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleHomeHDValve( MESSAGE_T *message ) @@ -3415,6 +3571,7 @@ result = TRUE; } + // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3426,14 +3583,14 @@ * @details * Inputs: none * Outputs: message handled - * @param message: a pointer to the message to handle + * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleTestHDValvesBroadcastIntervalOverrideRequest( MESSAGE_T *message ) { TEST_OVERRIDE_PAYLOAD_T payload; - BOOL result = FALSE; + // verify payload length if ( sizeof(TEST_OVERRIDE_PAYLOAD_T) == message->hdr.payloadLen ) { @@ -3474,25 +3631,26 @@ result = TRUE; } + // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleSetHDValvePositionOverrideRequest function handles a request to * override the position of a valve * @details * Inputs: none * Outputs: message handled - * @param message: a pointer to the message to handle + * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetHDValvePositionOverrideRequest( MESSAGE_T *message ) { TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; - BOOL result = FALSE; + // verify payload length if ( sizeof(TEST_OVERRIDE_ARRAY_PAYLOAD_T) == message->hdr.payloadLen ) { @@ -3506,26 +3664,27 @@ result = testResetValvesPositionOverride( payload.index ); } } + // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } #ifdef DEBUG_ENABLED -/************************************************************************* +/*********************************************************************//** * @brief * The handleSetHDValvePWMOverrideRequest function handles a request to * override the PWM of a valve * @details * Inputs: none * Outputs: message handled - * @param message: a pointer to the message to handle + * @param message a pointer to the message to handle * @return none *************************************************************************/ void handleSetHDValvePWMOverrideRequest( MESSAGE_T *message ) { OVERRIDE_VALVES_PWM_DIR_SET_PAYLOAD_T payload; - BOOL result = FALSE; + // verify payload length if ( sizeof(OVERRIDE_VALVES_PWM_DIR_SET_PAYLOAD_T) == message->hdr.payloadLen ) { @@ -3539,6 +3698,7 @@ result = testResetValvePWMOverride( payload.valve ); } } + // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } @@ -3570,4 +3730,73 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The handleTestBloodPumpHomeRequest function handles a request to home + * the blood pump. + * @details + * Inputs : none + * Outputs : message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestBloodPumpHomeRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( 0 == message->hdr.payloadLen ) + { + result = homeBloodPump(); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestDialInPumpHomeRequest function handles a request to home + * the dialysate inlet pump. + * @details + * Inputs : none + * Outputs : message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDialInPumpHomeRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( 0 == message->hdr.payloadLen ) + { + result = homeDialInPump(); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** + * @brief + * The handleTestDialOutPumpHomeRequest function handles a request to home + * the dialysate outlet pump. + * @details + * Inputs : none + * Outputs : message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestDialOutPumpHomeRequest( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + if ( 0 == message->hdr.payloadLen ) + { + result = homeDialOutPump(); + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -rdb29226a158778db9c0bbcc202d3b56f9cf305c8 -r5a04a1445b684aedd199e0294311db468635c152 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision db29226a158778db9c0bbcc202d3b56f9cf305c8) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 5a04a1445b684aedd199e0294311db468635c152) @@ -18,11 +18,14 @@ #ifndef __SYSTEM_COMM_MESSAGES_H__ #define __SYSTEM_COMM_MESSAGES_H__ -#include "HDCommon.h" -#include "MsgQueues.h" -#include "DialOutFlow.h" +#include "HDCommon.h" +#include "BloodFlow.h" #include "DGInterface.h" -#include "Valves.h" +#include "DialInFlow.h" +#include "DialOutFlow.h" +#include "Dialysis.h" +#include "MsgQueues.h" +#include "Valves.h" /** * @defgroup SystemCommMessages SystemCommMessages @@ -93,14 +96,17 @@ void handleTreatmentParametersFromUI( MESSAGE_T *message ); // MSG_ID_HD_NEW_TREATMENT_PARAMS_RESPONSE -BOOL sendTreatmentParametersResponseMsg( BOOL accepted, U08 *rejectReasons, U32 byteLength ); +BOOL sendTreatmentParametersResponseMsg( BOOL rejected, U08 *rejectReasons, U32 byteLength ); // MSG_ID_UI_USER_CONFIRM_TREATMENT_PARAMS void handleUIUserConfirmTreatmentParameters( MESSAGE_T *message ); // MSG_ID_USER_UF_PAUSE_RESUME_REQUEST void handleUFPauseResumeRequest( MESSAGE_T *message ); - + +// MSG_ID_USER_UF_PAUSE_RESUME_RESPONSE +BOOL sendUFPauseResumeResponse( BOOL accepted, U32 reason ); + // MSG_ID_USER_UF_SETTINGS_CHANGE_REQUEST void handleChangeUFSettingsRequest( MESSAGE_T *message ); @@ -125,6 +131,12 @@ // MSG_ID_USER_BLOOD_DIAL_RATE_CHANGE_REQUEST void handleChangeBloodDialysateRateChangeRequest( MESSAGE_T *message ); +// MSG_ID_USER_SALINE_BOLUS_REQUEST +void handleSalineBolusRequest( MESSAGE_T *message ); + +// MSG_ID_USER_SALINE_BOLUS_RESPONSE +BOOL sendSalineBolusResponse( BOOL accepted, U32 rejReason, U32 bolusVol ); + // MSG_ID_USER_BLOOD_DIAL_RATE_CHANGE_RESPONSE BOOL sendChangeBloodDialysateRateChangeResponse( BOOL accepted, U32 reason, U32 bloodRate, U32 dialRate ); @@ -165,10 +177,10 @@ BOOL broadcastAlarmCleared( U16 alarm ); // MSG_ID_BLOOD_FLOW_DATA -BOOL broadcastBloodFlowData( U32 flowStPt, F32 measFlow, F32 measRotorSpd, F32 measSpd, F32 measMCSpd, F32 measMCCurr, F32 pwmDC ); +BOOL broadcastBloodFlowData( BLOOD_PUMP_STATUS_PAYLOAD_T bloodData ); // MSG_ID_DIALYSATE_FLOW_DATA -BOOL broadcastDialInFlowData( U32 flowStPt, F32 measFlow, F32 measRotorSpd, F32 measSpd, F32 measMCSpd, F32 measMCCurr, F32 pwmDC ); +BOOL broadcastDialInFlowData( DIALIN_PUMP_STATUS_PAYLOAD_T dialInData ); // MSG_ID_DIALYSATE_OUT_FLOW_DATA BOOL broadcastDialOutFlowData( DIAL_OUT_FLOW_DATA_T *dialOutFlowData ); @@ -193,7 +205,10 @@ // MSG_ID_HD_VALVES_DATA BOOL broadcastHDValves( HD_VALVE_DATA_T *valveData ); - + +// MSG_ID_SALINE_BOLUS_DATA +BOOL broadcastSalineBolusData( SALINE_BOLUS_DATA_PAYLOAD_T data ); + #ifdef EMC_TEST_BUILD // MSG_ID_CAN_ERROR_COUNT BOOL broadcastCANErrorCount( U32 count ); @@ -240,6 +255,9 @@ // MSG_ID_BLOOD_FLOW_MEAS_OVERRIDE void handleTestBloodFlowMeasuredOverrideRequest( MESSAGE_T *message ); +// MSG_ID_BLOOD_FLOW_SIG_STRENGTH_OVERRIDE +void handleTestBloodFlowSignalStrengthOverrideRequest( MESSAGE_T *message ); + // MSG_ID_BLOOD_PUMP_MC_MEAS_SPEED_OVERRIDE void handleTestBloodPumpMCMeasuredSpeedOverrideRequest( MESSAGE_T *message ); @@ -264,6 +282,9 @@ // MSG_ID_DIAL_IN_FLOW_MEAS_OVERRIDE void handleTestDialInFlowMeasuredOverrideRequest( MESSAGE_T *message ); +// MSG_ID_DIAL_IN_FLOW_SIG_STRENGTH_OVERRIDE +void handleTestDialInFlowSignalStrengthOverrideRequest( MESSAGE_T *message ); + // MSG_ID_DIAL_IN_PUMP_MC_MEAS_SPEED_OVERRIDE void handleTestDialInPumpMCMeasuredSpeedOverrideRequest( MESSAGE_T *message ); @@ -365,6 +386,15 @@ // MSG_ID_HD_SET_PARAMETER_TREATMENT_PARAMETER void handleTestSetTreatmentParameter( MESSAGE_T *message ); +// MSG_ID_BLOOD_PUMP_HOME_CMD +void handleTestBloodPumpHomeRequest( MESSAGE_T *message ); + +// MSG_ID_DIAL_IN_PUMP_HOME_CMD +void handleTestDialInPumpHomeRequest( MESSAGE_T *message ); + +// MSG_ID_DIAL_OUT_PUMP_HOME_CMD +void handleTestDialOutPumpHomeRequest( MESSAGE_T *message ); + /**@}*/ #endif