Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r9a0079fa0513966864a8a521098b3718010c8e11 -r05ab87b4de779f06243fa1e87a0402b659a6fa3e --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 9a0079fa0513966864a8a521098b3718010c8e11) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 05ab87b4de779f06243fa1e87a0402b659a6fa3e) @@ -23,10 +23,11 @@ #include "FpgaDD.h" #include "Heaters.h" #include "Level.h" +#include "MessageSupport.h" +#include "Messaging.h" #include "MixingControl.h" #include "ModeGenDialysate.h" #include "ModeStandby.h" -#include "Messaging.h" #include "OperationModes.h" #include "Pressure.h" #include "TaskGeneral.h" @@ -112,6 +113,8 @@ //TODO: remove later once level sensor working static U32 bicarbChamberPeriodicFillCounter; +// Balancing chamber state change tracker +static BAL_CHAMBER_EXEC_STATE_T prevBalChamberState; ///< Balancing chamber Previous State tracking variable // ********** private function prototypes ********** @@ -190,6 +193,7 @@ isBalChamberSwitchingPeriodUpdatePending = FALSE; bcSwitchingBasedOnClosedPeriodCounter = 0; balancingError = 0.0F; + prevBalChamberState = BAL_CHAMBER_STATE_IDLE; //TODO:remove once level sensor working bicarbChamberPeriodicFillCounter = 0; } @@ -362,8 +366,8 @@ /*********************************************************************//** * @brief * The execBalancingChamberControl function executes the balancing chamber state machine. - * @details \b Inputs: balChamberExecState - * @details \b Outputs: balChamberExecState + * @details \b Inputs: balChamberExecState, prevBalChamberState + * @details \b Outputs: balChamberExecState prevBalChamberState * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT when wrong balancing chamber state invoked. * @return current state. *************************************************************************/ @@ -448,6 +452,17 @@ break; } + if ( prevBalChamberState != balChamberExecState ) + { + if ( ( BAL_CHAMBER_STATE_IDLE == balChamberExecState ) || + ( BAL_CHAMBER_STATE1_FILL_START == balChamberExecState ) || + ( BAL_CHAMBER_STATE2_FILL_START == balChamberExecState ) ) + { + SEND_EVENT_WITH_2_U32_DATA( DD_EVENT_BC_STATE_CHANGE, prevBalChamberState, balChamberExecState ); + } + } + prevBalChamberState = balChamberExecState; + //Publish balancing chamber data publishBalChamberData(); @@ -1500,14 +1515,15 @@ * @brief * The setBalChamberSwitchingOnlyStatus function sets the balancing chamber * switching only On/Off status. - * @details \b Inputs: balanceChamberSwitchingOnly + * @details \b Inputs: balanceChamberSwitchingOnly, isBalChamberSwitchingActive * @details \b Outputs: none * @param OnOff to set the BC switch status * @return none *************************************************************************/ void setBalChamberSwitchingOnlyStatus( BOOL OnOff ) { balanceChamberSwitchingOnly = OnOff; + SEND_EVENT_WITH_2_U32_DATA( DD_EVENT_BC_SWITCH_ONLY_MODE_CHANGE, balanceChamberSwitchingOnly, isBalChamberSwitchingActive ); } /*********************************************************************//**