void systemTask(void *arg) { bool pass = true; ledInit(); ledSet(CHG_LED, 1); #ifdef DEBUG_QUEUE_MONITOR queueMonitorInit(); #endif #ifdef ENABLE_UART1 uart1Init(); #endif #ifdef ENABLE_UART2 uart2Init(); #endif //Init the high-levels modules systemInit(); commInit(); commanderInit(); StateEstimatorType estimator = anyEstimator; deckInit(); estimator = deckGetRequiredEstimator(); stabilizerInit(estimator); if (deckGetRequiredLowInterferenceRadioMode()) { platformSetLowInterferenceRadioMode(); } soundInit(); memInit(); #ifdef PROXIMITY_ENABLED proximityInit(); #endif //Test the modules pass &= systemTest(); pass &= configblockTest(); pass &= commTest(); pass &= commanderTest(); pass &= stabilizerTest(); pass &= deckTest(); pass &= soundTest(); pass &= memTest(); pass &= watchdogNormalStartTest(); //Start the firmware if(pass) { selftestPassed = 1; systemStart(); soundSetEffect(SND_STARTUP); ledseqRun(SYS_LED, seq_alive); ledseqRun(LINK_LED, seq_testPassed); } else { selftestPassed = 0; if (systemTest()) { while(1) { ledseqRun(SYS_LED, seq_testPassed); //Red passed == not passed! vTaskDelay(M2T(2000)); // System can be forced to start by setting the param to 1 from the cfclient if (selftestPassed) { DEBUG_PRINT("Start forced.\n"); systemStart(); break; } } } else { ledInit(); ledSet(SYS_LED, true); } } DEBUG_PRINT("Free heap: %d bytes\n", xPortGetFreeHeapSize()); workerLoop(); //Should never reach this point! while(1) vTaskDelay(portMAX_DELAY); }
void systemTask(void *arg) { bool pass = true; ledInit(); ledSet(CHG_LED, 1); #ifdef DEBUG_QUEUE_MONITOR queueMonitorInit(); #endif uartInit(); #ifdef ENABLE_UART1 uart1Init(); #endif #ifdef ENABLE_UART2 uart2Init(); #endif //Init the high-levels modules systemInit(); #ifndef USE_RADIOLINK_CRTP #ifdef UART_OUTPUT_TRACE_DATA //debugInitTrace(); #endif #ifdef ENABLE_UART // uartInit(); #endif #endif //ndef USE_RADIOLINK_CRTP commInit(); commanderAdvancedInit(); stabilizerInit(); #ifdef PLATFORM_CF2 deckInit(); #endif soundInit(); memInit(); #ifdef PROXIMITY_ENABLED proximityInit(); #endif //Test the modules pass &= systemTest(); pass &= configblockTest(); pass &= commTest(); pass &= commanderAdvancedTest(); pass &= stabilizerTest(); #ifdef PLATFORM_CF2 pass &= deckTest(); #endif pass &= soundTest(); pass &= memTest(); pass &= watchdogNormalStartTest(); //Start the firmware if(pass) { selftestPassed = 1; systemStart(); soundSetEffect(SND_STARTUP); ledseqRun(SYS_LED, seq_alive); ledseqRun(LINK_LED, seq_testPassed); } else { selftestPassed = 0; if (systemTest()) { while(1) { ledseqRun(SYS_LED, seq_testPassed); //Red passed == not passed! vTaskDelay(M2T(2000)); // System can be forced to start by setting the param to 1 from the cfclient if (selftestPassed) { DEBUG_PRINT("Start forced.\n"); systemStart(); break; } } } else { ledInit(); ledSet(SYS_LED, true); } } DEBUG_PRINT("Free heap: %d bytes\n", xPortGetFreeHeapSize()); workerLoop(); //Should never reach this point! while(1) vTaskDelay(portMAX_DELAY); }