refactoring: more logical initialization sequence

This commit is contained in:
rusefi 2019-01-11 00:08:26 -05:00
parent b4d9de3312
commit 533fdf31ba
1 changed files with 7 additions and 9 deletions

View File

@ -166,6 +166,7 @@ void runRusEfi(void) {
engine->setConfig(config); engine->setConfig(config);
initIntermediateLoggingBuffer(); initIntermediateLoggingBuffer();
initErrorHandling(); initErrorHandling();
addConsoleAction("reboot", scheduleReboot);
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) #if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
/** /**
@ -181,6 +182,11 @@ void runRusEfi(void) {
*/ */
initDataStructures(PASS_ENGINE_PARAMETER_SIGNATURE); initDataStructures(PASS_ENGINE_PARAMETER_SIGNATURE);
/**
* First data structure keeps track of which hardware I/O pins are used by whom
*/
initPinRepository();
/** /**
* First thing is reading configuration from flash memory. * First thing is reading configuration from flash memory.
* In order to have complete flexibility configuration has to go before anything else. * In order to have complete flexibility configuration has to go before anything else.
@ -189,18 +195,11 @@ void runRusEfi(void) {
// TODO: need to fix this place!!! should be a version of PASS_ENGINE_PARAMETER_SIGNATURE somehow // TODO: need to fix this place!!! should be a version of PASS_ENGINE_PARAMETER_SIGNATURE somehow
prepareVoidConfiguration(&activeConfiguration); prepareVoidConfiguration(&activeConfiguration);
/**
* First data structure keeps track of which hardware I/O pins are used by whom
*/
initPinRepository();
/** /**
* Next we should initialize serial port console, it's important to know what's going on * Next we should initialize serial port console, it's important to know what's going on
*/ */
initializeConsole(&sharedLogger); initializeConsole(&sharedLogger);
addConsoleAction("reboot", scheduleReboot);
/** /**
* Initialize hardware drivers * Initialize hardware drivers
*/ */
@ -212,6 +211,7 @@ void runRusEfi(void) {
* todo: should we initialize some? most? controllers before hardware? * todo: should we initialize some? most? controllers before hardware?
*/ */
initEngineContoller(&sharedLogger PASS_ENGINE_PARAMETER_SIGNATURE); initEngineContoller(&sharedLogger PASS_ENGINE_PARAMETER_SIGNATURE);
rememberCurrentConfiguration();
#if EFI_PERF_METRICS || defined(__DOXYGEN__) #if EFI_PERF_METRICS || defined(__DOXYGEN__)
initTimePerfActions(&sharedLogger); initTimePerfActions(&sharedLogger);
@ -224,8 +224,6 @@ void runRusEfi(void) {
runSchedulingPrecisionTestIfNeeded(); runSchedulingPrecisionTestIfNeeded();
rememberCurrentConfiguration();
print("Running main loop\r\n"); print("Running main loop\r\n");
main_loop_started = true; main_loop_started = true;
/** /**