Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -rb57b5341e4dfe3a7b17cd333bfcfac9036d11e85 -r5a36a768d11cc597a36b894c1fb3a5e5590130f1 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision b57b5341e4dfe3a7b17cd333bfcfac9036d11e85) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 5a36a768d11cc597a36b894c1fb3a5e5590130f1) @@ -28,6 +28,7 @@ #include "OperationModes.h" #include "Pressures.h" #include "RTC.h" +#include "SystemCommMessages.h" #include "TemperatureSensors.h" #include "Thermistors.h" #include "UVReactors.h" @@ -48,6 +49,7 @@ // ********** private function prototypes ********** static DG_POST_STATE_T handlePOSTStatus( SELF_TEST_STATUS_T testStatus ); +static SELF_TEST_STATUS_T execFWCompatibilityTest( void ); /*********************************************************************//** * @brief @@ -93,7 +95,7 @@ switch ( postState ) { case DG_POST_STATE_START: - postState = DG_POST_STATE_FW_INTEGRITY; + postState = DG_POST_STATE_FW_COMPATIBILITY; #ifdef SKIP_POST postState = DG_POST_STATE_COMPLETED; #endif @@ -103,6 +105,11 @@ #endif break; + case DG_POST_STATE_FW_COMPATIBILITY: + testStatus = execFWCompatibilityTest(); + postState = handlePOSTStatus( testStatus ); + break; + case DG_POST_STATE_FW_INTEGRITY: testStatus = execIntegrityTest(); postState = handlePOSTStatus( testStatus ); @@ -123,11 +130,6 @@ postState = handlePOSTStatus( testStatus ); break; - case DG_POST_STATE_LOAD_CELL: - testStatus = execLoadCellsSelfTest(); - postState = handlePOSTStatus( testStatus ); - break; - case DG_POST_STATE_TEMPERATURE_SENSORS: #ifdef DONT_SKIP_NV_POST // Skip the rest of the POSTs @@ -138,11 +140,6 @@ #endif break; - case DG_POST_STATE_HEATERS: - testStatus = execHeatersSelfTest(); - postState = handlePOSTStatus( testStatus ); - break; - case DG_POST_STATE_ACCELEROMETER: #ifndef DISABLE_ACCELS testStatus = execAccelTest(); @@ -182,6 +179,12 @@ case DG_POST_STATE_WATCHDOG: testStatus = execWatchdogTest(); + postState = handlePOSTStatus( testStatus ); + break; + + // Should be last POST (and last POST test must be a test that completes in a single call) + case DG_POST_STATE_LOAD_CELL: + testStatus = execLoadCellsSelfTest(); handlePOSTStatus( testStatus ); // ignoring return value because last test if ( TRUE == tempPOSTPassed ) { @@ -194,17 +197,23 @@ break; case DG_POST_STATE_COMPLETED: - // set overall DG POST status to "passed" + // Set overall HD POST status to "passed" postPassed = TRUE; - // set overall DG POST completed status to TRUE + // Set overall HD POST completed status to TRUE postCompleted = TRUE; - // TODO - send POST status on CAN - // go to standby mode + // Broadcast final POST passed + sendPOSTFinalResult( TRUE ); + // Go to standby mode requestNewOperationMode( DG_MODE_STAN ); break; case DG_POST_STATE_FAILED: - // Should not get here - any failed post test should have already triggered a fault and taken us to fault mode + // Broadcast final POST failed + sendPOSTFinalResult( FALSE ); + // Will want POST faults to wait for us to get here before sending us to fault mode + requestNewOperationMode( DG_MODE_FAUL ); + break; + default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_MODE_INIT_POST_INVALID_POST_STATE, postState ) postState = DG_POST_STATE_FAILED; @@ -254,7 +263,12 @@ if ( ( testStatus == SELF_TEST_STATUS_PASSED ) || ( testStatus == SELF_TEST_STATUS_FAILED ) ) { - result = (DG_POST_STATE_T)((int)postState + 1); // move on to next POST test + BOOL passed = ( testStatus == SELF_TEST_STATUS_PASSED ? TRUE : FALSE ); + + // Broadcast passed POST result + sendPOSTTestResult( (DG_POST_STATE_T)((int)postState), passed ); + // Move on to next POST test + result = (DG_POST_STATE_T)((int)postState + 1); if ( testStatus == SELF_TEST_STATUS_FAILED ) { tempPOSTPassed = FALSE; @@ -277,4 +291,20 @@ return postState; } +/*********************************************************************//** + * @brief + * The execFWCompatibilityTest function executes the firmware compatibility test. + * @details Inputs: none + * @details Outputs: none + * @return in progress, passed, or failed + *************************************************************************/ +static SELF_TEST_STATUS_T execFWCompatibilityTest( void ) +{ + SELF_TEST_STATUS_T result = SELF_TEST_STATUS_PASSED; + + // TODO - implement + + return result; +} + /**@}*/