Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -rf656b17f3d8d93b4fca49c9725e096e7eb55acc7 -r1a5efe97f5f39594b45797fded52cafce92afe80 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision f656b17f3d8d93b4fca49c9725e096e7eb55acc7) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 1a5efe97f5f39594b45797fded52cafce92afe80) @@ -26,6 +26,7 @@ #include "OperationModes.h" #include "Pressures.h" #include "RTC.h" +#include "SystemCommMessages.h" #include "TemperatureSensors.h" #include "Thermistors.h" #include "UVReactors.h" @@ -46,6 +47,7 @@ // ********** private function prototypes ********** static DG_POST_STATE_T handlePOSTStatus( SELF_TEST_STATUS_T testStatus ); +static SELF_TEST_STATUS_T execFWCompatibilityTest( void ); /*********************************************************************//** * @brief @@ -91,7 +93,7 @@ switch ( postState ) { case DG_POST_STATE_START: - postState = DG_POST_STATE_FPGA; + postState = DG_POST_STATE_FW_COMPATIBILITY; #ifdef SKIP_POST postState = DG_POST_STATE_COMPLETED; #endif @@ -101,6 +103,11 @@ #endif break; + case DG_POST_STATE_FW_COMPATIBILITY: + testStatus = execFWCompatibilityTest(); + postState = handlePOSTStatus( testStatus ); + break; + case DG_POST_STATE_FPGA: testStatus = execFPGATest(); postState = handlePOSTStatus( testStatus ); @@ -116,11 +123,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 @@ -170,6 +172,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 ) { @@ -182,18 +190,20 @@ break; case DG_POST_STATE_COMPLETED: - // set overall HD POST status to "passed" + // Set overall HD POST status to "passed" postPassed = TRUE; - // set overall HD 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: - // TODO - send POST status on CAN - // will want POST faults to wait for us to get here before sending 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; @@ -246,7 +256,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; @@ -269,4 +284,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; +} + /**@}*/