fome-fw/firmware/controllers/engine_controller.cpp

511 lines
15 KiB
C++
Raw Normal View History

2014-08-29 07:52:33 -07:00
/**
* @file engine_controller.cpp
* @brief Controllers package entry point code
*
*
*
* @date Feb 7, 2013
2015-01-12 15:04:10 -08:00
* @author Andrey Belomutskiy, (c) 2012-2015
2014-08-29 07:52:33 -07:00
*
* This file is part of rusEfi - see http://rusefi.com
*
* rusEfi is free software; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "main.h"
2014-12-27 13:03:38 -08:00
#include "engine_configuration.h"
2014-08-29 07:52:33 -07:00
#include "trigger_central.h"
#include "engine_controller.h"
2014-12-27 13:03:38 -08:00
#include "fsio_core.h"
#include "fsio_impl.h"
2014-08-29 07:52:33 -07:00
#include "idle_thread.h"
#include "rpm_calculator.h"
#include "signal_executor.h"
#include "main_trigger_callback.h"
#include "io_pins.h"
#include "flash_main.h"
#include "tunerstudio.h"
#include "injector_central.h"
#include "rfiutil.h"
#include "engine_math.h"
#include "wave_analyzer.h"
#include "allsensors.h"
#include "analog_chart.h"
#include "electronic_throttle.h"
#include "map_averaging.h"
#include "malfunction_central.h"
2015-02-25 05:08:28 -08:00
#include "malfunction_indicator.h"
2015-02-10 20:04:38 -08:00
#include "engine.h"
#include "algo.h"
2015-02-16 15:08:13 -08:00
#include "LocalVersionHolder.h"
2015-02-10 20:04:38 -08:00
2015-02-14 20:04:14 -08:00
#if HAL_USE_ADC || defined(__DOXYGEN__)
#include "AdcConfiguration.h"
#endif
2015-02-10 20:04:38 -08:00
#if EFI_PROD_CODE
2014-08-29 07:52:33 -07:00
#include "pwm_generator.h"
#include "adc_inputs.h"
#include "efilib2.h"
#include "PwmTester.h"
2014-12-04 19:03:19 -08:00
#include "pwm_generator.h"
2015-01-07 06:03:48 -08:00
#include "lcd_controller.h"
2015-02-10 20:04:38 -08:00
#include "pin_repository.h"
#endif
2014-10-06 02:03:01 -07:00
2014-11-24 09:03:09 -08:00
extern bool hasFirmwareErrorFlag;
2014-11-23 20:03:16 -08:00
2014-11-22 09:03:10 -08:00
persistent_config_container_s persistentState CCM_OPTIONAL;
2014-08-29 07:52:33 -07:00
2015-02-27 18:04:25 -08:00
persistent_config_s *config = &persistentState.persistentConfiguration;
2015-02-27 16:09:09 -08:00
2014-09-08 15:02:52 -07:00
/**
* todo: it really looks like these fields should become 'static', i.e. private
* the whole 'extern ...' pattern is less then perfect, I guess the 'God object' Engine
* would be a smaller evil. Whatever is needed should be passed into methods/modules/files as an explicit parameter.
*/
2014-08-29 07:52:33 -07:00
engine_configuration_s *engineConfiguration = &persistentState.persistentConfiguration.engineConfiguration;
board_configuration_s *boardConfiguration = &persistentState.persistentConfiguration.engineConfiguration.bc;
/**
* CH_FREQUENCY is the number of system ticks in a second
*/
2015-02-26 19:04:29 -08:00
static VirtualTimer periodicTimer;
2014-08-29 07:52:33 -07:00
2015-02-09 09:05:46 -08:00
static LoggingWithStorage logger("Engine Controller");
2014-08-29 07:52:33 -07:00
2014-12-24 11:05:19 -08:00
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
2014-11-22 09:03:10 -08:00
static engine_configuration2_s ec2 CCM_OPTIONAL;
2014-08-29 07:52:33 -07:00
engine_configuration2_s * engineConfiguration2 = &ec2;
2014-12-24 11:05:19 -08:00
#endif
2014-08-29 07:52:33 -07:00
2014-11-07 19:04:45 -08:00
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
2014-09-08 15:02:52 -07:00
/**
* todo: this should probably become 'static', i.e. private, and propagated around explicitly?
*/
2015-02-27 15:08:55 -08:00
Engine _engine(&persistentState.persistentConfiguration);
2014-11-07 19:04:45 -08:00
Engine * engine = &_engine;
#endif
2014-08-29 07:52:33 -07:00
2014-10-21 08:04:12 -07:00
/**
* I am not sure if this needs to be configurable.
*
* Also technically the whole feature might be implemented as cranking fuel coefficient curve by TPS.
*/
#define CLEANUP_MODE_TPS 95
2015-01-07 16:03:45 -08:00
extern OutputPin runningPin;
2014-08-29 07:52:33 -07:00
static msg_t csThread(void) {
chRegSetThreadName("status");
2014-12-24 10:05:36 -08:00
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
2014-12-04 19:03:19 -08:00
while (true) {
2014-10-02 20:03:25 -07:00
int rpm = getRpm();
int is_cranking = isCrankingR(rpm);
int is_running = rpm > 0 && !is_cranking;
2014-08-29 07:52:33 -07:00
if (is_running) {
// blinking while running
2015-01-07 16:03:45 -08:00
runningPin.setValue(0);
2014-08-29 07:52:33 -07:00
chThdSleepMilliseconds(50);
2015-01-07 16:03:45 -08:00
runningPin.setValue(1);
2014-08-29 07:52:33 -07:00
chThdSleepMilliseconds(50);
} else {
// constant on while cranking and off if engine is stopped
2015-01-07 16:03:45 -08:00
runningPin.setValue(is_cranking);
2014-08-29 07:52:33 -07:00
chThdSleepMilliseconds(100);
}
}
#endif /* EFI_SHAFT_POSITION_INPUT */
return -1;
}
static void updateErrorCodes(void) {
/**
* technically we can set error codes right inside the getMethods, but I a bit on a fence about it
*/
2015-02-27 14:07:50 -08:00
setError(isValidIntakeAirTemperature(getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F)),
2014-10-07 08:04:35 -07:00
OBD_Intake_Air_Temperature_Circuit_Malfunction);
2015-02-27 14:07:50 -08:00
setError(isValidCoolantTemperature(getCoolantTemperature(PASS_ENGINE_PARAMETER_F)),
2014-10-07 08:04:35 -07:00
OBD_Engine_Coolant_Temperature_Circuit_Malfunction);
2014-08-29 07:52:33 -07:00
}
2015-01-12 20:03:39 -08:00
//static void fanRelayControl(void) {
// if (boardConfiguration->fanPin == GPIO_UNASSIGNED)
// return;
//
// int isCurrentlyOn = getLogicPinValue(&en);
// int newValue;
// if (isCurrentlyOn) {
// // if the fan is already on, we keep it on till the 'fanOff' temperature
// newValue = getCoolantTemperature(engine) > engineConfiguration->fanOffTemperature;
// } else {
// newValue = getCoolantTemperature(engine) > engineConfiguration->fanOnTemperature;
// }
//
// if (isCurrentlyOn != newValue) {
// if (isRunningBenchTest())
// return; // let's not mess with bench testing
// scheduleMsg(&logger, "FAN relay: %s", newValue ? "ON" : "OFF");
// setOutputPinValue(FAN_RELAY, newValue);
// }
//}
2014-08-29 07:52:33 -07:00
2015-02-10 20:04:38 -08:00
#if EFI_PROD_CODE || defined(__DOXYGEN__)
2014-08-29 07:52:33 -07:00
Overflow64Counter halTime;
2015-01-19 13:03:56 -08:00
//todo: macro to save method invocation
2015-01-02 19:03:40 -08:00
efitimeus_t getTimeNowUs(void) {
2014-09-12 20:04:25 -07:00
return getTimeNowNt() / (CORE_CLOCK / 1000000);
}
2015-01-19 13:03:56 -08:00
//todo: macro to save method invocation
2015-01-02 19:03:40 -08:00
efitick_t getTimeNowNt(void) {
2014-11-16 21:03:45 -08:00
return halTime.get();
2014-08-29 07:52:33 -07:00
}
efitimems_t currentTimeMillis(void) {
// todo: migrate to getTimeNowUs? or not?
return chTimeNow() / TICKS_IN_MS;
}
int getTimeNowSeconds(void) {
return chTimeNow() / CH_FREQUENCY;
}
2015-02-10 20:04:38 -08:00
#endif /* EFI_PROD_CODE */
2014-10-15 14:02:58 -07:00
static void cylinderCleanupControl(Engine *engine) {
2015-01-20 15:04:01 -08:00
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
2014-10-15 14:02:58 -07:00
bool newValue;
if (engineConfiguration->isCylinderCleanupEnabled) {
2014-11-24 19:03:19 -08:00
newValue = isCrankingE(engine) && getTPS(PASS_ENGINE_PARAMETER_F) > CLEANUP_MODE_TPS;
2014-10-15 14:02:58 -07:00
} else {
newValue = false;
}
2014-10-31 12:03:00 -07:00
if (newValue != engine->isCylinderCleanupMode) {
engine->isCylinderCleanupMode = newValue;
2014-10-15 14:02:58 -07:00
scheduleMsg(&logger, "isCylinderCleanupMode %s", boolToString(newValue));
}
2015-01-20 15:04:01 -08:00
#endif
2014-10-18 04:03:25 -07:00
}
2015-02-16 15:08:13 -08:00
static LocalVersionHolder versionForConfigurationListeners;
2015-02-26 19:04:29 -08:00
static void periodicCallback(Engine *engine);
2015-02-24 16:11:57 -08:00
static void scheduleNextInvocation(void) {
// schedule next invocation
int period = boardConfiguration->generalPeriodicThreadPeriod;
if (period == 0)
period = 50; // this might happen while resetting config
2015-02-26 19:04:29 -08:00
chVTSetAny(&periodicTimer, period * TICKS_IN_MS, (vtfunc_t) &periodicCallback, engine);
2015-02-24 16:11:57 -08:00
}
2015-02-26 19:04:29 -08:00
static void periodicCallback(Engine *engine) {
2015-02-24 10:15:24 -08:00
efiAssertVoid(getRemainingStack(chThdSelf()) > 64, "lowStckOnEv");
2015-02-10 20:04:38 -08:00
#if EFI_PROD_CODE
2014-08-29 07:52:33 -07:00
/**
* We need to push current value into the 64 bit counter often enough so that we do not miss an overflow
*/
2014-11-16 21:03:45 -08:00
bool alreadyLocked = lockAnyContext();
updateAndSet(&halTime.state, hal_lld_get_counter_value());
if (!alreadyLocked) {
unlockAnyContext();
}
2015-02-10 20:04:38 -08:00
#endif
2014-08-29 07:52:33 -07:00
2015-02-24 20:04:21 -08:00
#if (EFI_PROD_CODE && EFI_ENGINE_CONTROL && EFI_INTERNAL_FLASH) || defined(__DOXYGEN__)
if (!engine->rpmCalculator.isRunning()) {
2014-08-29 07:52:33 -07:00
writeToFlashIfPending();
2015-02-24 20:04:21 -08:00
}
2015-01-20 15:04:01 -08:00
#endif
2014-08-29 07:52:33 -07:00
2015-02-16 15:08:13 -08:00
if (versionForConfigurationListeners.isOld()) {
/**
* version change could happen for multiple reason and on different threads
* in order to be sure which thread (and which stack) invokes the potentially heavy
* listeners we invoke them from here.
*/
engine->configurationListeners.invokeJustArgCallbacks();
}
2014-10-21 12:02:57 -07:00
engine->watchdog();
engine->updateSlowSensors();
2014-08-29 07:52:33 -07:00
2015-02-10 20:04:38 -08:00
#if (EFI_PROD_CODE && EFI_FSIO) || defined(__DOXYGEN__)
2014-12-27 13:03:38 -08:00
runFsio();
2015-01-20 15:04:01 -08:00
#endif
2014-11-29 08:03:49 -08:00
2014-08-29 07:52:33 -07:00
updateErrorCodes();
2014-10-21 12:02:57 -07:00
cylinderCleanupControl(engine);
2014-10-15 14:02:58 -07:00
2015-02-24 16:11:57 -08:00
scheduleNextInvocation();
2014-08-29 07:52:33 -07:00
}
2015-02-10 20:04:38 -08:00
void initPeriodicEvents(Engine *engine) {
2015-02-24 16:11:57 -08:00
scheduleNextInvocation();
2014-08-29 07:52:33 -07:00
}
char * getPinNameByAdcChannel(adc_channel_e hwChannel, char *buffer) {
2014-12-23 21:03:35 -08:00
#if HAL_USE_ADC || defined(__DOXYGEN__)
2014-08-29 07:52:33 -07:00
strcpy((char*) buffer, portname(getAdcChannelPort(hwChannel)));
itoa10(&buffer[2], getAdcChannelPin(hwChannel));
2014-12-23 21:03:35 -08:00
#else
strcpy(buffer, "NONE");
#endif
2014-08-29 07:52:33 -07:00
return (char*) buffer;
}
static char pinNameBuffer[16];
2015-02-14 20:04:14 -08:00
#if HAL_USE_ADC || defined(__DOXYGEN__)
extern AdcDevice fastAdc;
#endif
2014-08-29 07:52:33 -07:00
static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel, float adcVoltage) {
2014-12-23 21:03:35 -08:00
#if HAL_USE_ADC || defined(__DOXYGEN__)
2015-02-16 15:08:13 -08:00
if (fastAdc.isHwUsed(hwChannel)) {
2015-02-14 20:04:14 -08:00
scheduleMsg(&logger, "fast enabled=%s", boolToString(boardConfiguration->isFastAdcEnabled));
}
2014-08-29 07:52:33 -07:00
float voltage = adcVoltage * engineConfiguration->analogInputDividerCoefficient;
2014-09-11 18:02:50 -07:00
scheduleMsg(&logger, "%s ADC%d %s %s rawValue=%f/divided=%fv", name, hwChannel, getAdcMode(hwChannel),
2014-08-29 07:52:33 -07:00
getPinNameByAdcChannel(hwChannel, pinNameBuffer), adcVoltage, voltage);
2014-12-23 21:03:35 -08:00
#endif
2014-08-29 07:52:33 -07:00
}
static void printAnalogChannelInfo(const char *name, adc_channel_e hwChannel) {
2014-12-23 21:03:35 -08:00
#if HAL_USE_ADC || defined(__DOXYGEN__)
2014-11-26 20:03:05 -08:00
if (hwChannel != EFI_ADC_NONE) {
printAnalogChannelInfoExt(name, hwChannel, getVoltage(hwChannel));
}
2014-12-23 21:03:35 -08:00
#endif
2014-08-29 07:52:33 -07:00
}
static void printAnalogInfo(void) {
2015-01-05 21:03:38 -08:00
printAnalogChannelInfo("hip9011", EFI_ADC_10);
2014-08-29 07:52:33 -07:00
printAnalogChannelInfo("TPS", engineConfiguration->tpsAdcChannel);
printAnalogChannelInfo("CLT", engineConfiguration->cltAdcChannel);
2014-10-31 11:05:18 -07:00
if (engineConfiguration->hasIatSensor) {
printAnalogChannelInfo("IAT", engineConfiguration->iatAdcChannel);
}
2015-02-14 20:04:14 -08:00
if (engineConfiguration->hasMafSensor) {
printAnalogChannelInfo("MAF", engineConfiguration->mafAdcChannel);
}
2015-01-28 17:06:25 -08:00
printAnalogChannelInfo("AFR", engineConfiguration->afr.hwChannel);
2015-02-14 20:04:14 -08:00
if (engineConfiguration->hasMapSensor) {
printAnalogChannelInfo("MAP", engineConfiguration->map.sensor.hwChannel);
}
2014-10-31 11:05:18 -07:00
if (engineConfiguration->hasBaroSensor) {
printAnalogChannelInfo("BARO", engineConfiguration->baroSensor.hwChannel);
}
2014-11-26 20:03:05 -08:00
printAnalogChannelInfo("A/C sw", engineConfiguration->acSwitchAdc);
2015-01-15 16:03:56 -08:00
printAnalogChannelInfo("HIP9011", engineConfiguration->hipOutputChannel);
2014-11-06 10:04:30 -08:00
printAnalogChannelInfoExt("Vbatt", engineConfiguration->vbattAdcChannel, getVBatt(engineConfiguration));
2014-08-29 07:52:33 -07:00
}
static THD_WORKING_AREA(csThreadStack, UTILITY_THREAD_STACK_SIZE); // declare thread stack
2015-01-02 07:03:34 -08:00
#define isOutOfBounds(offset) ((offset<0) || (offset) >= sizeof(engine_configuration_s))
2014-10-13 10:03:07 -07:00
2015-01-26 16:04:19 -08:00
static void getShort(int offset) {
if (isOutOfBounds(offset))
return;
2015-02-27 15:08:55 -08:00
uint16_t *ptr = (uint16_t *) (&((char *) engineConfiguration)[offset]);
2015-01-26 16:04:19 -08:00
uint16_t value = *ptr;
2015-02-16 14:04:20 -08:00
/**
* this response is part of dev console API
*/
2015-01-26 16:04:19 -08:00
scheduleMsg(&logger, "short @%d is %d", offset, value);
}
2015-02-16 14:04:20 -08:00
static void setShort(const int offset, const int value) {
2015-01-02 07:03:34 -08:00
if (isOutOfBounds(offset))
return;
2015-02-27 15:08:55 -08:00
uint16_t *ptr = (uint16_t *) (&((char *) engineConfiguration)[offset]);
2015-02-16 14:04:20 -08:00
*ptr = (uint16_t) value;
getShort(offset);
2014-12-03 08:03:52 -08:00
}
2014-12-04 05:03:27 -08:00
static void getInt(int offset) {
2015-01-02 07:03:34 -08:00
if (isOutOfBounds(offset))
return;
2015-02-27 15:08:55 -08:00
int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
2014-12-04 05:03:27 -08:00
int value = *ptr;
2015-02-16 14:04:20 -08:00
/**
* this response is part of dev console API
*/
2014-12-04 05:03:27 -08:00
scheduleMsg(&logger, "int @%d is %d", offset, value);
}
2015-02-16 14:04:20 -08:00
static void setInt(const int offset, const int value) {
if (isOutOfBounds(offset))
return;
2015-02-27 15:08:55 -08:00
int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
2015-02-16 14:04:20 -08:00
*ptr = value;
getInt(offset);
}
2014-12-03 08:03:52 -08:00
static void getFloat(int offset) {
2015-01-02 07:03:34 -08:00
if (isOutOfBounds(offset))
return;
2015-02-27 15:08:55 -08:00
float *ptr = (float *) (&((char *) engineConfiguration)[offset]);
2014-12-03 08:03:52 -08:00
float value = *ptr;
2015-02-16 14:04:20 -08:00
/**
* this response is part of dev console API
*/
2015-02-18 19:07:49 -08:00
scheduleMsg(&logger, "float @%d is %..100000f", offset, value);
2014-12-03 08:03:52 -08:00
}
2014-12-03 05:04:17 -08:00
2014-12-03 08:03:52 -08:00
static void setFloat(const char *offsetStr, const char *valueStr) {
int offset = atoi(offsetStr);
if (absI(offset) == absI(ERROR_CODE)) {
scheduleMsg(&logger, "invalid offset [%s]", offsetStr);
return;
}
2015-01-02 07:03:34 -08:00
if (isOutOfBounds(offset))
return;
2014-12-03 08:03:52 -08:00
float value = atoff(valueStr);
if (cisnan(value)) {
scheduleMsg(&logger, "invalid value [%s]", valueStr);
return;
}
2014-12-04 19:03:19 -08:00
float *ptr = (float *) (&((char *) engine->engineConfiguration)[offset]);
2014-12-03 08:03:52 -08:00
*ptr = value;
2015-02-16 14:04:20 -08:00
getFloat(offset);
2014-12-03 05:04:17 -08:00
}
2015-02-25 05:08:28 -08:00
#if EFI_PROD_CODE || defined(__DOXYGEN__)
2015-02-19 19:05:01 -08:00
static void resetAccel(void) {
engine->accelEnrichment.reset();
}
#endif
2015-02-26 19:04:29 -08:00
void initConfigActions(void) {
addConsoleActionSS("set_float", (VoidCharPtrCharPtr) setFloat);
addConsoleActionII("set_int", (VoidIntInt) setInt);
addConsoleActionII("set_short", (VoidIntInt) setShort);
addConsoleActionI("get_float", getFloat);
addConsoleActionI("get_int", getInt);
addConsoleActionI("get_short", getShort);
}
2015-01-14 15:04:00 -08:00
void initEngineContoller(Logging *sharedLogger, Engine *engine) {
2014-09-11 18:02:50 -07:00
if (hasFirmwareError()) {
2014-08-29 07:52:33 -07:00
return;
2014-09-11 18:02:50 -07:00
}
2014-08-29 07:52:33 -07:00
2015-02-18 18:05:47 -08:00
initSensors(sharedLogger PASS_ENGINE_PARAMETER_F);
2014-08-29 07:52:33 -07:00
2015-02-25 05:08:28 -08:00
#if EFI_PROD_CODE || defined(__DOXYGEN__)
2014-08-29 07:52:33 -07:00
initPwmGenerator();
2015-02-10 20:04:38 -08:00
#endif
2014-08-29 07:52:33 -07:00
2015-02-25 05:08:28 -08:00
#if EFI_ANALOG_CHART || defined(__DOXYGEN__)
2014-08-29 07:52:33 -07:00
initAnalogChart();
#endif /* EFI_ANALOG_CHART */
2015-02-14 19:04:03 -08:00
initAlgo(sharedLogger, engineConfiguration);
2015-02-26 19:04:29 -08:00
initConfigActions();
2014-08-29 07:52:33 -07:00
2015-02-25 05:08:28 -08:00
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
2014-09-11 20:02:56 -07:00
if (engineConfiguration->isWaveAnalyzerEnabled) {
2015-01-14 15:04:00 -08:00
initWaveAnalyzer(sharedLogger);
2014-09-11 20:02:56 -07:00
}
2014-08-29 07:52:33 -07:00
#endif /* EFI_WAVE_ANALYZER */
2014-12-24 10:05:36 -08:00
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
2014-08-29 07:52:33 -07:00
/**
* there is an implicit dependency on the fact that 'tachometer' listener is the 1st listener - this case
* other listeners can access current RPM value
*/
2014-11-08 09:03:07 -08:00
initRpmCalculator(engine);
2014-08-29 07:52:33 -07:00
#endif /* EFI_SHAFT_POSITION_INPUT */
2015-02-25 05:08:28 -08:00
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
2014-09-11 20:02:56 -07:00
if (engineConfiguration->isTunerStudioEnabled) {
2015-01-14 16:03:39 -08:00
startTunerStudioConnectivity(sharedLogger);
2014-09-11 20:02:56 -07:00
}
2014-08-29 07:52:33 -07:00
#endif
// multiple issues with this initMapAdjusterThread();
2014-10-21 12:02:57 -07:00
initPeriodicEvents(engine);
2014-08-29 07:52:33 -07:00
chThdCreateStatic(csThreadStack, sizeof(csThreadStack), LOWPRIO, (tfunc_t) csThread, NULL);
2015-02-10 20:04:38 -08:00
#if (EFI_PROD_CODE && EFI_ENGINE_CONTROL) || defined(__DOXYGEN__)
2014-11-05 20:03:20 -08:00
initInjectorCentral(engine);
2014-08-29 07:52:33 -07:00
initIgnitionCentral();
2014-11-10 08:04:09 -08:00
/**
* This has to go after 'initInjectorCentral' and 'initInjectorCentral' in order to
* properly detect un-assigned output pins
*/
2015-02-27 15:08:55 -08:00
prepareShapes(PASS_ENGINE_PARAMETER_F);
2015-01-20 15:04:01 -08:00
#endif
2015-02-25 05:08:28 -08:00
#if EFI_PWM_TESTER || defined(__DOXYGEN__)
2015-01-20 15:04:01 -08:00
initPwmTester();
#endif
2014-11-10 08:04:09 -08:00
2014-08-29 07:52:33 -07:00
initMalfunctionCentral();
2015-02-25 05:08:28 -08:00
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
2014-08-29 07:52:33 -07:00
initElectronicThrottle();
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
2014-12-23 22:03:26 -08:00
#if EFI_MALFUNCTION_INDICATOR || defined(__DOXYGEN__)
2014-09-11 20:02:56 -07:00
if (engineConfiguration->isMilEnabled) {
2014-12-10 09:03:39 -08:00
initMalfunctionIndicator(engine);
2014-09-11 20:02:56 -07:00
}
2014-08-29 07:52:33 -07:00
#endif /* EFI_MALFUNCTION_INDICATOR */
2014-12-23 22:03:26 -08:00
#if EFI_MAP_AVERAGING || defined(__DOXYGEN__)
2014-09-11 20:02:56 -07:00
if (engineConfiguration->isMapAveragingEnabled) {
2015-01-14 18:03:44 -08:00
initMapAveraging(sharedLogger, engine);
2014-09-11 20:02:56 -07:00
}
2014-08-29 07:52:33 -07:00
#endif /* EFI_MAP_AVERAGING */
2014-12-23 22:03:26 -08:00
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
2014-09-11 18:02:50 -07:00
if (boardConfiguration->isEngineControlEnabled) {
/**
* This method initialized the main listener which actually runs injectors & ignition
*/
2015-01-14 17:06:02 -08:00
initMainEventListener(sharedLogger, engine);
2014-09-11 18:02:50 -07:00
}
2014-08-29 07:52:33 -07:00
#endif /* EFI_ENGINE_CONTROL */
2014-12-23 22:03:26 -08:00
#if EFI_IDLE_CONTROL || defined(__DOXYGEN__)
2014-09-11 20:02:56 -07:00
if (engineConfiguration->isIdleThreadEnabled) {
2015-01-14 19:04:08 -08:00
startIdleThread(sharedLogger, engine);
2014-09-11 20:02:56 -07:00
}
2014-08-29 07:52:33 -07:00
#endif
addConsoleAction("analoginfo", printAnalogInfo);
2014-10-13 10:03:07 -07:00
2015-02-26 19:04:29 -08:00
initConfigActions();
2015-02-19 19:05:01 -08:00
#if EFI_PROD_CODE
addConsoleAction("reset_accel", resetAccel);
#endif
2014-12-06 12:04:01 -08:00
2015-02-10 20:04:38 -08:00
#if (EFI_PROD_CODE && EFI_FSIO) || defined(__DOXYGEN__)
2015-01-14 17:06:02 -08:00
initFsioImpl(sharedLogger, engine);
2015-01-20 15:04:01 -08:00
#endif
2015-01-07 06:03:48 -08:00
2015-01-20 15:04:01 -08:00
#if EFI_HD44780_LCD || defined(__DOXYGEN__)
2015-01-07 06:03:48 -08:00
initLcdController();
2015-01-20 15:04:01 -08:00
#endif
2014-08-29 07:52:33 -07:00
}