Index: firmware/App/Modes/ConsumableSelfTest.c =================================================================== diff -u -r0a4dcd288d4347b85baaa0b07da568b6add5eac7 -r75e1ae332d1446dddf9b8d4ce6e8317449c57d67 --- firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision 0a4dcd288d4347b85baaa0b07da568b6add5eac7) +++ firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision 75e1ae332d1446dddf9b8d4ce6e8317449c57d67) @@ -7,8 +7,8 @@ * * @file ConsumableSelfTest.c * -* @author (last) Dara Navaei -* @date (last) 05-Jun-2022 +* @author (last) Michael Garthwaite +* @date (last) 19-Jan-2023 * * @author (original) Quang Nguyen * @date (original) 06-Mar-2021 @@ -25,6 +25,7 @@ #include "Reservoirs.h" #include "SelfTests.h" #include "SyringePump.h" +#include "SystemCommMessages.h" #include "Valves.h" /** @@ -91,6 +92,8 @@ *************************************************************************/ void execConsumableSelfTest( void ) { + CONSUMABLE_SELF_TESTS_STATE_T priorSubState = currentConsumableSelfTestState; + switch( currentConsumableSelfTestState ) { case CONSUMABLE_SELF_TESTS_INSTALL_STATE: @@ -103,7 +106,7 @@ #endif // TODO: Check for DG straw door status to be open once DG door driver implemented - if ( TRUE == consumableInstallConfirmed ) + if ( TRUE == consumableInstallConfirmed ) // TODO - should we check that concentrate cap is off too? { consumableInstallConfirmed = FALSE; #ifndef _RELEASE_ @@ -114,20 +117,16 @@ else #endif { - currentConsumableSelfTestState = CONSUMABLE_SELF_TESTS_FILL_CMD_STATE; + if ( ( DG_MODE_GENE == getDGOpMode() ) && ( DG_GEN_IDLE_MODE_STATE_FLUSH_WATER == getDGSubMode() ) ) + { + cmdStartDGFill( FILL_RESERVOIR_TO_VOLUME_ML, DEFAULT_TARGET_FILL_FLOW_RATE_LPM ); + currentConsumableSelfTestState = CONSUMABLE_SELF_TESTS_PRIME_STATE; + } } } break; - case CONSUMABLE_SELF_TESTS_FILL_CMD_STATE: - if ( ( DG_MODE_GENE == getDGOpMode() ) && ( DG_GEN_IDLE_MODE_STATE_FLUSH_WATER == getDGSubMode() ) ) - { - currentConsumableSelfTestState = CONSUMABLE_SELF_TESTS_WATER_QUALITY_CHECK_STATE; - cmdStartDGFill( FILL_RESERVOIR_TO_VOLUME_ML, DEFAULT_TARGET_FILL_FLOW_RATE_LPM ); - } - break; - - case CONSUMABLE_SELF_TESTS_WATER_QUALITY_CHECK_STATE: + case CONSUMABLE_SELF_TESTS_PRIME_STATE: if ( ( DG_MODE_FILL == getDGOpMode() ) && ( getDGSubMode() >= DG_FILL_MODE_STATE_TEST_BICARB_CONDUCTIVITY ) ) { currentConsumableSelfTestState = CONSUMABLE_SELF_TESTS_BICARB_PUMP_CHECK_STATE; @@ -157,6 +156,10 @@ break; } + if ( priorSubState != currentConsumableSelfTestState ) + { + SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_SUB_STATE_CHANGE, priorSubState, currentConsumableSelfTestState ); + } // Handle triggered alarm with stop property handleConsumableSelfTestStopRequest(); }