Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r72dd42b6a116e62d1b3ad5d60088c29e067d10d4 -r5156a859330f51537606ffdab32ea63d8fac9cac --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 72dd42b6a116e62d1b3ad5d60088c29e067d10d4) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 5156a859330f51537606ffdab32ea63d8fac9cac) @@ -27,6 +27,7 @@ #include "OperationModes.h" #include "Pressures.h" #include "RTC.h" +#include "SystemCommMessages.h" #include "TemperatureSensors.h" #include "Thermistors.h" #include "UVReactors.h" @@ -47,6 +48,7 @@ // ********** private function prototypes ********** static DG_POST_STATE_T handlePOSTStatus( SELF_TEST_STATUS_T testStatus ); +static SELF_TEST_STATUS_T execFWCompatibilityTest( void ); /*********************************************************************//** * @brief @@ -92,7 +94,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 @@ -102,6 +104,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 ); @@ -117,11 +124,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 @@ -176,6 +178,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 ) { @@ -188,18 +196,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; @@ -252,7 +262,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; @@ -275,4 +290,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; +} + /**@}*/