Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r7a211da92e750bc5e306e897e956487a4303a36b -ra961fefac71ca2635036b78532acc8aea468c33e --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 7a211da92e750bc5e306e897e956487a4303a36b) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision a961fefac71ca2635036b78532acc8aea468c33e) @@ -22,6 +22,7 @@ #include "DDInterface.h" #include "Messaging.h" #include "ModeInitPOST.h" +#include "ModePostTreat.h" #include "ModePreTreat.h" #include "ModeTreatment.h" #include "ModeStandby.h" @@ -122,29 +123,16 @@ setStandbyWaitForTreatmentActuators(); - // If we just exited Post Treatment Mode, goto disinfect sub state. - //ToDo -// if ( ( MODE_POST == previousOpMode ) && ( flagNoDisinfectRequired != TRUE ) ) -// { -// doorClosedRequired( FALSE ); // door no longer required to be closed in standby mode -// currentStandbyState = STANDBY_WAIT_FOR_DISINFECT_STATE; //ToDo -// } -// else -// { -// flagNoDisinfectRequired = FALSE; -// doorClosedRequired( TRUE ); -// currentStandbyState = STANDBY_START_STATE; //ToDo -// } // Standby currently supports Start and Wait For Treatment states. // Disinfect/cleaning states are not enabled until the handlers are implemented. flagNoDisinfectRequired = FALSE; - doorClosedRequired( TRUE ); + doorClosedRequired( FALSE ); currentStandbyState = STANDBY_START_STATE; -// syringeDetectionRequired( FALSE ); //Todo // Request DD service record and usage information from DD // sendDDServiceRequestToDD(); - broadcastData( MSG_ID_TD_DD_REQUEST_SERVICE_RECORD_FROM_TD, COMM_BUFFER_OUT_CAN_TD_2_DD, requestPayload, sizeof( requestPayload ) ); + //ToDo: Service record id not available +// broadcastData( MSG_ID_TD_DD_REQUEST_SERVICE_RECORD_FROM_TD, COMM_BUFFER_OUT_CAN_TD_2_DD, requestPayload, sizeof( requestPayload ) ); broadcastData( MSG_ID_TD_DD_USAGE_INFO_REQUEST, COMM_BUFFER_OUT_CAN_TD_2_DD, requestPayload, sizeof( requestPayload ) ); // sendDDUsageInfoRequestToDD(); //TODO need to enable @@ -178,22 +166,22 @@ currentStandbyState = handleStandbyModeWaitForTreatmentState(); break; - case STANDBY_WAIT_FOR_DISINFECT_STATE: -// currentStandbyState = handleStandbyModeWaitForDisinfectState(); - break; +// case STANDBY_WAIT_FOR_DISINFECT_STATE: +//// currentStandbyState = handleStandbyModeWaitForDisinfectState(); +// break; +// +// case STANDBY_WAIT_FOR_DD_CLEANING_MODE_CMD_RESPONSE_STATE: +// currentStandbyState = handleStandbyModeWaitForDDCleaningModeCmdResponseState(); +// break; +// +// case STANDBY_WAIT_FOR_DD_CLEANING_MODE_TO_START_STATE: +// currentStandbyState = handleStandbyModeWaitForDDCleaningModeStartState(); +// break; +// +// case STANDBY_CLEANING_MODE_IN_PROGRESS_STATE: +// currentStandbyState = handleStandbyModeDDCleaningModeInProgressState(); +// break; - case STANDBY_WAIT_FOR_DD_CLEANING_MODE_CMD_RESPONSE_STATE: - currentStandbyState = handleStandbyModeWaitForDDCleaningModeCmdResponseState(); - break; - - case STANDBY_WAIT_FOR_DD_CLEANING_MODE_TO_START_STATE: - currentStandbyState = handleStandbyModeWaitForDDCleaningModeStartState(); - break; - - case STANDBY_CLEANING_MODE_IN_PROGRESS_STATE: - currentStandbyState = handleStandbyModeDDCleaningModeInProgressState(); - break; - default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_MODE_STANDBY_INVALID_STATE, currentStandbyState ); currentStandbyState = STANDBY_START_STATE; @@ -235,11 +223,12 @@ else { // If homing has been initiated, wait for syringe pump to home and the verify force sensor calibration - if ( ( TRUE == isSyringePumpHome() ) && ( TRUE == isSyringePumpStopped() ) && ( VALVE_POSITION_A_INSERT_EJECT == getValvePosition( H1_VALV ) ) && ( VALVE_POSITION_A_INSERT_EJECT == getValvePosition( H19_VALV ) ) ) + if ( ( TRUE == isSyringePumpHome() ) && ( TRUE == isSyringePumpStopped() ) + && ( VALVE_POSITION_A_INSERT_EJECT == getValvePosition( H1_VALV ) ) + && ( VALVE_POSITION_A_INSERT_EJECT == getValvePosition( H19_VALV ) ) ) { syringePumpVerifyForceSensorDACCalibration(); homingInitiated = FALSE; // reset for next time - doorClosedRequired( FALSE ); // door no longer required to be closed in standby mode setStandbyWaitForTreatmentActuators(); state = STANDBY_WAIT_FOR_TREATMENT_STATE; // Go to wait for treatment state after above check } @@ -262,34 +251,35 @@ DD_OP_MODE_T ddOperationMode = getDDOpMode(); F32 bicarbConvFactor = BICARBONATE_CONVERSION_FACTOR; - switch ( ddOperationMode ) - { - case DD_MODE_GENE: - // If DD is in idle generation state while we are in standby mode, transition DD to standby too +// switch ( ddOperationMode ) +// { +// case DD_MODE_GENE: +// // If DD is in idle generation state while we are in standby mode, transition DD to standby too // cmdStopDD(); - break; - - // If DD is any of the cleaning modes, set the TD standby to be in the corresponding cleaning mode - case DD_MODE_HEAT: - case DD_MODE_HCOL: - case DD_MODE_ROPS: +// break; +// +// // If DD is any of the cleaning modes, set the TD standby to be in the corresponding cleaning mode +// case DD_MODE_HEAT: +// case DD_MODE_HCOL: +// case DD_MODE_ROPS: // setRequestedCleaningMode( ddOperationMode ); // state = STANDBY_WAIT_FOR_DD_CLEANING_MODE_TO_START_STATE; - // DD cleaning mode handling is not enabled yet. - // Stay in Wait For Treatment until DD returns to a supported standby state. - break; +// // DD cleaning mode handling is not enabled yet. +// // Stay in Wait For Treatment until DD returns to a supported standby state. +// break; +// +// default: +// // Do nothing. There are other DD modes that TD standby does not need to act upon them. +// break; +// } - default: - // Do nothing. There are other DD modes that TD standby does not need to act upon them. - break; - } - // If DD is communicating and we don't yet have DD version info, request it if ( TRUE == isDDCommunicating() ) { if ( FALSE == getDDCompatibility()) { U08*fwbuf = NULL; + sendMessage( MSG_ID_FW_VERSIONS_REQUEST, COMM_BUFFER_OUT_CAN_TD_2_DD, (U08*)(&fwbuf), 3 ); } } @@ -300,10 +290,9 @@ PRESSURE_LIMIT_CHANGE_RESPONSE_T respRecord = { TRUE, REQUEST_REJECT_REASON_NONE, 0, 0, 0, 0 }; // Initialize treatment modes before starting a new treatment -// initTreatParamsMode(); initPreTreatmentMode(); initTreatmentMode(); -// initPostTreatmentMode(); + initPostTreatmentMode(); resetAirTrap(); // Send UI default pressure settings since user is not asked to set them. respRecord.artPresLimitWindowmmHg = getSysConfigTreatmentParameterU32DefaultValue( TREATMENT_PARAM_ART_PRES_LIMIT_WINDOW ); @@ -400,12 +389,13 @@ // Verify DD is ready and not busy with flush/disinfect/cleaning/generation. else if ( ( DD_MODE_STAN != getDDOpMode() ) || ( DD_STANDBY_MODE_STATE_IDLE != getDDSubMode() ) ) { - rejReason = REQUEST_REJECT_REASON_DD_NOT_IN_STANDBY_IDLE_STATE; + rejReason = REQUEST_REJECT_REASON_DD_BUSY; } else if ( FALSE == getDDCompatibility() ) { rejReason = REQUEST_REJECT_REASON_DD_INCOMPATIBLE; } + // ToDo: Need to uncomment below after implementation // else if ( TRUE == isDDDisinfectionOverdue() ) // { // rejReason = REQUEST_REJECT_REASON_DISINFECT_HAS_BEEN_EXPIRED; @@ -416,7 +406,7 @@ // } // else if ( TRUE == isDDTemperatureTooHigh() ) // { -// rejReason = REQUEST_REJECT_REASON_RO_FILTER_TEMPERATURE_OUT_OF_RANGE; +// rejReason = REQUEST_REJECT_REASON_DD_TEMPERATURE_OUT_OF_RANGE; // } // else if ( TRUE == isDDServiceOverdue() ) // { @@ -428,11 +418,11 @@ // } // else if ( FALSE == isFPStandbymode() ) // { -// rejReason = REQUEST_REJECT_REASON_TD_SERVICE_IS_DUE; +// rejReason = REQUEST_REJECT_REASON_FP_BUSY; // } // else if ( TRUE == isfpServiceOverdue() ) // { -// rejReason = REQUEST_REJECT_REASON_TD_SERVICE_IS_DUE; +// rejReason = REQUEST_REJECT_REASON_FP_SERVICE_IS_DUE; // } #endif @@ -458,12 +448,12 @@ } else { - rejReason = REQUEST_REJECT_REASON_INVALID_COMMAND; + rejReason = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; } } else { - rejReason = REQUEST_REJECT_REASON_INVALID_COMMAND; + rejReason = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; } // Respond to request to start treatment.