Index: firmware/App/Modes/ModeDrain.c =================================================================== diff -u -r7c99c8a08fdd3747c298d04a6995b325bb986097 -rd03ddbc63925f2e5a5a5ceeba3487992e65a8ecf --- firmware/App/Modes/ModeDrain.c (.../ModeDrain.c) (revision 7c99c8a08fdd3747c298d04a6995b325bb986097) +++ firmware/App/Modes/ModeDrain.c (.../ModeDrain.c) (revision d03ddbc63925f2e5a5a5ceeba3487992e65a8ecf) @@ -245,10 +245,10 @@ { // Tare reservoir load cells at empty if requested result = DG_DRAIN_STATE_TARE; } - else - { - requestNewOperationMode( DG_MODE_GENE ); - } +// else +// { +// requestNewOperationMode( DG_MODE_GENE ); +// } } // check for empty bottles at the end of drain @@ -264,7 +264,7 @@ } else { - requestNewOperationMode( DG_MODE_GENE ); // TODO: in idle, reject moving from idle to fill if alarm is active + requestNewOperationMode( DG_MODE_GENE ); // in idle, reject moving from idle to fill if alarm is active } // Drain timed out raise the alarm Index: firmware/App/Modes/ModeGenIdle.c =================================================================== diff -u -r7c99c8a08fdd3747c298d04a6995b325bb986097 -rd03ddbc63925f2e5a5a5ceeba3487992e65a8ecf --- firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision 7c99c8a08fdd3747c298d04a6995b325bb986097) +++ firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision d03ddbc63925f2e5a5a5ceeba3487992e65a8ecf) @@ -54,6 +54,7 @@ static DG_GEN_IDLE_MODE_BAD_FILL_STATE_T badFillState; ///< Current active bad fill state. static U32 hdLostCommStartTime_ms = 0; ///< Lost communication with HD start time in ms. static U32 targetFillVolumeML; ///< Save the target fill volume before calling startFillCmd() +static BOOL handleBadFillFlag; ///< Internal signal flag to handle bad fill // ********** private function prototypes ********** @@ -77,9 +78,10 @@ void initGenIdleMode( void ) { genIdleState = DG_GEN_IDLE_MODE_STATE_START; -// badFillState = DG_HANDLE_BAD_FILL_STATE_FIRST_DRAIN; + hdLostCommStartTime_ms = 0; targetFillVolumeML = 0; + handleBadFillFlag = FALSE; } /*********************************************************************//** @@ -218,9 +220,13 @@ { DG_GEN_IDLE_MODE_STATE_T result = DG_GEN_IDLE_MODE_STATE_START; -// if ( TRUE == isBadFill() ) // bad fill due to conductivity is out of range and assume bottles need prime if ( TRUE == isAvgConductivityOutOfRange() ) { + handleBadFillFlag = TRUE; + } + + if ( TRUE == handleBadFillFlag ) + { result = DG_GEN_IDLE_MODE_STATE_HANDLE_BAD_FILL ; } else @@ -331,7 +337,7 @@ if ( TRUE == isAvgConductivityOutOfRange() ) { - result = DG_HANDLE_BAD_FILL_STATE_FIRST_DRAIN; + result = DG_HANDLE_BAD_FILL_STATE_FIRST_DRAIN; // (idle 1.0) } else { @@ -390,6 +396,7 @@ // clear wait for dialysate alarm condition to allow resume clearAlarmCondition( ALARM_ID_CREATING_DIALYSATE_PLEASE_WAIT ); // resume option will appear + handleBadFillFlag = FALSE; // set flag to FALSE here so next call to idle exec will move to normal flush water state requestNewOperationMode( DG_MODE_GENE ); // go to generation idle mode return result;