Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r79c2105d7ec35f3caeb977f6e2cc1b494853d211 -rf90801d4a4f5cd1276b4a54175d101710b4096f2 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 79c2105d7ec35f3caeb977f6e2cc1b494853d211) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision f90801d4a4f5cd1276b4a54175d101710b4096f2) @@ -16,13 +16,17 @@ ***************************************************************************/ #include "AirTrap.h" +#include "BloodFlow.h" #include "Buttons.h" #include "DDInterface.h" #include "Messaging.h" +#include "ModePreTreat.h" #include "ModeTreatment.h" -#include "ModeTxParams.h" #include "ModeStandby.h" #include "OperationModes.h" +#include "Switches.h" +#include "SystemCommTD.h" +#include "TxParams.h" /** * @addtogroup TDStandbyMode @@ -71,7 +75,7 @@ // Re-initialize when transitioning to standby mode initStandbyMode(); - initDDInterface(); + resetDDInterface(); setCurrentSubState( NO_SUB_STATE ); // Set user alarm recovery actions allowed in this mode @@ -88,7 +92,7 @@ // setValvePosition( H1_VALV, VALVE_POSITION_A_INSERT_EJECT ); // setValvePosition( H19, VALVE_POSITION_A_INSERT_EJECT ); -// doorClosedRequired( FALSE, FALSE ); // door no longer required to be closed in standby mode +// doorClosedRequired( FALSE ); // door no longer required to be closed in standby mode // syringeDetectionRequired( FALSE ); // Request DD service record and usage information from DD @@ -182,7 +186,7 @@ // { // syringePumpVerifyForceSensorDACCalibration(); // homingInitiated = FALSE; // reset for next time -// doorClosedRequired( FALSE, FALSE ); // door no longer required to be closed in standby mode +// doorClosedRequired( FALSE ); // door no longer required to be closed in standby mode // state = STANDBY_WAIT_FOR_TREATMENT_STATE; // Go to wait for treatment state after above check // } // } @@ -203,7 +207,7 @@ static TD_STANDBY_STATE_T handleStandbyModeWaitForTreatmentState( void ) { TD_STANDBY_STATE_T state = STANDBY_WAIT_FOR_TREATMENT_STATE; -// DG_OP_MODE_T dgOperationMode = getDDOpMode(); + DD_OP_MODE_T ddOperationMode = getDDOpMode(); // switch ( dgOperationMode ) // { @@ -245,8 +249,7 @@ // PRESSURE_LIMIT_CHANGE_RESPONSE_T respRecord = { TRUE, REQUEST_REJECT_REASON_NONE, 0, 0, 0 }; // Initialize treatment modes before starting a new treatment - initTreatParamsMode(); -// initPreTreatmentMode(); + initPreTreatmentMode(); initTreatmentMode(); // initPostTreatmentMode(); resetAirTrap(); @@ -256,7 +259,7 @@ // respRecord.venPresLimitAsymmetricmmHg = getTreatmentParameterS32DefaultValue( TREATMENT_PARAM_VEN_PRES_LIMIT_ASYMMETRIC ); // sendPressureLimitsChangeResponse( &respRecord ); // Start treatment workflow with treatment parameters mode - requestNewOperationMode( MODE_TPAR ); + requestNewOperationMode( MODE_PRET ); treatStartReqReceived = FALSE; } @@ -293,6 +296,18 @@ { rejReason = REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE; } +#ifndef TEST_UI_ONLY + // Verify DD is communicating with HD + else if ( isDDCommunicating() != TRUE ) + { + rejReason = REQUEST_REJECT_REASON_DD_COMM_LOST; + } + // Verify DD is not busy + else if ( ( DD_MODE_STAN != getDDOpMode() ) || ( DD_STANDBY_MODE_STATE_IDLE != getDDSubMode() ) ) // || ( isDDPOSTPassed() != TRUE ) ) + { + rejReason = REQUEST_REJECT_REASON_DD_NOT_IN_STANDBY_IDLE_STATE; + } +#endif else { // If request to start treatment not rejected, set flag to initiate treatment workflow @@ -302,7 +317,7 @@ } else if ( USER_COMMAND_CANCEL == cmd ) { - result = signalUserCancelTreatment(); + //result = signalUserCancelTreatment(); if ( result != TRUE ) { rejReason = REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE;