Index: firmware/App/Modes/BloodPrime.c =================================================================== diff -u -rc1b9ac0dbf2196280895d2e440dd7ac288ac8424 -r35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1 --- firmware/App/Modes/BloodPrime.c (.../BloodPrime.c) (revision c1b9ac0dbf2196280895d2e440dd7ac288ac8424) +++ firmware/App/Modes/BloodPrime.c (.../BloodPrime.c) (revision 35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1) @@ -139,6 +139,7 @@ setBloodPumpTargetFlowRate( (U32)bloodPrimeRampFlowRate_mL_min, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_OPEN_LOOP ); setDialInPumpTargetFlowRate( DIALYSATE_FLOW_RATE_FOR_RECIRC, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); cmdStartDGTrimmerHeater(); + setCurrentSubState( NO_SUB_STATE ); // Start air trap control startAirTrapControl(); Index: firmware/App/Modes/ConsumableSelfTest.c =================================================================== diff -u -rce64b7e15824641a6a6465c28eec5d8ec593f110 -r35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1 --- firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision ce64b7e15824641a6a6465c28eec5d8ec593f110) +++ firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision 35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1) @@ -72,6 +72,7 @@ signalDialInPumpHardStop(); signalDialOutPumpHardStop(); stopSyringePump(); + setCurrentSubState( (U32)currentConsumableSelfTestState ); // Set valves to default positions setValveAirTrap( STATE_CLOSED ); @@ -159,6 +160,7 @@ if ( priorSubState != currentConsumableSelfTestState ) { setCurrentSubState( (U32)currentConsumableSelfTestState ); + SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_SUB_STATE_CHANGE, priorSubState, currentConsumableSelfTestState ); } // Handle triggered alarm with stop property handleConsumableSelfTestStopRequest(); Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -rce64b7e15824641a6a6465c28eec5d8ec593f110 -r35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision ce64b7e15824641a6a6465c28eec5d8ec593f110) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1) @@ -792,7 +792,6 @@ if ( priorSubState != currentUFState ) { - setCurrentSubState( (U32)currentUFState ); SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_SUB_STATE_CHANGE, priorSubState, currentUFState ); } @@ -839,7 +838,6 @@ if ( priorSubState != currentSalineBolusState ) { - setCurrentSubState( (U32)currentSalineBolusState ); SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_SUB_STATE_CHANGE, priorSubState, currentSalineBolusState ); } Index: firmware/App/Modes/ModePostTreat.c =================================================================== diff -u -rce64b7e15824641a6a6465c28eec5d8ec593f110 -r35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1 --- firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision ce64b7e15824641a6a6465c28eec5d8ec593f110) +++ firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision 35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1) @@ -153,7 +153,7 @@ signalBloodPumpHardStop(); signalDialOutPumpHardStop(); signalDialInPumpHardStop(); - setCurrentSubState( NO_SUB_STATE ); + setCurrentSubState( currentPostTreatmentState ); collectTreatmentLogData(); exitBloodLeakNormalState(); @@ -370,6 +370,7 @@ // Done with draining the reservoirs state = HD_POST_TREATMENT_PATIENT_DISCONNECTION_STATE; doorClosedRequired( TRUE, TRUE ); + setCurrentSubState( NO_SUB_STATE ); } return state; Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -rce64b7e15824641a6a6465c28eec5d8ec593f110 -r35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1 --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision ce64b7e15824641a6a6465c28eec5d8ec593f110) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1) @@ -221,7 +221,6 @@ signalDialInPumpHardStop(); signalDialOutPumpHardStop(); stopSyringePump(); - setCurrentSubState( NO_SUB_STATE ); // Set valves to default positions setValveAirTrap( STATE_CLOSED ); @@ -790,6 +789,7 @@ { submodeCompleteTransitionTimeCounter = 0; state = HD_PRE_TREATMENT_CART_INSTALL_STATE; + setCurrentSubState( NO_SUB_STATE ); transitionToCartridgeInstallation(); } } Index: firmware/App/Modes/ModeTreatmentParams.c =================================================================== diff -u -rce64b7e15824641a6a6465c28eec5d8ec593f110 -r35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1 --- firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision ce64b7e15824641a6a6465c28eec5d8ec593f110) +++ firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision 35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1) @@ -137,7 +137,7 @@ treatmentCancelled = FALSE; setTreatmentParameterF32( TREATMENT_PARAM_UF_VOLUME, 0.0 ); - + setCurrentSubState( NO_SUB_STATE ); // Set user alarm recovery actions allowed in this mode setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, FALSE ); setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); @@ -282,8 +282,6 @@ HD_TREATMENT_PARAMS_MODE_STATE_T priorSubState = currentTreatmentParamsState; BOOL stop = isStopButtonPressed(); - setCurrentSubState( NO_SUB_STATE ); - if ( TRUE == stop ) { // Ignore stop button in this mode. @@ -306,6 +304,11 @@ } + if ( priorSubState != currentTreatmentParamsState ) + { + SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_SUB_MODE_CHANGE, priorSubState, currentTreatmentParamsState ); + } + return (U32)currentTreatmentParamsState; } Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r0e0fc7fbbc571a76deb8ddc6e6382bfa58598406 -r35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 0e0fc7fbbc571a76deb8ddc6e6382bfa58598406) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1) @@ -578,28 +578,42 @@ return new_id; } +/*********************************************************************//** + * @brief + * The setCurrentSubState function sets the current subState. + * @details Inputs: subState + * @details Outputs: currentSubState + * @param subState the enumerated sub state. + * @return none + *************************************************************************/ void setCurrentSubState( U32 subState ) { currentSubState = subState; } -static void sendOperationStatusEvent( void ) +/*********************************************************************//** + * @brief + * The sendOperationStatusEvent function constructs and sends an HD operation + * status event. + * @details Inputs: currentMode, currentSubMode, currentSubState + * @details Outputs: dat1, dat2. + * @param none + * @return none + *************************************************************************/ +static void sendOperationStatusEvent() { EVENT_DATA_T dat1; EVENT_DATA_T dat2; - OP_STATUS_EVENT_PAYLOAD_T opData; + U32 opData = ( (U08)currentMode + + ( (U08)currentSubMode << SHIFT_8_BITS_FOR_BYTE_SHIFT ) + + ( (U08)currentSubState << SHIFT_16_BITS_FOR_WORD_SHIFT ) ); dat2.dataType = EVENT_DATA_TYPE_U32; dat2.data.uInt.data = 0; - opData.OpStatus[OPERATION_MODE] = (U08)currentMode; - opData.OpStatus[SUB_MODE] = (U08)currentSubMode; - opData.OpStatus[SUB_STATE] = (U08)currentSubState; - opData.OpStatus[RESERVED] = 0; - dat1.dataType = EVENT_DATA_TYPE_U32; - dat1.data.uInt.data = (U32)(opData); + dat1.data.uInt.data = opData; sendEvent( HD_EVENT_OPERATION_STATUS, dat1, dat2 ); } Index: firmware/App/Modes/OperationModes.h =================================================================== diff -u -r0e0fc7fbbc571a76deb8ddc6e6382bfa58598406 -r35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1 --- firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision 0e0fc7fbbc571a76deb8ddc6e6382bfa58598406) +++ firmware/App/Modes/OperationModes.h (.../OperationModes.h) (revision 35a326b0f9f2fd83bac4be54e67ebde2d3f2c7e1) @@ -40,24 +40,6 @@ U32 subMode; ///< Current sub-mode of current operating mode } OP_MODE_PAYLOAD_T; -/// Payload record structure for operation status events. -typedef enum Op_Status_Fields -{ - OPERATION_MODE = 0, ///< Current Operation mode - SUB_MODE, ///< Current sub mode - SUB_STATE, ///< Current sub state where applicable - RESERVED, ///< Reserved 8-bit space used to uphold 32-bit payload sizes. - NUM_OF_OP_STATUS_TYPE -} OP_STATUS_T; - -#pragma pack(push, 1) - -typedef struct -{ - U08 OpStatus[NUM_OF_OP_STATUS_TYPE]; -} OP_STATUS_EVENT_PAYLOAD_T; - -#pragma pack(pop) // ********** public function prototypes ********** void initOperationModes( void ); // Initialize this module