Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r3b70632c04247a6973960e1f37ae73eb4384a6b7 -rd5f2ac4d84453feb1b782f35f9d69432977a95f6 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 3b70632c04247a6973960e1f37ae73eb4384a6b7) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision d5f2ac4d84453feb1b782f35f9d69432977a95f6) @@ -26,6 +26,7 @@ #include "Pressures.h" #include "Reservoirs.h" #include "ROPump.h" +#include "RTC.h" #include "SystemComm.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" @@ -95,7 +96,7 @@ pendingStartDGChemicalDisinfectRequest = FALSE; // Reset the heaters efficiency for another treatment - resetHeatersEfficiency(); + resetHeatersEstimationGain(); // Initialize the reservoirs parameters for another treatment. // This is to make sure the boolean flag for the first fill is set to TRUE. @@ -116,6 +117,8 @@ deenergizeActuators(); + setCPLDCleanLEDColor( CPLD_CLEAN_LED_OFF ); + return standbyState; } @@ -180,29 +183,35 @@ // if HD requests water sample, go to water sample state else if ( TRUE == flushFilterRequest ) { - flushFilterRequest = FALSE; + flushFilterRequest = FALSE; filterFlushStartTime = getMSTimerCount(); + setValveState( VPI, VALVE_STATE_OPEN ); + state = DG_STANDBY_MODE_STATE_FLUSH_FILTER; } else if ( TRUE == pendingStartDGRequest ) { pendingStartDGRequest = FALSE; + signalSyncToHD(); requestNewOperationMode( DG_MODE_GENE ); } else if ( TRUE == pendingStartDGFlushRequest ) { pendingStartDGFlushRequest = FALSE; + requestNewOperationMode( DG_MODE_FLUS ); } else if ( TRUE == pendingStartDGHeatDisinfectRequest ) { pendingStartDGHeatDisinfectRequest = FALSE; + requestNewOperationMode( DG_MODE_HEAT ); } else if ( TRUE == pendingStartDGChemicalDisinfectRequest ) { pendingStartDGChemicalDisinfectRequest = FALSE; + requestNewOperationMode( DG_MODE_CHEM ); } @@ -230,7 +239,7 @@ state = DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE; } - if ( FILTER_FLUSH_DATA_PUBLISH_INTERVAL <= filterFlushPublishTimerCounter++ ) + if ( ++filterFlushPublishTimerCounter >= FILTER_FLUSH_DATA_PUBLISH_INTERVAL ) { STANDBY_MODE_DATA_T data; @@ -380,8 +389,11 @@ if ( DG_STANDBY_MODE_STATE_IDLE == standbyState ) { - result = TRUE; + result = TRUE; pendingStartDGRequest = TRUE; + + // Reset the volume accumulator for the next run + resetROGenerateVolumeL(); } return result; @@ -399,9 +411,10 @@ BOOL result = FALSE; // If DG is in standby mode or in the solo mode and the standby mode is in Idle state, request DG flush - if ( ( DG_MODE_STAN == getCurrentOperationMode() && DG_STANDBY_MODE_STATE_IDLE == standbyState ) || ( DG_MODE_SOLO == getCurrentOperationMode() ) ) + if ( ( DG_MODE_STAN == getCurrentOperationMode() ) && ( DG_STANDBY_MODE_STATE_IDLE == standbyState ) || ( DG_MODE_SOLO == getCurrentOperationMode() ) ) { DG_CMD_RESPONSE_T cmdResponse; + OPN_CLS_STATE_T concCap = getSwitchStatus( CONCENTRATE_CAP ); OPN_CLS_STATE_T diaCap = getSwitchStatus( DIALYSATE_CAP ); cmdResponse.commandID = DG_CMD_START_FLUSH;