mirror of https://github.com/rusefi/rusefi-1.git
defined(__DOXYGEN__) ? #748
This commit is contained in:
parent
508e9d74e7
commit
541c445a2d
|
@ -8,7 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ALTERNATOR_CONTROL
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "rpm_calculator.h"
|
#include "rpm_calculator.h"
|
||||||
#include "alternator_controller.h"
|
#include "alternator_controller.h"
|
||||||
|
@ -32,7 +32,7 @@ static Pid altPid(altPidS);
|
||||||
|
|
||||||
static percent_t currentAltDuty;
|
static percent_t currentAltDuty;
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ private:
|
||||||
UNUSED(nowNt);
|
UNUSED(nowNt);
|
||||||
setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->alternatorControl.periodMs));
|
setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->alternatorControl.periodMs));
|
||||||
|
|
||||||
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if ! EFI_UNIT_TEST
|
||||||
if (shouldResetPid) {
|
if (shouldResetPid) {
|
||||||
pidReset();
|
pidReset();
|
||||||
shouldResetPid = false;
|
shouldResetPid = false;
|
||||||
|
@ -61,7 +61,7 @@ private:
|
||||||
if (engineConfiguration->debugMode == DBG_ALTERNATOR_PID) {
|
if (engineConfiguration->debugMode == DBG_ALTERNATOR_PID) {
|
||||||
// this block could be executed even in on/off alternator control mode
|
// this block could be executed even in on/off alternator control mode
|
||||||
// but at least we would reflect latest state
|
// but at least we would reflect latest state
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
altPid.postState(&tsOutputChannels);
|
altPid.postState(&tsOutputChannels);
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ private:
|
||||||
enginePins.alternatorPin.setValue(newState);
|
enginePins.alternatorPin.setValue(newState);
|
||||||
currentPlainOnOffState = newState;
|
currentPlainOnOffState = newState;
|
||||||
if (engineConfiguration->debugMode == DBG_ALTERNATOR_PID) {
|
if (engineConfiguration->debugMode == DBG_ALTERNATOR_PID) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels.debugIntField1 = newState;
|
tsOutputChannels.debugIntField1 = newState;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "local_version_holder.h"
|
#include "local_version_holder.h"
|
||||||
#include "allsensors.h"
|
#include "allsensors.h"
|
||||||
|
|
||||||
#if EFI_AUX_PID || defined(__DOXYGEN__)
|
#if EFI_AUX_PID
|
||||||
#include "pwm_generator.h"
|
#include "pwm_generator.h"
|
||||||
#include "tunerstudio_configuration.h"
|
#include "tunerstudio_configuration.h"
|
||||||
#include "fsio_impl.h"
|
#include "fsio_impl.h"
|
||||||
|
@ -27,7 +27,7 @@ extern fsio8_Map3D_f32t fsioTable1;
|
||||||
// todo: this is to some extent a copy-paste of alternator_controller. maybe same loop
|
// todo: this is to some extent a copy-paste of alternator_controller. maybe same loop
|
||||||
// for all PIDs?
|
// for all PIDs?
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
if (engineConfiguration->debugMode == DBG_AUX_PID_1) {
|
if (engineConfiguration->debugMode == DBG_AUX_PID_1) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
auxPid.postState(&tsOutputChannels);
|
auxPid.postState(&tsOutputChannels);
|
||||||
tsOutputChannels.debugIntField3 = (int)(10 * targetValue);
|
tsOutputChannels.debugIntField3 = (int)(10 * targetValue);
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
|
#if EFI_ELECTRONIC_THROTTLE_BODY
|
||||||
|
|
||||||
#include "electronic_throttle.h"
|
#include "electronic_throttle.h"
|
||||||
#include "tps.h"
|
#include "tps.h"
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
#include "pwm_generator.h"
|
#include "pwm_generator.h"
|
||||||
#include "dc_motor.h"
|
#include "dc_motor.h"
|
||||||
#include "pid_auto_tune.h"
|
#include "pid_auto_tune.h"
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
static bool shouldResetPid = false;
|
static bool shouldResetPid = false;
|
||||||
|
@ -160,12 +160,12 @@ private:
|
||||||
|
|
||||||
// set debug_mode 17
|
// set debug_mode 17
|
||||||
if (engineConfiguration->debugMode == DBG_ELECTRONIC_THROTTLE_PID) {
|
if (engineConfiguration->debugMode == DBG_ELECTRONIC_THROTTLE_PID) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
pid.postState(&tsOutputChannels);
|
pid.postState(&tsOutputChannels);
|
||||||
tsOutputChannels.debugIntField5 = feedForward;
|
tsOutputChannels.debugIntField5 = feedForward;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
} else if (engineConfiguration->debugMode == DBG_ELECTRONIC_THROTTLE_EXTRA) {
|
} else if (engineConfiguration->debugMode == DBG_ELECTRONIC_THROTTLE_EXTRA) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
// set debug_mode 29
|
// set debug_mode 29
|
||||||
tsOutputChannels.debugFloatField1 = valueOverride;
|
tsOutputChannels.debugFloatField1 = valueOverride;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#if EFI_IDLE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_IDLE_CONTROL
|
||||||
#include "engine_configuration.h"
|
#include "engine_configuration.h"
|
||||||
#include "rpm_calculator.h"
|
#include "rpm_calculator.h"
|
||||||
#include "pwm_generator.h"
|
#include "pwm_generator.h"
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
#include "allsensors.h"
|
#include "allsensors.h"
|
||||||
|
|
||||||
static Logging *logger;
|
static Logging *logger;
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
|
@ -48,7 +48,7 @@ static bool shouldResetPid = false;
|
||||||
// we might reset PID state when the state is changed, but only if needed (See autoIdle())
|
// we might reset PID state when the state is changed, but only if needed (See autoIdle())
|
||||||
static bool mightResetPid = false;
|
static bool mightResetPid = false;
|
||||||
|
|
||||||
#if EFI_IDLE_INCREMENTAL_PID_CIC || defined(__DOXYGEN__)
|
#if EFI_IDLE_INCREMENTAL_PID_CIC
|
||||||
// Use new PID with CIC integrator
|
// Use new PID with CIC integrator
|
||||||
static PidCic idlePid(&engineConfiguration->idleRpmPid);
|
static PidCic idlePid(&engineConfiguration->idleRpmPid);
|
||||||
#else
|
#else
|
||||||
|
@ -229,7 +229,7 @@ static percent_t automaticIdleController() {
|
||||||
// the state of PID has been changed, so we might reset it now, but only when needed (see idlePidDeactivationTpsThreshold)
|
// the state of PID has been changed, so we might reset it now, but only when needed (see idlePidDeactivationTpsThreshold)
|
||||||
mightResetPid = true;
|
mightResetPid = true;
|
||||||
|
|
||||||
#if EFI_IDLE_INCREMENTAL_PID_CIC || defined(__DOXYGEN__)
|
#if EFI_IDLE_INCREMENTAL_PID_CIC
|
||||||
// Treat the 'newValue' as if it contains not an actual IAC position, but an incremental delta.
|
// Treat the 'newValue' as if it contains not an actual IAC position, but an incremental delta.
|
||||||
// So we add this delta to the base IAC position, with a smooth taper for TPS transients.
|
// So we add this delta to the base IAC position, with a smooth taper for TPS transients.
|
||||||
newValue = baseIdlePosition + interpolateClamped(0.0f, newValue, CONFIGB(idlePidDeactivationTpsThreshold), 0.0f, tpsPos);
|
newValue = baseIdlePosition + interpolateClamped(0.0f, newValue, CONFIGB(idlePidDeactivationTpsThreshold), 0.0f, tpsPos);
|
||||||
|
@ -285,7 +285,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
// this value is not used yet
|
// this value is not used yet
|
||||||
if (CONFIGB(clutchDownPin) != GPIO_UNASSIGNED) {
|
if (CONFIGB(clutchDownPin) != GPIO_UNASSIGNED) {
|
||||||
engine->clutchDownState = efiReadPin(CONFIGB(clutchDownPin));
|
engine->clutchDownState = efiReadPin(CONFIGB(clutchDownPin));
|
||||||
|
@ -306,7 +306,7 @@ private:
|
||||||
undoIdleBlipIfNeeded();
|
undoIdleBlipIfNeeded();
|
||||||
|
|
||||||
float clt = engine->sensors.clt;
|
float clt = engine->sensors.clt;
|
||||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
bool isRunning = engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE);
|
bool isRunning = engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#else
|
#else
|
||||||
bool isRunning = false;
|
bool isRunning = false;
|
||||||
|
@ -362,13 +362,13 @@ private:
|
||||||
|
|
||||||
if (engineConfiguration->debugMode == DBG_IDLE_CONTROL) {
|
if (engineConfiguration->debugMode == DBG_IDLE_CONTROL) {
|
||||||
if (engineConfiguration->idleMode == IM_AUTO) {
|
if (engineConfiguration->idleMode == IM_AUTO) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
// see also tsOutputChannels->idlePosition
|
// see also tsOutputChannels->idlePosition
|
||||||
idlePid.postState(&tsOutputChannels, 1000000);
|
idlePid.postState(&tsOutputChannels, 1000000);
|
||||||
tsOutputChannels.debugIntField4 = idleState;
|
tsOutputChannels.debugIntField4 = idleState;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
} else {
|
} else {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels.debugFloatField1 = iacPosition;
|
tsOutputChannels.debugFloatField1 = iacPosition;
|
||||||
tsOutputChannels.debugIntField1 = iacMotor.getTargetPosition();
|
tsOutputChannels.debugIntField1 = iacMotor.getTargetPosition();
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
@ -508,7 +508,7 @@ void startIdleThread(Logging*sharedLogger) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engineConfiguration->brakePedalPin != GPIO_UNASSIGNED) {
|
if (engineConfiguration->brakePedalPin != GPIO_UNASSIGNED) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
efiSetPadMode("brake pedal switch", engineConfiguration->brakePedalPin,
|
efiSetPadMode("brake pedal switch", engineConfiguration->brakePedalPin,
|
||||||
getInputMode(engineConfiguration->brakePedalPinMode));
|
getInputMode(engineConfiguration->brakePedalPinMode));
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#if EFI_HD44780_LCD || defined(__DOXYGEN__)
|
#if EFI_HD44780_LCD
|
||||||
|
|
||||||
#include "lcd_controller.h"
|
#include "lcd_controller.h"
|
||||||
#include "lcd_HD44780.h"
|
#include "lcd_HD44780.h"
|
||||||
|
@ -214,7 +214,7 @@ static void showLine(lcd_line_e line, int screenY) {
|
||||||
int seconds = minI(9999, getTimeNowSeconds());
|
int seconds = minI(9999, getTimeNowSeconds());
|
||||||
lcdPrintf("RPM %d %d ", GET_RPM(), seconds);
|
lcdPrintf("RPM %d %d ", GET_RPM(), seconds);
|
||||||
}
|
}
|
||||||
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
|
#if EFI_FILE_LOGGING
|
||||||
{
|
{
|
||||||
char sdState;
|
char sdState;
|
||||||
if (CONFIGB(isSdCardEnabled)) {
|
if (CONFIGB(isSdCardEnabled)) {
|
||||||
|
@ -267,7 +267,7 @@ static void showLine(lcd_line_e line, int screenY) {
|
||||||
lcdPrintf("Knock %s %.2fv", buffer, engine->knockVolts);
|
lcdPrintf("Knock %s %.2fv", buffer, engine->knockVolts);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
|
#if EFI_ANALOG_SENSORS
|
||||||
case LL_BARO:
|
case LL_BARO:
|
||||||
if (hasBaroSensor()) {
|
if (hasBaroSensor()) {
|
||||||
lcdPrintf("Baro: %.2f", getBaroPressure());
|
lcdPrintf("Baro: %.2f", getBaroPressure());
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#if EFI_MALFUNCTION_INDICATOR || defined(__DOXYGEN__)
|
#if EFI_MALFUNCTION_INDICATOR
|
||||||
#include "io_pins.h"
|
#include "io_pins.h"
|
||||||
#include "malfunction_central.h"
|
#include "malfunction_central.h"
|
||||||
#include "malfunction_indicator.h"
|
#include "malfunction_indicator.h"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
#if EFI_MALFUNCTION_INDICATOR || defined(__DOXYGEN__)
|
#if EFI_MALFUNCTION_INDICATOR
|
||||||
|
|
||||||
bool isMilEnabled();
|
bool isMilEnabled();
|
||||||
void initMalfunctionIndicator(void);
|
void initMalfunctionIndicator(void);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#if EFI_PWM_TESTER || defined(__DOXYGEN__)
|
#if EFI_PWM_TESTER
|
||||||
|
|
||||||
#include "pwm_tester.h"
|
#include "pwm_tester.h"
|
||||||
#include "efi_wave.h"
|
#include "efi_wave.h"
|
||||||
|
|
|
@ -46,7 +46,7 @@ void initTachometer(void) {
|
||||||
|
|
||||||
enginePins.tachOut.initPin("analog tach output", CONFIGB(tachOutputPin), &CONFIGB(tachOutputPinMode));
|
enginePins.tachOut.initPin("analog tach output", CONFIGB(tachOutputPin), &CONFIGB(tachOutputPinMode));
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
addTriggerEventListener(tachSignalCallback, "tach", engine);
|
addTriggerEventListener(tachSignalCallback, "tach", engine);
|
||||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "engine_state.h"
|
#include "engine_state.h"
|
||||||
#include "engine_math.h"
|
#include "engine_math.h"
|
||||||
#include "signal_executor.h"
|
#include "signal_executor.h"
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
#include "tunerstudio_configuration.h"
|
#include "tunerstudio_configuration.h"
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
@ -213,7 +213,7 @@ floatms_t AccelEnrichmemnt::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engineConfiguration->debugMode == DBG_TPS_ACCEL) {
|
if (engineConfiguration->debugMode == DBG_TPS_ACCEL) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels.debugFloatField1 = tpsFrom;
|
tsOutputChannels.debugFloatField1 = tpsFrom;
|
||||||
tsOutputChannels.debugFloatField2 = tpsTo;
|
tsOutputChannels.debugFloatField2 = tpsTo;
|
||||||
tsOutputChannels.debugFloatField3 = valueFromTable;
|
tsOutputChannels.debugFloatField3 = valueFromTable;
|
||||||
|
@ -250,7 +250,7 @@ float AccelEnrichmemnt::getEngineLoadEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATU
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engineConfiguration->debugMode == DBG_EL_ACCEL) {
|
if (engineConfiguration->debugMode == DBG_EL_ACCEL) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels.debugIntField1 = distance;
|
tsOutputChannels.debugIntField1 = distance;
|
||||||
tsOutputChannels.debugFloatField1 = result;
|
tsOutputChannels.debugFloatField1 = result;
|
||||||
tsOutputChannels.debugFloatField2 = taper;
|
tsOutputChannels.debugFloatField2 = taper;
|
||||||
|
@ -319,7 +319,7 @@ AccelEnrichmemnt::AccelEnrichmemnt() {
|
||||||
cb.setSize(4);
|
cb.setSize(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if ! EFI_UNIT_TEST
|
||||||
|
|
||||||
static void accelInfo() {
|
static void accelInfo() {
|
||||||
if (logger == NULL)
|
if (logger == NULL)
|
||||||
|
@ -399,7 +399,7 @@ void initAccelEnrichment(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
||||||
logger = sharedLogger;
|
logger = sharedLogger;
|
||||||
tpsTpsMap.init(config->tpsTpsAccelTable, config->tpsTpsAccelFromRpmBins, config->tpsTpsAccelToRpmBins);
|
tpsTpsMap.init(config->tpsTpsAccelTable, config->tpsTpsAccelFromRpmBins, config->tpsTpsAccelToRpmBins);
|
||||||
|
|
||||||
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if ! EFI_UNIT_TEST
|
||||||
|
|
||||||
addConsoleAction("accelinfo", accelInfo);
|
addConsoleAction("accelinfo", accelInfo);
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ angle_t getAdvanceCorrections(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engineConfiguration->debugMode == DBG_IGNITION_TIMING) {
|
if (engineConfiguration->debugMode == DBG_IGNITION_TIMING) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels.debugFloatField1 = iatCorrection;
|
tsOutputChannels.debugFloatField1 = iatCorrection;
|
||||||
tsOutputChannels.debugFloatField2 = engine->engineState.cltTimingCorrection;
|
tsOutputChannels.debugFloatField2 = engine->engineState.cltTimingCorrection;
|
||||||
tsOutputChannels.debugFloatField3 = engine->fsioState.fsioTimingAdjustment;
|
tsOutputChannels.debugFloatField3 = engine->fsioState.fsioTimingAdjustment;
|
||||||
|
@ -185,7 +185,7 @@ static angle_t getCrankingAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAM
|
||||||
|
|
||||||
|
|
||||||
angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||||
if (cisnan(engineLoad)) {
|
if (cisnan(engineLoad)) {
|
||||||
return 0; // any error should already be reported
|
return 0; // any error should already be reported
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "map_averaging.h"
|
#include "map_averaging.h"
|
||||||
#include "fsio_impl.h"
|
#include "fsio_impl.h"
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
#include "injector_central.h"
|
#include "injector_central.h"
|
||||||
#else
|
#else
|
||||||
#define isRunningBenchTest() true
|
#define isRunningBenchTest() true
|
||||||
|
@ -41,7 +41,7 @@ extern int globalConfigurationVersion;
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ FsioState::FsioState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void Engine::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
// we have a confusing threading model so some synchronization would not hurt
|
// we have a confusing threading model so some synchronization would not hurt
|
||||||
bool alreadyLocked = lockAnyContext();
|
bool alreadyLocked = lockAnyContext();
|
||||||
|
@ -93,7 +93,7 @@ void Engine::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUF
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cylinderCleanupControl(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
static void cylinderCleanupControl(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
bool newValue;
|
bool newValue;
|
||||||
if (engineConfiguration->isCylinderCleanupEnabled) {
|
if (engineConfiguration->isCylinderCleanupEnabled) {
|
||||||
newValue = !engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE) && getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) > CLEANUP_MODE_TPS;
|
newValue = !engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE) && getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) > CLEANUP_MODE_TPS;
|
||||||
|
@ -112,7 +112,7 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
checkShutdown();
|
checkShutdown();
|
||||||
|
|
||||||
#if EFI_FSIO || defined(__DOXYGEN__)
|
#if EFI_FSIO
|
||||||
runFsio(PASS_ENGINE_PARAMETER_SIGNATURE);
|
runFsio(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif /* EFI_PROD_CODE && EFI_FSIO */
|
#endif /* EFI_PROD_CODE && EFI_FSIO */
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
* See also periodicFastCallback
|
* See also periodicFastCallback
|
||||||
*/
|
*/
|
||||||
void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
int rpm = GET_RPM();
|
int rpm = GET_RPM();
|
||||||
isEngineChartEnabled = CONFIG(isEngineChartEnabled) && rpm < CONFIG(engineSnifferRpmThreshold);
|
isEngineChartEnabled = CONFIG(isEngineChartEnabled) && rpm < CONFIG(engineSnifferRpmThreshold);
|
||||||
sensorChartMode = rpm < CONFIG(sensorSnifferRpmThreshold) ? CONFIGB(sensorChartMode) : SC_OFF;
|
sensorChartMode = rpm < CONFIG(sensorSnifferRpmThreshold) ? CONFIGB(sensorChartMode) : SC_OFF;
|
||||||
|
@ -277,7 +277,7 @@ void Engine::watchdog() {
|
||||||
}
|
}
|
||||||
isSpinning = false;
|
isSpinning = false;
|
||||||
ignitionEvents.isReady = false;
|
ignitionEvents.isReady = false;
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
scheduleMsg(&engineLogger, "engine has STOPPED");
|
scheduleMsg(&engineLogger, "engine has STOPPED");
|
||||||
scheduleMsg(&engineLogger, "templog engine has STOPPED [%x][%x] [%x][%x] %d",
|
scheduleMsg(&engineLogger, "templog engine has STOPPED [%x][%x] [%x][%x] %d",
|
||||||
(int)(nowNt >> 32), (int)nowNt,
|
(int)(nowNt >> 32), (int)nowNt,
|
||||||
|
@ -292,7 +292,7 @@ void Engine::watchdog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::checkShutdown() {
|
void Engine::checkShutdown() {
|
||||||
#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__)
|
#if EFI_MAIN_RELAY_CONTROL
|
||||||
int rpm = rpmCalculator.getRpm();
|
int rpm = rpmCalculator.getRpm();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -308,7 +308,7 @@ void Engine::checkShutdown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Engine::isInShutdownMode() {
|
bool Engine::isInShutdownMode() {
|
||||||
#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__)
|
#if EFI_MAIN_RELAY_CONTROL
|
||||||
if (stopEngineRequestTimeNt == 0) // the shutdown procedure is not started
|
if (stopEngineRequestTimeNt == 0) // the shutdown procedure is not started
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,7 @@ public:
|
||||||
|
|
||||||
angle_t injectionOffset = 0;
|
angle_t injectionOffset = 0;
|
||||||
|
|
||||||
#if EFI_ENABLE_MOCK_ADC || defined(__DOXYGEN__)
|
#if EFI_ENABLE_MOCK_ADC
|
||||||
MockAdcState mockAdcState;
|
MockAdcState mockAdcState;
|
||||||
#endif /* EFI_ENABLE_MOCK_ADC */
|
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||||
};
|
};
|
||||||
|
@ -362,7 +362,7 @@ public:
|
||||||
TestExecutor executor;
|
TestExecutor executor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
FuelSchedule injectionEvents;
|
FuelSchedule injectionEvents;
|
||||||
#endif /* EFI_ENGINE_CONTROL */
|
#endif /* EFI_ENGINE_CONTROL */
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ EXTERN_ENGINE
|
||||||
// this does not look exactly right
|
// this does not look exactly right
|
||||||
extern LoggingWithStorage engineLogger;
|
extern LoggingWithStorage engineLogger;
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ void EngineState::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
if (!engine->slowCallBackWasInvoked) {
|
if (!engine->slowCallBackWasInvoked) {
|
||||||
warning(CUSTOM_ERR_6696, "Slow not invoked yet");
|
warning(CUSTOM_ERR_6696, "Slow not invoked yet");
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
cltFuelCorrection = warmupAfrPid.getOutput(warmupTargetAfr, engine->sensors.currentAfr, 1);
|
cltFuelCorrection = warmupAfrPid.getOutput(warmupTargetAfr, engine->sensors.currentAfr, 1);
|
||||||
}
|
}
|
||||||
if (engineConfiguration->debugMode == DBG_WARMUP_ENRICH) {
|
if (engineConfiguration->debugMode == DBG_WARMUP_ENRICH) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels.debugFloatField1 = warmupTargetAfr;
|
tsOutputChannels.debugFloatField1 = warmupTargetAfr;
|
||||||
warmupAfrPid.postState(&tsOutputChannels);
|
warmupAfrPid.postState(&tsOutputChannels);
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
@ -218,7 +218,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineState::updateTChargeK(int rpm, float tps DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void EngineState::updateTChargeK(int rpm, float tps DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
float coolantC = ENGINE(sensors.clt);
|
float coolantC = ENGINE(sensors.clt);
|
||||||
float intakeC = ENGINE(sensors.iat);
|
float intakeC = ENGINE(sensors.iat);
|
||||||
float newTCharge = getTCharge(rpm, tps, coolantC, intakeC PASS_ENGINE_PARAMETER_SUFFIX);
|
float newTCharge = getTCharge(rpm, tps, coolantC, intakeC PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "advance_map.h"
|
#include "advance_map.h"
|
||||||
|
|
||||||
#include "hip9011_lookup.h"
|
#include "hip9011_lookup.h"
|
||||||
#if EFI_MEMS || defined(__DOXYGEN__)
|
#if EFI_MEMS
|
||||||
#include "accelerometer.h"
|
#include "accelerometer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -83,32 +83,32 @@
|
||||||
#include "zil130.h"
|
#include "zil130.h"
|
||||||
#include "honda_600.h"
|
#include "honda_600.h"
|
||||||
|
|
||||||
#if EFI_IDLE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_IDLE_CONTROL
|
||||||
#include "idle_thread.h"
|
#include "idle_thread.h"
|
||||||
#endif /* EFI_IDLE_CONTROL */
|
#endif /* EFI_IDLE_CONTROL */
|
||||||
|
|
||||||
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ALTERNATOR_CONTROL
|
||||||
#include "alternator_controller.h"
|
#include "alternator_controller.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
|
#if EFI_ELECTRONIC_THROTTLE_BODY
|
||||||
#include "electronic_throttle.h"
|
#include "electronic_throttle.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_HIP_9011 || defined(__DOXYGEN__)
|
#if EFI_HIP_9011
|
||||||
#include "hip9011.h"
|
#include "hip9011.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__)
|
#if EFI_EMULATE_POSITION_SENSORS
|
||||||
#include "trigger_emulator.h"
|
#include "trigger_emulator.h"
|
||||||
#endif /* EFI_EMULATE_POSITION_SENSORS */
|
#endif /* EFI_EMULATE_POSITION_SENSORS */
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
#include "tunerstudio.h"
|
#include "tunerstudio.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -174,29 +174,29 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
/**
|
/**
|
||||||
* All these callbacks could be implemented as listeners, but these days I am saving RAM
|
* All these callbacks could be implemented as listeners, but these days I am saving RAM
|
||||||
*/
|
*/
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
applyNewHardwareSettings();
|
applyNewHardwareSettings();
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
engine->preCalculate(PASS_ENGINE_PARAMETER_SIGNATURE);
|
engine->preCalculate(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ALTERNATOR_CONTROL
|
||||||
onConfigurationChangeAlternatorCallback(&activeConfiguration);
|
onConfigurationChangeAlternatorCallback(&activeConfiguration);
|
||||||
#endif /* EFI_ALTERNATOR_CONTROL */
|
#endif /* EFI_ALTERNATOR_CONTROL */
|
||||||
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
|
#if EFI_ELECTRONIC_THROTTLE_BODY
|
||||||
onConfigurationChangeElectronicThrottleCallback(&activeConfiguration);
|
onConfigurationChangeElectronicThrottleCallback(&activeConfiguration);
|
||||||
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
||||||
|
|
||||||
#if EFI_IDLE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_IDLE_CONTROL
|
||||||
onConfigurationChangeIdleCallback(&activeConfiguration);
|
onConfigurationChangeIdleCallback(&activeConfiguration);
|
||||||
#endif /* EFI_IDLE_CONTROL */
|
#endif /* EFI_IDLE_CONTROL */
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
onConfigurationChangeTriggerCallback(&activeConfiguration PASS_ENGINE_PARAMETER_SUFFIX);
|
onConfigurationChangeTriggerCallback(&activeConfiguration PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||||
#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__)
|
#if EFI_EMULATE_POSITION_SENSORS
|
||||||
onConfigurationChangeRpmEmulatorCallback(&activeConfiguration);
|
onConfigurationChangeRpmEmulatorCallback(&activeConfiguration);
|
||||||
#endif /* EFI_EMULATE_POSITION_SENSORS */
|
#endif /* EFI_EMULATE_POSITION_SENSORS */
|
||||||
|
|
||||||
#if EFI_FSIO || defined(__DOXYGEN__)
|
#if EFI_FSIO
|
||||||
onConfigurationChangeFsioCallback(&activeConfiguration PASS_ENGINE_PARAMETER_SUFFIX);
|
onConfigurationChangeFsioCallback(&activeConfiguration PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
#endif /* EFI_FSIO */
|
#endif /* EFI_FSIO */
|
||||||
rememberCurrentConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
rememberCurrentConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
@ -342,14 +342,14 @@ void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
|
||||||
boardConfiguration->acRelayPin = GPIO_UNASSIGNED;
|
boardConfiguration->acRelayPin = GPIO_UNASSIGNED;
|
||||||
boardConfiguration->acRelayPinMode = OM_DEFAULT;
|
boardConfiguration->acRelayPinMode = OM_DEFAULT;
|
||||||
|
|
||||||
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ALTERNATOR_CONTROL
|
||||||
setDefaultAlternatorParameters();
|
setDefaultAlternatorParameters();
|
||||||
#endif /* EFI_ALTERNATOR_CONTROL */
|
#endif /* EFI_ALTERNATOR_CONTROL */
|
||||||
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
|
#if EFI_ELECTRONIC_THROTTLE_BODY
|
||||||
setDefaultEtbParameters(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setDefaultEtbParameters(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
setDefaultEtbBiasCurve(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setDefaultEtbBiasCurve(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
||||||
#if EFI_IDLE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_IDLE_CONTROL
|
||||||
setDefaultIdleParameters();
|
setDefaultIdleParameters();
|
||||||
#endif /* EFI_IDLE_CONTROL */
|
#endif /* EFI_IDLE_CONTROL */
|
||||||
boardConfiguration->wboHeaterPin = GPIO_UNASSIGNED;
|
boardConfiguration->wboHeaterPin = GPIO_UNASSIGNED;
|
||||||
|
@ -405,7 +405,7 @@ void setDefaultBasePins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->fatalErrorPin = GPIOD_14;
|
engineConfiguration->fatalErrorPin = GPIOD_14;
|
||||||
#endif /* EFI_FATAL_ERROR_PIN */
|
#endif /* EFI_FATAL_ERROR_PIN */
|
||||||
engineConfiguration->warninigLedPin = GPIOD_13;
|
engineConfiguration->warninigLedPin = GPIOD_13;
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
// call overrided board-specific serial configuration setup, if needed (for custom boards only)
|
// call overrided board-specific serial configuration setup, if needed (for custom boards only)
|
||||||
// needed also by bootloader code
|
// needed also by bootloader code
|
||||||
setPinConfigurationOverrides();
|
setPinConfigurationOverrides();
|
||||||
|
@ -422,7 +422,7 @@ void setDefaultSerialParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
boardConfiguration->tunerStudioSerialSpeed = TS_DEFAULT_SPEED;
|
boardConfiguration->tunerStudioSerialSpeed = TS_DEFAULT_SPEED;
|
||||||
engineConfiguration->uartConsoleSerialSpeed = 115200;
|
engineConfiguration->uartConsoleSerialSpeed = 115200;
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
// call overrided board-specific serial configuration setup, if needed (for custom boards only)
|
// call overrided board-specific serial configuration setup, if needed (for custom boards only)
|
||||||
setSerialConfigurationOverrides();
|
setSerialConfigurationOverrides();
|
||||||
#endif
|
#endif
|
||||||
|
@ -435,7 +435,7 @@ void setDefaultSdCardParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
boardConfiguration->sdCardCsPin = GPIOD_4;
|
boardConfiguration->sdCardCsPin = GPIOD_4;
|
||||||
boardConfiguration->isSdCardEnabled = true;
|
boardConfiguration->isSdCardEnabled = true;
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
// call overrided board-specific SD card configuration setup, if needed (for custom boards only)
|
// call overrided board-specific SD card configuration setup, if needed (for custom boards only)
|
||||||
setSdCardConfigurationOverrides();
|
setSdCardConfigurationOverrides();
|
||||||
#endif
|
#endif
|
||||||
|
@ -648,7 +648,7 @@ int getTargetRpmForIdleCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
* anything else.
|
* anything else.
|
||||||
*/
|
*/
|
||||||
void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#if (! EFI_UNIT_TEST) || defined(__DOXYGEN__)
|
#if (! EFI_UNIT_TEST)
|
||||||
memset(&persistentState.persistentConfiguration, 0, sizeof(persistentState.persistentConfiguration));
|
memset(&persistentState.persistentConfiguration, 0, sizeof(persistentState.persistentConfiguration));
|
||||||
#endif
|
#endif
|
||||||
prepareVoidConfiguration(engineConfiguration);
|
prepareVoidConfiguration(engineConfiguration);
|
||||||
|
@ -769,7 +769,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->auxTempSensor1.adcChannel = EFI_ADC_NONE;
|
engineConfiguration->auxTempSensor1.adcChannel = EFI_ADC_NONE;
|
||||||
engineConfiguration->auxTempSensor2.adcChannel = EFI_ADC_NONE;
|
engineConfiguration->auxTempSensor2.adcChannel = EFI_ADC_NONE;
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
engineConfiguration->warningPeriod = 10;
|
engineConfiguration->warningPeriod = 10;
|
||||||
#else
|
#else
|
||||||
engineConfiguration->warningPeriod = 0;
|
engineConfiguration->warningPeriod = 0;
|
||||||
|
@ -953,7 +953,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
engineConfiguration->engineChartSize = 300;
|
engineConfiguration->engineChartSize = 300;
|
||||||
#else
|
#else
|
||||||
// need more events for automated test
|
// need more events for automated test
|
||||||
|
@ -1070,7 +1070,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
boardConfiguration->spi1misoPin = GPIOB_4;
|
boardConfiguration->spi1misoPin = GPIOB_4;
|
||||||
boardConfiguration->spi1sckPin = GPIOB_3; // please note that this pin is also SWO/SWD - Single Wire debug Output
|
boardConfiguration->spi1sckPin = GPIOB_3; // please note that this pin is also SWO/SWD - Single Wire debug Output
|
||||||
|
|
||||||
#if EFI_MEMS || defined(__DOXYGEN__)
|
#if EFI_MEMS
|
||||||
// this would override some values from above
|
// this would override some values from above
|
||||||
configureAccelerometerPins(PASS_ENGINE_PARAMETER_SIGNATURE);
|
configureAccelerometerPins(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1084,7 +1084,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
boardConfiguration->spi3sckPin = GPIOB_3;
|
boardConfiguration->spi3sckPin = GPIOB_3;
|
||||||
|
|
||||||
engineConfiguration->hip9011Gain = 1;
|
engineConfiguration->hip9011Gain = 1;
|
||||||
#if EFI_HIP_9011 || defined(__DOXYGEN__)
|
#if EFI_HIP_9011
|
||||||
setHip9011FrankensoPinout();
|
setHip9011FrankensoPinout();
|
||||||
#endif /* EFI_HIP_9011 */
|
#endif /* EFI_HIP_9011 */
|
||||||
|
|
||||||
|
@ -1105,12 +1105,12 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->tpsAccelLength = 12;
|
engineConfiguration->tpsAccelLength = 12;
|
||||||
engineConfiguration->tpsAccelEnrichmentThreshold = 40; // TPS % change, per engine cycle
|
engineConfiguration->tpsAccelEnrichmentThreshold = 40; // TPS % change, per engine cycle
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
// call overrided board-specific configuration setup, if needed (for custom boards only)
|
// call overrided board-specific configuration setup, if needed (for custom boards only)
|
||||||
setBoardConfigurationOverrides();
|
setBoardConfigurationOverrides();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_FSIO || defined(__DOXYGEN__)
|
#if EFI_FSIO
|
||||||
/**
|
/**
|
||||||
* to test:
|
* to test:
|
||||||
* set_fsio_setting 1 5000
|
* set_fsio_setting 1 5000
|
||||||
|
@ -1133,7 +1133,7 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN
|
||||||
* Let's apply global defaults first
|
* Let's apply global defaults first
|
||||||
*/
|
*/
|
||||||
setDefaultConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setDefaultConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#if EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_SIMULATOR
|
||||||
engineConfiguration->directSelfStimulation = true;
|
engineConfiguration->directSelfStimulation = true;
|
||||||
#endif /* */
|
#endif /* */
|
||||||
engineConfiguration->engineType = engineType;
|
engineConfiguration->engineType = engineType;
|
||||||
|
@ -1151,7 +1151,7 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN
|
||||||
case ACURA_RSX:
|
case ACURA_RSX:
|
||||||
setAcuraRSX(engineConfiguration);
|
setAcuraRSX(engineConfiguration);
|
||||||
break;
|
break;
|
||||||
#if EFI_SUPPORT_DODGE_NEON || defined(__DOXYGEN__)
|
#if EFI_SUPPORT_DODGE_NEON
|
||||||
case DODGE_NEON_1995:
|
case DODGE_NEON_1995:
|
||||||
setDodgeNeon1995EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
setDodgeNeon1995EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
break;
|
break;
|
||||||
|
@ -1166,17 +1166,17 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#endif /* EFI_SUPPORT_DODGE_NEON */
|
#endif /* EFI_SUPPORT_DODGE_NEON */
|
||||||
#if EFI_SUPPORT_FORD_ASPIRE || defined(__DOXYGEN__)
|
#if EFI_SUPPORT_FORD_ASPIRE
|
||||||
case FORD_ASPIRE_1996:
|
case FORD_ASPIRE_1996:
|
||||||
setFordAspireEngineConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setFordAspireEngineConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
break;
|
break;
|
||||||
#endif /* EFI_SUPPORT_FORD_ASPIRE */
|
#endif /* EFI_SUPPORT_FORD_ASPIRE */
|
||||||
#if EFI_SUPPORT_FORD_FIESTA || defined(__DOXYGEN__)
|
#if EFI_SUPPORT_FORD_FIESTA
|
||||||
case FORD_FIESTA:
|
case FORD_FIESTA:
|
||||||
setFordFiestaDefaultEngineConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setFordFiestaDefaultEngineConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
break;
|
break;
|
||||||
#endif /* EFI_SUPPORT_FORD_FIESTA */
|
#endif /* EFI_SUPPORT_FORD_FIESTA */
|
||||||
#if EFI_SUPPORT_NISSAN_PRIMERA || defined(__DOXYGEN__)
|
#if EFI_SUPPORT_NISSAN_PRIMERA
|
||||||
case NISSAN_PRIMERA:
|
case NISSAN_PRIMERA:
|
||||||
setNissanPrimeraEngineConfiguration(engineConfiguration);
|
setNissanPrimeraEngineConfiguration(engineConfiguration);
|
||||||
break;
|
break;
|
||||||
|
@ -1223,7 +1223,7 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN
|
||||||
case MITSU_4G93:
|
case MITSU_4G93:
|
||||||
setMitsubishiConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setMitsubishiConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
break;
|
break;
|
||||||
#if EFI_SUPPORT_1995_FORD_INLINE_6 || defined(__DOXYGEN__)
|
#if EFI_SUPPORT_1995_FORD_INLINE_6
|
||||||
case FORD_INLINE_6_1995:
|
case FORD_INLINE_6_1995:
|
||||||
setFordInline6(PASS_ENGINE_PARAMETER_SIGNATURE);
|
setFordInline6(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
break;
|
break;
|
||||||
|
@ -1370,23 +1370,23 @@ void validateConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
efiAssertVoid(CUSTOM_APPLY_STACK, getCurrentRemainingStack() > 256, "apply c");
|
efiAssertVoid(CUSTOM_APPLY_STACK, getCurrentRemainingStack() > 256, "apply c");
|
||||||
scheduleMsg(logger, "applyNonPersistentConfiguration()");
|
scheduleMsg(logger, "applyNonPersistentConfiguration()");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
assertEngineReference();
|
assertEngineReference();
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
ENGINE(initializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX));
|
ENGINE(initializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_FSIO || defined(__DOXYGEN__)
|
#if EFI_FSIO
|
||||||
applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
|
|
||||||
void prepareShapes(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void prepareShapes(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
prepareOutputSignals(PASS_ENGINE_PARAMETER_SIGNATURE);
|
prepareOutputSignals(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
InjectorOutputPin *outputs[MAX_WIRES_COUNT];
|
InjectorOutputPin *outputs[MAX_WIRES_COUNT];
|
||||||
bool isOverlapping;
|
bool isOverlapping;
|
||||||
int ownIndex;
|
int ownIndex;
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
Engine *engine;
|
Engine *engine;
|
||||||
#endif
|
#endif
|
||||||
event_trigger_position_s injectionStart;
|
event_trigger_position_s injectionStart;
|
||||||
|
@ -53,7 +53,7 @@ public:
|
||||||
*/
|
*/
|
||||||
int cylinderIndex;
|
int cylinderIndex;
|
||||||
char *name;
|
char *name;
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
Engine *engine;
|
Engine *engine;
|
||||||
#endif
|
#endif
|
||||||
IgnitionOutputPin *getOutputForLoggins();
|
IgnitionOutputPin *getOutputForLoggins();
|
||||||
|
|
|
@ -47,7 +47,7 @@ extern fuel_Map3D_t ve2Map;
|
||||||
extern afr_Map3D_t afrMap;
|
extern afr_Map3D_t afrMap;
|
||||||
extern baroCorr_Map3D_t baroCorrMap;
|
extern baroCorr_Map3D_t baroCorrMap;
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return total duration of fuel injection per engine cycle, in milliseconds
|
* @return total duration of fuel injection per engine cycle, in milliseconds
|
||||||
|
@ -151,7 +151,7 @@ percent_t getInjectorDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
* in case of single point injection mode the amount of fuel into all cylinders, otherwise the amount for one cylinder
|
* in case of single point injection mode the amount of fuel into all cylinders, otherwise the amount for one cylinder
|
||||||
*/
|
*/
|
||||||
floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||||
bool isCranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE);
|
bool isCranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
injection_mode_e mode = isCranking ?
|
injection_mode_e mode = isCranking ?
|
||||||
engineConfiguration->crankingInjectionMode :
|
engineConfiguration->crankingInjectionMode :
|
||||||
|
@ -169,7 +169,7 @@ floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
floatms_t baseFuel = getBaseFuel(rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
floatms_t baseFuel = getBaseFuel(rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
fuelPerCycle = getRunningFuel(baseFuel PASS_ENGINE_PARAMETER_SUFFIX);
|
fuelPerCycle = getRunningFuel(baseFuel PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(fuelPerCycle), "NaN fuelPerCycle", 0);
|
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(fuelPerCycle), "NaN fuelPerCycle", 0);
|
||||||
#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__)
|
#if EFI_PRINTF_FUEL_DETAILS
|
||||||
printf("baseFuel=%.2f fuelPerCycle=%.2f \t\n",
|
printf("baseFuel=%.2f fuelPerCycle=%.2f \t\n",
|
||||||
baseFuel, fuelPerCycle);
|
baseFuel, fuelPerCycle);
|
||||||
#endif /*EFI_PRINTF_FUEL_DETAILS */
|
#endif /*EFI_PRINTF_FUEL_DETAILS */
|
||||||
|
@ -298,7 +298,7 @@ float getFuelCutOffCorrection(efitick_t nowNt, int rpm DECLARE_ENGINE_PARAMETER_
|
||||||
* @return Fuel injection duration injection as specified in the fuel map, in milliseconds
|
* @return Fuel injection duration injection as specified in the fuel map, in milliseconds
|
||||||
*/
|
*/
|
||||||
floatms_t getBaseTableFuel(int rpm, float engineLoad) {
|
floatms_t getBaseTableFuel(int rpm, float engineLoad) {
|
||||||
#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||||
if (cisnan(engineLoad)) {
|
if (cisnan(engineLoad)) {
|
||||||
warning(CUSTOM_NAN_ENGINE_LOAD_2, "NaN engine load");
|
warning(CUSTOM_NAN_ENGINE_LOAD_2, "NaN engine load");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -323,7 +323,7 @@ float getBaroCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
/**
|
/**
|
||||||
* @return Duration of fuel injection while craning
|
* @return Duration of fuel injection while craning
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,7 +21,7 @@ static MemoryStream firmwareErrorMessageStream;
|
||||||
static char warningBuffer[WARNING_BUFFER_SIZE];
|
static char warningBuffer[WARNING_BUFFER_SIZE];
|
||||||
static bool isWarningStreamInitialized = false;
|
static bool isWarningStreamInitialized = false;
|
||||||
|
|
||||||
#if EFI_HD44780_LCD || defined(__DOXYGEN__)
|
#if EFI_HD44780_LCD
|
||||||
#include "lcd_HD44780.h"
|
#include "lcd_HD44780.h"
|
||||||
#endif /* EFI_HD44780_LCD */
|
#endif /* EFI_HD44780_LCD */
|
||||||
|
|
||||||
|
@ -52,18 +52,18 @@ void chDbgPanic3(const char *msg, const char * file, int line) {
|
||||||
return;
|
return;
|
||||||
dbg_panic_file = file;
|
dbg_panic_file = file;
|
||||||
dbg_panic_line = line;
|
dbg_panic_line = line;
|
||||||
#if CH_DBG_SYSTEM_STATE_CHECK || defined(__DOXYGEN__)
|
#if CH_DBG_SYSTEM_STATE_CHECK
|
||||||
ch.dbg.panic_msg = msg;
|
ch.dbg.panic_msg = msg;
|
||||||
#endif /* CH_DBG_SYSTEM_STATE_CHECK */
|
#endif /* CH_DBG_SYSTEM_STATE_CHECK */
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
ON_FATAL_ERROR();
|
ON_FATAL_ERROR();
|
||||||
#else
|
#else
|
||||||
printf("chDbgPanic3 %s %s%d", msg, file, line);
|
printf("chDbgPanic3 %s %s%d", msg, file, line);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_HD44780_LCD || defined(__DOXYGEN__)
|
#if EFI_HD44780_LCD
|
||||||
lcdShowPanicMessage((char *) msg);
|
lcdShowPanicMessage((char *) msg);
|
||||||
#endif /* EFI_HD44780_LCD */
|
#endif /* EFI_HD44780_LCD */
|
||||||
|
|
||||||
|
@ -109,11 +109,11 @@ bool warning(obd_code_e code, const char *fmt, ...) {
|
||||||
if (hasFirmwareErrorFlag)
|
if (hasFirmwareErrorFlag)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#if EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_SIMULATOR
|
||||||
printf("sim_warning %s\r\n", fmt);
|
printf("sim_warning %s\r\n", fmt);
|
||||||
#endif /* EFI_SIMULATOR */
|
#endif /* EFI_SIMULATOR */
|
||||||
|
|
||||||
#if EFI_SIMULATOR || EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_SIMULATOR || EFI_PROD_CODE
|
||||||
if (!isWarningStreamInitialized) {
|
if (!isWarningStreamInitialized) {
|
||||||
firmwareError(CUSTOM_ERR_ASSERT, "warn stream not initialized for %d", code);
|
firmwareError(CUSTOM_ERR_ASSERT, "warn stream not initialized for %d", code);
|
||||||
return false;
|
return false;
|
||||||
|
@ -148,7 +148,7 @@ char *getWarning(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if EFI_CLOCK_LOCKS || defined(__DOXYGEN__)
|
#if EFI_CLOCK_LOCKS
|
||||||
uint32_t lastLockTime;
|
uint32_t lastLockTime;
|
||||||
/**
|
/**
|
||||||
* Maximum time before requesting lock and releasing lock at the end of critical section
|
* Maximum time before requesting lock and releasing lock at the end of critical section
|
||||||
|
@ -183,7 +183,7 @@ void onUnlockHook(void) {
|
||||||
|
|
||||||
|
|
||||||
void initErrorHandling(void) {
|
void initErrorHandling(void) {
|
||||||
#if EFI_SIMULATOR || EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_SIMULATOR || EFI_PROD_CODE
|
||||||
msObjectInit(&warningStream, (uint8_t *) warningBuffer, WARNING_BUFFER_SIZE, 0);
|
msObjectInit(&warningStream, (uint8_t *) warningBuffer, WARNING_BUFFER_SIZE, 0);
|
||||||
msObjectInit(&firmwareErrorMessageStream, errorMessageBuffer, sizeof(errorMessageBuffer), 0);
|
msObjectInit(&firmwareErrorMessageStream, errorMessageBuffer, sizeof(errorMessageBuffer), 0);
|
||||||
#endif
|
#endif
|
||||||
|
@ -191,7 +191,7 @@ void initErrorHandling(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void firmwareError(obd_code_e code, const char *fmt, ...) {
|
void firmwareError(obd_code_e code, const char *fmt, ...) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
if (hasFirmwareErrorFlag)
|
if (hasFirmwareErrorFlag)
|
||||||
return;
|
return;
|
||||||
engine->engineState.warnings.addWarningCode(code);
|
engine->engineState.warnings.addWarningCode(code);
|
||||||
|
@ -230,7 +230,7 @@ void firmwareError(obd_code_e code, const char *fmt, ...) {
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
|
|
||||||
#if EFI_SIMULATOR || EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_SIMULATOR || EFI_UNIT_TEST
|
||||||
exit(-1);
|
exit(-1);
|
||||||
#endif /* EFI_SIMULATOR */
|
#endif /* EFI_SIMULATOR */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#if EFI_FSIO || defined(__DOXYGEN__)
|
#if EFI_FSIO
|
||||||
|
|
||||||
#include "fsio_core.h"
|
#include "fsio_core.h"
|
||||||
#include "fsio_impl.h"
|
#include "fsio_impl.h"
|
||||||
|
@ -138,7 +138,7 @@ void LECalculator::push(le_action_e action, float value) {
|
||||||
* @return true in case of error, false otherwise
|
* @return true in case of error, false otherwise
|
||||||
*/
|
*/
|
||||||
bool LECalculator::processElement(LEElement *element DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
bool LECalculator::processElement(LEElement *element DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > 64, "FSIO logic", false);
|
efiAssert(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > 64, "FSIO logic", false);
|
||||||
#endif
|
#endif
|
||||||
switch (element->action) {
|
switch (element->action) {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#if EFI_FSIO || defined(__DOXYGEN__)
|
#if EFI_FSIO
|
||||||
|
|
||||||
#include "fsio_impl.h"
|
#include "fsio_impl.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
@ -97,7 +97,7 @@ static LEElement * fuelPumpLogic;
|
||||||
static LEElement * radiatorFanLogic;
|
static LEElement * radiatorFanLogic;
|
||||||
static LEElement * alternatorLogic;
|
static LEElement * alternatorLogic;
|
||||||
|
|
||||||
#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__)
|
#if EFI_MAIN_RELAY_CONTROL
|
||||||
static LEElement * mainRelayLogic;
|
static LEElement * mainRelayLogic;
|
||||||
#endif /* EFI_MAIN_RELAY_CONTROL */
|
#endif /* EFI_MAIN_RELAY_CONTROL */
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ float getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
|
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
#include "pwm_generator.h"
|
#include "pwm_generator.h"
|
||||||
|
@ -266,7 +266,7 @@ void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if EFI_FSIO || defined(__DOXYGEN__)
|
#if EFI_FSIO
|
||||||
applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -401,7 +401,7 @@ static void setPinState(const char * msg, OutputPin *pin, LEElement *element DEC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
static void setFsioFrequency(int index, int frequency) {
|
static void setFsioFrequency(int index, int frequency) {
|
||||||
index--;
|
index--;
|
||||||
if (index < 0 || index >= FSIO_COMMAND_COUNT) {
|
if (index < 0 || index >= FSIO_COMMAND_COUNT) {
|
||||||
|
@ -446,13 +446,13 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
handleFsio(index PASS_ENGINE_PARAMETER_SUFFIX);
|
handleFsio(index PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_FUEL_PUMP || defined(__DOXYGEN__)
|
#if EFI_FUEL_PUMP
|
||||||
if (CONFIGB(fuelPumpPin) != GPIO_UNASSIGNED) {
|
if (CONFIGB(fuelPumpPin) != GPIO_UNASSIGNED) {
|
||||||
setPinState("pump", &enginePins.fuelPumpRelay, fuelPumpLogic PASS_ENGINE_PARAMETER_SUFFIX);
|
setPinState("pump", &enginePins.fuelPumpRelay, fuelPumpLogic PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
#endif /* EFI_FUEL_PUMP */
|
#endif /* EFI_FUEL_PUMP */
|
||||||
|
|
||||||
#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__)
|
#if EFI_MAIN_RELAY_CONTROL
|
||||||
if (CONFIGB(mainRelayPin) != GPIO_UNASSIGNED)
|
if (CONFIGB(mainRelayPin) != GPIO_UNASSIGNED)
|
||||||
setPinState("main_relay", &enginePins.mainRelay, mainRelayLogic PASS_ENGINE_PARAMETER_SUFFIX);
|
setPinState("main_relay", &enginePins.mainRelay, mainRelayLogic PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
#else /* EFI_MAIN_RELAY_CONTROL */
|
#else /* EFI_MAIN_RELAY_CONTROL */
|
||||||
|
@ -640,7 +640,7 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
logger = sharedLogger;
|
logger = sharedLogger;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_FUEL_PUMP || defined(__DOXYGEN__)
|
#if EFI_FUEL_PUMP
|
||||||
fuelPumpLogic = sysPool.parseExpression(FUEL_PUMP_LOGIC);
|
fuelPumpLogic = sysPool.parseExpression(FUEL_PUMP_LOGIC);
|
||||||
#endif /* EFI_FUEL_PUMP */
|
#endif /* EFI_FUEL_PUMP */
|
||||||
|
|
||||||
|
@ -649,12 +649,12 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
|
||||||
alternatorLogic = sysPool.parseExpression(ALTERNATOR_LOGIC);
|
alternatorLogic = sysPool.parseExpression(ALTERNATOR_LOGIC);
|
||||||
|
|
||||||
#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__)
|
#if EFI_MAIN_RELAY_CONTROL
|
||||||
if (CONFIGB(mainRelayPin) != GPIO_UNASSIGNED)
|
if (CONFIGB(mainRelayPin) != GPIO_UNASSIGNED)
|
||||||
mainRelayLogic = sysPool.parseExpression(MAIN_RELAY_LOGIC);
|
mainRelayLogic = sysPool.parseExpression(MAIN_RELAY_LOGIC);
|
||||||
#endif /* EFI_MAIN_RELAY_CONTROL */
|
#endif /* EFI_MAIN_RELAY_CONTROL */
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
|
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
|
||||||
brain_pin_e brainPin = CONFIGB(fsioOutputPins)[i];
|
brain_pin_e brainPin = CONFIGB(fsioOutputPins)[i];
|
||||||
|
|
||||||
|
@ -680,7 +680,7 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
|
||||||
addConsoleActionSS("set_fsio_pid_output_pin", (VoidCharPtrCharPtr) setFsioPidOutputPin);
|
addConsoleActionSS("set_fsio_pid_output_pin", (VoidCharPtrCharPtr) setFsioPidOutputPin);
|
||||||
addConsoleActionSS("set_fsio_output_pin", (VoidCharPtrCharPtr) setFsioOutputPin);
|
addConsoleActionSS("set_fsio_output_pin", (VoidCharPtrCharPtr) setFsioOutputPin);
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
addConsoleActionII("set_fsio_output_frequency", (VoidIntInt) setFsioFrequency);
|
addConsoleActionII("set_fsio_output_frequency", (VoidIntInt) setFsioFrequency);
|
||||||
#endif
|
#endif
|
||||||
addConsoleActionSS("set_fsio_digital_input_pin", (VoidCharPtrCharPtr) setFsioDigitalInputPin);
|
addConsoleActionSS("set_fsio_digital_input_pin", (VoidCharPtrCharPtr) setFsioDigitalInputPin);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
#if EFI_SENSOR_CHART
|
||||||
#include "sensor_chart.h"
|
#include "sensor_chart.h"
|
||||||
#endif
|
#endif
|
||||||
#include "engine_configuration.h"
|
#include "engine_configuration.h"
|
||||||
|
@ -37,13 +37,13 @@
|
||||||
#include "main_trigger_callback.h"
|
#include "main_trigger_callback.h"
|
||||||
#include "io_pins.h"
|
#include "io_pins.h"
|
||||||
#include "flash_main.h"
|
#include "flash_main.h"
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
#include "tunerstudio.h"
|
#include "tunerstudio.h"
|
||||||
#endif
|
#endif
|
||||||
#include "injector_central.h"
|
#include "injector_central.h"
|
||||||
#include "rfiutil.h"
|
#include "rfiutil.h"
|
||||||
#include "engine_math.h"
|
#include "engine_math.h"
|
||||||
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
|
#if EFI_WAVE_ANALYZER
|
||||||
#include "wave_analyzer.h"
|
#include "wave_analyzer.h"
|
||||||
#endif
|
#endif
|
||||||
#include "allsensors.h"
|
#include "allsensors.h"
|
||||||
|
@ -61,11 +61,11 @@
|
||||||
#include "accelerometer.h"
|
#include "accelerometer.h"
|
||||||
#include "counter64.h"
|
#include "counter64.h"
|
||||||
|
|
||||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
#if HAL_USE_ADC
|
||||||
#include "AdcConfiguration.h"
|
#include "AdcConfiguration.h"
|
||||||
#endif /* HAL_USE_ADC */
|
#endif /* HAL_USE_ADC */
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
#include "pwm_generator.h"
|
#include "pwm_generator.h"
|
||||||
#include "adc_inputs.h"
|
#include "adc_inputs.h"
|
||||||
|
|
||||||
|
@ -76,11 +76,11 @@
|
||||||
#include "tachometer.h"
|
#include "tachometer.h"
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
#if EFI_CJ125 || defined(__DOXYGEN__)
|
#if EFI_CJ125
|
||||||
#include "cj125.h"
|
#include "cj125.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(EFI_BOOTLOADER_INCLUDE_CODE) || defined(__DOXYGEN__)
|
#if defined(EFI_BOOTLOADER_INCLUDE_CODE)
|
||||||
#include "bootloader/bootloader.h"
|
#include "bootloader/bootloader.h"
|
||||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ static virtual_timer_t periodicFastTimer; // 50Hz
|
||||||
|
|
||||||
static LoggingWithStorage logger("Engine Controller");
|
static LoggingWithStorage logger("Engine Controller");
|
||||||
|
|
||||||
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* todo: this should probably become 'static', i.e. private, and propagated around explicitly?
|
* todo: this should probably become 'static', i.e. private, and propagated around explicitly?
|
||||||
|
@ -109,7 +109,7 @@ Engine * engine = &___engine;
|
||||||
|
|
||||||
static msg_t csThread(void) {
|
static msg_t csThread(void) {
|
||||||
chRegSetThreadName("status");
|
chRegSetThreadName("status");
|
||||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
while (true) {
|
while (true) {
|
||||||
int is_cranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE);
|
int is_cranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
bool is_running = ENGINE(rpmCalculator).isRunning(PASS_ENGINE_PARAMETER_SIGNATURE);
|
bool is_running = ENGINE(rpmCalculator).isRunning(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
@ -129,7 +129,7 @@ static msg_t csThread(void) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
static Overflow64Counter halTime;
|
static Overflow64Counter halTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,7 +176,7 @@ efitick_t getTimeNowNt(void) {
|
||||||
localH = halTime.state.highBits;
|
localH = halTime.state.highBits;
|
||||||
localLow = halTime.state.lowBits;
|
localLow = halTime.state.lowBits;
|
||||||
localH2 = halTime.state.highBits;
|
localH2 = halTime.state.highBits;
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
if (counter++ == 10000)
|
if (counter++ == 10000)
|
||||||
chDbgPanic("lock-free frozen");
|
chDbgPanic("lock-free frozen");
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
@ -279,7 +279,7 @@ static void invokePerSecond(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void periodicSlowCallback(Engine *engine) {
|
static void periodicSlowCallback(Engine *engine) {
|
||||||
#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||||
efiAssertVoid(CUSTOM_ERR_6661, getCurrentRemainingStack() > 64, "lowStckOnEv");
|
efiAssertVoid(CUSTOM_ERR_6661, getCurrentRemainingStack() > 64, "lowStckOnEv");
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
/**
|
/**
|
||||||
|
@ -306,7 +306,7 @@ static void periodicSlowCallback(Engine *engine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
if (engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
||||||
#if EFI_INTERNAL_FLASH || defined(__DOXYGEN__)
|
#if EFI_INTERNAL_FLASH
|
||||||
writeToFlashIfPending();
|
writeToFlashIfPending();
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* EFI_INTERNAL_FLASH */
|
||||||
resetAccel();
|
resetAccel();
|
||||||
|
@ -331,7 +331,7 @@ void initPeriodicEvents(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer) {
|
char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer) {
|
||||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
#if HAL_USE_ADC
|
||||||
if (hwChannel == EFI_ADC_NONE) {
|
if (hwChannel == EFI_ADC_NONE) {
|
||||||
strcpy(buffer, "NONE");
|
strcpy(buffer, "NONE");
|
||||||
} else {
|
} else {
|
||||||
|
@ -346,13 +346,13 @@ char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *bu
|
||||||
|
|
||||||
static char pinNameBuffer[16];
|
static char pinNameBuffer[16];
|
||||||
|
|
||||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
#if HAL_USE_ADC
|
||||||
extern AdcDevice fastAdc;
|
extern AdcDevice fastAdc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel, float adcVoltage,
|
static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel, float adcVoltage,
|
||||||
float dividerCoeff) {
|
float dividerCoeff) {
|
||||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
#if HAL_USE_ADC
|
||||||
if (hwChannel == EFI_ADC_NONE) {
|
if (hwChannel == EFI_ADC_NONE) {
|
||||||
scheduleMsg(&logger, "ADC is not assigned for %s", name);
|
scheduleMsg(&logger, "ADC is not assigned for %s", name);
|
||||||
return;
|
return;
|
||||||
|
@ -369,7 +369,7 @@ static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printAnalogChannelInfo(const char *name, adc_channel_e hwChannel) {
|
static void printAnalogChannelInfo(const char *name, adc_channel_e hwChannel) {
|
||||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
#if HAL_USE_ADC
|
||||||
printAnalogChannelInfoExt(name, hwChannel, getVoltage("print", hwChannel), engineConfiguration->analogInputDividerCoefficient);
|
printAnalogChannelInfoExt(name, hwChannel, getVoltage("print", hwChannel), engineConfiguration->analogInputDividerCoefficient);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -594,11 +594,11 @@ void setMockVBattVoltage(float voltage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initMockVoltage(void) {
|
static void initMockVoltage(void) {
|
||||||
#if EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_SIMULATOR
|
||||||
setMockCltVoltage(2);
|
setMockCltVoltage(2);
|
||||||
#endif /* EFI_SIMULATOR */
|
#endif /* EFI_SIMULATOR */
|
||||||
|
|
||||||
#if EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_SIMULATOR
|
||||||
setMockIatVoltage(2);
|
setMockIatVoltage(2);
|
||||||
#endif /* EFI_SIMULATOR */
|
#endif /* EFI_SIMULATOR */
|
||||||
|
|
||||||
|
@ -638,16 +638,16 @@ void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S
|
||||||
initMockVoltage();
|
initMockVoltage();
|
||||||
#endif /* EFI_ENABLE_MOCK_ADC */
|
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||||
|
|
||||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
#if EFI_SENSOR_CHART
|
||||||
initSensorChart();
|
initSensorChart();
|
||||||
#endif /* EFI_SENSOR_CHART */
|
#endif /* EFI_SENSOR_CHART */
|
||||||
|
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
// todo: this is a mess, remove code duplication with simulator
|
// todo: this is a mess, remove code duplication with simulator
|
||||||
initSettings();
|
initSettings();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
if (engineConfiguration->isTunerStudioEnabled) {
|
if (engineConfiguration->isTunerStudioEnabled) {
|
||||||
startTunerStudioConnectivity();
|
startTunerStudioConnectivity();
|
||||||
}
|
}
|
||||||
|
@ -658,7 +658,7 @@ void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S
|
||||||
}
|
}
|
||||||
initSensors(sharedLogger PASS_ENGINE_PARAMETER_SIGNATURE);
|
initSensors(sharedLogger PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
#if EFI_FSIO || defined(__DOXYGEN__)
|
#if EFI_FSIO
|
||||||
initFsioImpl(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
initFsioImpl(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -675,19 +675,19 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
initPwmGenerator();
|
initPwmGenerator();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
initAlgo(sharedLogger);
|
initAlgo(sharedLogger);
|
||||||
|
|
||||||
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
|
#if EFI_WAVE_ANALYZER
|
||||||
if (engineConfiguration->isWaveAnalyzerEnabled) {
|
if (engineConfiguration->isWaveAnalyzerEnabled) {
|
||||||
initWaveAnalyzer(sharedLogger);
|
initWaveAnalyzer(sharedLogger);
|
||||||
}
|
}
|
||||||
#endif /* EFI_WAVE_ANALYZER */
|
#endif /* EFI_WAVE_ANALYZER */
|
||||||
|
|
||||||
#if EFI_CJ125 || defined(__DOXYGEN__)
|
#if EFI_CJ125
|
||||||
/**
|
/**
|
||||||
* this uses SimplePwm which depends on scheduler, has to be initialized after scheduler
|
* this uses SimplePwm which depends on scheduler, has to be initialized after scheduler
|
||||||
*/
|
*/
|
||||||
|
@ -695,7 +695,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
||||||
#endif /* EFI_CJ125 */
|
#endif /* EFI_CJ125 */
|
||||||
|
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
/**
|
/**
|
||||||
* there is an implicit dependency on the fact that 'tachometer' listener is the 1st listener - this case
|
* there is an implicit dependency on the fact that 'tachometer' listener is the 1st listener - this case
|
||||||
* other listeners can access current RPM value
|
* other listeners can access current RPM value
|
||||||
|
@ -703,7 +703,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
||||||
initRpmCalculator(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
initRpmCalculator(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||||
|
|
||||||
#if (EFI_PROD_CODE && EFI_ENGINE_CONTROL) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE && EFI_ENGINE_CONTROL
|
||||||
initInjectorCentral(sharedLogger);
|
initInjectorCentral(sharedLogger);
|
||||||
#endif /* EFI_PROD_CODE && EFI_ENGINE_CONTROL */
|
#endif /* EFI_PROD_CODE && EFI_ENGINE_CONTROL */
|
||||||
|
|
||||||
|
@ -717,7 +717,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
||||||
|
|
||||||
chThdCreateStatic(csThreadStack, sizeof(csThreadStack), LOWPRIO, (tfunc_t)(void*) csThread, NULL);
|
chThdCreateStatic(csThreadStack, sizeof(csThreadStack), LOWPRIO, (tfunc_t)(void*) csThread, NULL);
|
||||||
|
|
||||||
#if (EFI_PROD_CODE && EFI_ENGINE_CONTROL) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE && EFI_ENGINE_CONTROL
|
||||||
/**
|
/**
|
||||||
* This has to go after 'initInjectorCentral' and 'initInjectorCentral' in order to
|
* This has to go after 'initInjectorCentral' and 'initInjectorCentral' in order to
|
||||||
* properly detect un-assigned output pins
|
* properly detect un-assigned output pins
|
||||||
|
@ -725,29 +725,29 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
||||||
prepareShapes(PASS_ENGINE_PARAMETER_SIGNATURE);
|
prepareShapes(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
#endif /* EFI_PROD_CODE && EFI_ENGINE_CONTROL */
|
#endif /* EFI_PROD_CODE && EFI_ENGINE_CONTROL */
|
||||||
|
|
||||||
#if EFI_PWM_TESTER || defined(__DOXYGEN__)
|
#if EFI_PWM_TESTER
|
||||||
initPwmTester();
|
initPwmTester();
|
||||||
#endif /* EFI_PWM_TESTER */
|
#endif /* EFI_PWM_TESTER */
|
||||||
|
|
||||||
initMalfunctionCentral();
|
initMalfunctionCentral();
|
||||||
|
|
||||||
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ALTERNATOR_CONTROL
|
||||||
initAlternatorCtrl(sharedLogger);
|
initAlternatorCtrl(sharedLogger);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_AUX_PID || defined(__DOXYGEN__)
|
#if EFI_AUX_PID
|
||||||
initAuxPid(sharedLogger);
|
initAuxPid(sharedLogger);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
|
#if EFI_ELECTRONIC_THROTTLE_BODY
|
||||||
initElectronicThrottle();
|
initElectronicThrottle();
|
||||||
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
||||||
|
|
||||||
#if EFI_MALFUNCTION_INDICATOR || defined(__DOXYGEN__)
|
#if EFI_MALFUNCTION_INDICATOR
|
||||||
initMalfunctionIndicator();
|
initMalfunctionIndicator();
|
||||||
#endif /* EFI_MALFUNCTION_INDICATOR */
|
#endif /* EFI_MALFUNCTION_INDICATOR */
|
||||||
|
|
||||||
#if EFI_MAP_AVERAGING || defined(__DOXYGEN__)
|
#if EFI_MAP_AVERAGING
|
||||||
if (engineConfiguration->isMapAveragingEnabled) {
|
if (engineConfiguration->isMapAveragingEnabled) {
|
||||||
initMapAveraging(sharedLogger, engine);
|
initMapAveraging(sharedLogger, engine);
|
||||||
}
|
}
|
||||||
|
@ -755,7 +755,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
||||||
|
|
||||||
initEgoAveraging(PASS_ENGINE_PARAMETER_SIGNATURE);
|
initEgoAveraging(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||||
if (CONFIGB(isEngineControlEnabled)) {
|
if (CONFIGB(isEngineControlEnabled)) {
|
||||||
/**
|
/**
|
||||||
* This method initialized the main listener which actually runs injectors & ignition
|
* This method initialized the main listener which actually runs injectors & ignition
|
||||||
|
@ -764,7 +764,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
||||||
}
|
}
|
||||||
#endif /* EFI_ENGINE_CONTROL */
|
#endif /* EFI_ENGINE_CONTROL */
|
||||||
|
|
||||||
#if EFI_IDLE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_IDLE_CONTROL
|
||||||
startIdleThread(sharedLogger);
|
startIdleThread(sharedLogger);
|
||||||
#endif /* EFI_IDLE_CONTROL */
|
#endif /* EFI_IDLE_CONTROL */
|
||||||
|
|
||||||
|
@ -772,15 +772,15 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
||||||
addConsoleAction("knockinfo", getKnockInfo);
|
addConsoleAction("knockinfo", getKnockInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
addConsoleAction("reset_accel", resetAccel);
|
addConsoleAction("reset_accel", resetAccel);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
#if EFI_HD44780_LCD || defined(__DOXYGEN__)
|
#if EFI_HD44780_LCD
|
||||||
initLcdController();
|
initLcdController();
|
||||||
#endif /* EFI_HD44780_LCD */
|
#endif /* EFI_HD44780_LCD */
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
initTachometer();
|
initTachometer();
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
}
|
}
|
||||||
|
@ -805,7 +805,7 @@ int getRusEfiVersion(void) {
|
||||||
return 123; // this is here to make the compiler happy about the unused array
|
return 123; // this is here to make the compiler happy about the unused array
|
||||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||||
return 3211; // this is here to make the compiler happy about the unused array
|
return 3211; // this is here to make the compiler happy about the unused array
|
||||||
#if defined(EFI_BOOTLOADER_INCLUDE_CODE) || defined(__DOXYGEN__)
|
#if defined(EFI_BOOTLOADER_INCLUDE_CODE)
|
||||||
// make bootloader code happy too
|
// make bootloader code happy too
|
||||||
if (initBootloader() != 0)
|
if (initBootloader() != 0)
|
||||||
return 123;
|
return 123;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#if EFI_INTERNAL_FLASH || defined(__DOXYGEN__)
|
#if EFI_INTERNAL_FLASH
|
||||||
#include "flash_main.h"
|
#include "flash_main.h"
|
||||||
#include "eficonsole.h"
|
#include "eficonsole.h"
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
// this message is part of console API, see FLASH_SUCCESS_MSG in java code
|
// this message is part of console API, see FLASH_SUCCESS_MSG in java code
|
||||||
#define FLASH_SUCCESS_MSG "FLASH_SUCESS"
|
#define FLASH_SUCCESS_MSG "FLASH_SUCESS"
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
#include "tunerstudio.h"
|
#include "tunerstudio.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ void initFlash(Logging *sharedLogger) {
|
||||||
* This would write NOW (you should not be doing this while connected to real engine)
|
* This would write NOW (you should not be doing this while connected to real engine)
|
||||||
*/
|
*/
|
||||||
addConsoleAction("writeconfig", writeConfigCommand);
|
addConsoleAction("writeconfig", writeConfigCommand);
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
/**
|
/**
|
||||||
* This would schedule write to flash once the engine is stopped
|
* This would schedule write to flash once the engine is stopped
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
// todo: rename this file
|
// todo: rename this file
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
|
|
||||||
#include "injector_central.h"
|
#include "injector_central.h"
|
||||||
|
@ -237,7 +237,7 @@ static BenchController instance;
|
||||||
void OutputPin::unregisterOutput(brain_pin_e oldPin, brain_pin_e newPin) {
|
void OutputPin::unregisterOutput(brain_pin_e oldPin, brain_pin_e newPin) {
|
||||||
if (oldPin != GPIO_UNASSIGNED && oldPin != newPin) {
|
if (oldPin != GPIO_UNASSIGNED && oldPin != newPin) {
|
||||||
scheduleMsg(logger, "unregistering %s", hwPortname(oldPin));
|
scheduleMsg(logger, "unregistering %s", hwPortname(oldPin));
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE
|
||||||
brain_pin_markUnused(oldPin);
|
brain_pin_markUnused(oldPin);
|
||||||
port = NULL;
|
port = NULL;
|
||||||
#endif /* EFI_GPIO_HARDWARE */
|
#endif /* EFI_GPIO_HARDWARE */
|
||||||
|
@ -261,7 +261,7 @@ void executeTSCommand(uint16_t subsystem, uint16_t index) {
|
||||||
milBench();
|
milBench();
|
||||||
} else if (subsystem == 0x17) {
|
} else if (subsystem == 0x17) {
|
||||||
// cmd_test_idle_valve
|
// cmd_test_idle_valve
|
||||||
#if EFI_IDLE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_IDLE_CONTROL
|
||||||
startIdleBench();
|
startIdleBench();
|
||||||
#endif
|
#endif
|
||||||
} else if (subsystem == 0x20 && index == 0x3456) {
|
} else if (subsystem == 0x20 && index == 0x3456) {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
|
||||||
#if EFI_MAP_AVERAGING || defined(__DOXYGEN__)
|
#if EFI_MAP_AVERAGING
|
||||||
|
|
||||||
#include "map_averaging.h"
|
#include "map_averaging.h"
|
||||||
#include "trigger_central.h"
|
#include "trigger_central.h"
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "engine_math.h"
|
#include "engine_math.h"
|
||||||
|
|
||||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
#if EFI_SENSOR_CHART
|
||||||
#include "sensor_chart.h"
|
#include "sensor_chart.h"
|
||||||
#endif /* EFI_SENSOR_CHART */
|
#endif /* EFI_SENSOR_CHART */
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ static void startAveraging(void *arg) {
|
||||||
mapAveragingPin.setHigh();
|
mapAveragingPin.setHigh();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
#if HAL_USE_ADC
|
||||||
/**
|
/**
|
||||||
* This method is invoked from ADC callback.
|
* This method is invoked from ADC callback.
|
||||||
* @note This method is invoked OFTEN, this method is a potential bottle-next - the implementation should be
|
* @note This method is invoked OFTEN, this method is a potential bottle-next - the implementation should be
|
||||||
|
@ -137,7 +137,7 @@ void mapAveragingAdcCallback(adcsample_t adcValue) {
|
||||||
measurementsPerRevolutionCounter++;
|
measurementsPerRevolutionCounter++;
|
||||||
efiAssertVoid(CUSTOM_ERR_6650, getCurrentRemainingStack() > 128, "lowstck#9a");
|
efiAssertVoid(CUSTOM_ERR_6650, getCurrentRemainingStack() > 128, "lowstck#9a");
|
||||||
|
|
||||||
#if (EFI_SENSOR_CHART && EFI_ANALOG_SENSORS) || defined(__DOXYGEN__)
|
#if EFI_SENSOR_CHART && EFI_ANALOG_SENSORS
|
||||||
if (ENGINE(sensorChartMode) == SC_MAP) {
|
if (ENGINE(sensorChartMode) == SC_MAP) {
|
||||||
if (measurementsPerRevolutionCounter % FAST_MAP_CHART_SKIP_FACTOR
|
if (measurementsPerRevolutionCounter % FAST_MAP_CHART_SKIP_FACTOR
|
||||||
== 0) {
|
== 0) {
|
||||||
|
@ -179,7 +179,7 @@ static void endAveraging(void *arg) {
|
||||||
bool wasLocked = lockAnyContext();
|
bool wasLocked = lockAnyContext();
|
||||||
isAveraging = false;
|
isAveraging = false;
|
||||||
// with locking we would have a consistent state
|
// with locking we would have a consistent state
|
||||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
#if HAL_USE_ADC
|
||||||
if (mapMeasurementsCounter > 0) {
|
if (mapMeasurementsCounter > 0) {
|
||||||
v_averagedMapValue = adcToVoltsDivided(mapAdcAccumulator / mapMeasurementsCounter);
|
v_averagedMapValue = adcToVoltsDivided(mapAdcAccumulator / mapMeasurementsCounter);
|
||||||
// todo: move out of locked context?
|
// todo: move out of locked context?
|
||||||
|
@ -215,7 +215,7 @@ static void applyMapMinBufferLength() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void postMapState(TunerStudioOutputChannels *tsOutputChannels) {
|
void postMapState(TunerStudioOutputChannels *tsOutputChannels) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels->debugFloatField1 = v_averagedMapValue;
|
tsOutputChannels->debugFloatField1 = v_averagedMapValue;
|
||||||
tsOutputChannels->debugFloatField2 = engine->engineState.mapAveragingDuration;
|
tsOutputChannels->debugFloatField2 = engine->engineState.mapAveragingDuration;
|
||||||
tsOutputChannels->debugFloatField3 = currentPressure;
|
tsOutputChannels->debugFloatField3 = currentPressure;
|
||||||
|
@ -255,7 +255,7 @@ void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
*/
|
*/
|
||||||
static void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
|
static void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
|
||||||
uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
// this callback is invoked on interrupt thread
|
// this callback is invoked on interrupt thread
|
||||||
UNUSED(ckpEventType);
|
UNUSED(ckpEventType);
|
||||||
if (index != CONFIG(mapAveragingSchedulingAtIndex))
|
if (index != CONFIG(mapAveragingSchedulingAtIndex))
|
||||||
|
@ -312,7 +312,7 @@ static void showMapStats(void) {
|
||||||
scheduleMsg(logger, "per revolution %d", measurementsPerRevolution);
|
scheduleMsg(logger, "per revolution %d", measurementsPerRevolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Because of MAP window averaging, MAP is only available while engine is spinning
|
* Because of MAP window averaging, MAP is only available while engine is spinning
|
||||||
|
@ -323,7 +323,7 @@ float getMap(void) {
|
||||||
return getRawMap();
|
return getRawMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
|
#if EFI_ANALOG_SENSORS
|
||||||
if (!isValidRpm(GET_RPM_VALUE) || currentPressure == NO_VALUE_YET)
|
if (!isValidRpm(GET_RPM_VALUE) || currentPressure == NO_VALUE_YET)
|
||||||
return validateMap(getRawMap()); // maybe return NaN in case of stopped engine?
|
return validateMap(getRawMap()); // maybe return NaN in case of stopped engine?
|
||||||
return validateMap(currentPressure);
|
return validateMap(currentPressure);
|
||||||
|
@ -341,7 +341,7 @@ void initMapAveraging(Logging *sharedLogger, Engine *engine) {
|
||||||
// endTimer[0].name = "map end0";
|
// endTimer[0].name = "map end0";
|
||||||
// endTimer[1].name = "map end1";
|
// endTimer[1].name = "map end1";
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
addTriggerEventListener(&mapAveragingTriggerCallback, "MAP averaging", engine);
|
addTriggerEventListener(&mapAveragingTriggerCallback, "MAP averaging", engine);
|
||||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||||
addConsoleAction("faststat", showMapStats);
|
addConsoleAction("faststat", showMapStats);
|
||||||
|
@ -350,10 +350,10 @@ void initMapAveraging(Logging *sharedLogger, Engine *engine) {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
|
|
||||||
float getMap(void) {
|
float getMap(void) {
|
||||||
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
|
#if EFI_ANALOG_SENSORS
|
||||||
return getRawMap();
|
return getRawMap();
|
||||||
#else
|
#else
|
||||||
return NAN;
|
return NAN;
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
#if EFI_MAP_AVERAGING || defined(__DOXYGEN__)
|
#if EFI_MAP_AVERAGING
|
||||||
|
|
||||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
#if HAL_USE_ADC
|
||||||
void mapAveragingAdcCallback(adcsample_t newValue);
|
void mapAveragingAdcCallback(adcsample_t newValue);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ efitimesec_t getTimeNowSeconds(void);
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#if (EFI_PROD_CODE || EFI_SIMULATOR)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
#define GET_TIMESTAMP() port_rt_get_counter_value()
|
#define GET_TIMESTAMP() port_rt_get_counter_value()
|
||||||
#else
|
#else
|
||||||
#define GET_TIMESTAMP() 0
|
#define GET_TIMESTAMP() 0
|
||||||
|
|
|
@ -92,7 +92,7 @@ void setSingleCoilDwell(engine_configuration_s *engineConfiguration) {
|
||||||
engineConfiguration->sparkDwellValues[7] = 0;
|
engineConfiguration->sparkDwellValues[7] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
|
|
||||||
FuelSchedule::FuelSchedule() {
|
FuelSchedule::FuelSchedule() {
|
||||||
clear();
|
clear();
|
||||||
|
@ -189,7 +189,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
|
||||||
|
|
||||||
InjectionEvent *ev = &elements[i];
|
InjectionEvent *ev = &elements[i];
|
||||||
ev->ownIndex = i;
|
ev->ownIndex = i;
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
ev->engine = engine;
|
ev->engine = engine;
|
||||||
#endif
|
#endif
|
||||||
fixAngle(angle, "addFuel#1", CUSTOM_ERR_6554);
|
fixAngle(angle, "addFuel#1", CUSTOM_ERR_6554);
|
||||||
|
@ -207,7 +207,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(angle), "findAngle#3", false);
|
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(angle), "findAngle#3", false);
|
||||||
assertAngleRange(angle, "findAngle#a33", CUSTOM_ERR_6544);
|
assertAngleRange(angle, "findAngle#a33", CUSTOM_ERR_6544);
|
||||||
TRIGGER_SHAPE(findTriggerPosition(&ev->injectionStart, angle PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
|
TRIGGER_SHAPE(findTriggerPosition(&ev->injectionStart, angle PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
printf("registerInjectionEvent angle=%.2f trgIndex=%d inj %d\r\n", angle, ev->injectionStart.eventIndex, injectorIndex);
|
printf("registerInjectionEvent angle=%.2f trgIndex=%d inj %d\r\n", angle, ev->injectionStart.eventIndex, injectorIndex);
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
|
@ -242,7 +242,7 @@ static floatms_t getCrankingSparkDwell(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
* @return Spark dwell time, in milliseconds. 0 if tables are not ready.
|
* @return Spark dwell time, in milliseconds. 0 if tables are not ready.
|
||||||
*/
|
*/
|
||||||
floatms_t getSparkDwell(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
floatms_t getSparkDwell(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||||
float dwellMs;
|
float dwellMs;
|
||||||
if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
||||||
dwellMs = getCrankingSparkDwell(PASS_ENGINE_PARAMETER_SIGNATURE);
|
dwellMs = getCrankingSparkDwell(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
@ -442,7 +442,7 @@ static int getIgnitionPinForIndex(int i DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
|
||||||
void prepareIgnitionPinIndices(ignition_mode_e ignitionMode DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void prepareIgnitionPinIndices(ignition_mode_e ignitionMode DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
if (ignitionMode != engine->ignitionModeForPinIndices) {
|
if (ignitionMode != engine->ignitionModeForPinIndices) {
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
||||||
ENGINE(ignitionPin[i]) = getIgnitionPinForIndex(i PASS_ENGINE_PARAMETER_SUFFIX);
|
ENGINE(ignitionPin[i]) = getIgnitionPinForIndex(i PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,7 @@ void prepareIgnitionPinIndices(ignition_mode_e ignitionMode DECLARE_ENGINE_PARAM
|
||||||
*/
|
*/
|
||||||
ignition_mode_e getCurrentIgnitionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
ignition_mode_e getCurrentIgnitionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
ignition_mode_e ignitionMode = CONFIG(ignitionMode);
|
ignition_mode_e ignitionMode = CONFIG(ignitionMode);
|
||||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
// In spin-up cranking mode we don't have full phase sync. info yet, so wasted spark mode is better
|
// In spin-up cranking mode we don't have full phase sync. info yet, so wasted spark mode is better
|
||||||
if (ignitionMode == IM_INDIVIDUAL_COILS && ENGINE(rpmCalculator.isSpinningUp(PASS_ENGINE_PARAMETER_SIGNATURE)))
|
if (ignitionMode == IM_INDIVIDUAL_COILS && ENGINE(rpmCalculator.isSpinningUp(PASS_ENGINE_PARAMETER_SIGNATURE)))
|
||||||
ignitionMode = IM_WASTED_SPARK;
|
ignitionMode = IM_WASTED_SPARK;
|
||||||
|
@ -465,7 +465,7 @@ ignition_mode_e getCurrentIgnitionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
return ignitionMode;
|
return ignitionMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This heavy method is only invoked in case of a configuration change or initialization.
|
* This heavy method is only invoked in case of a configuration change or initialization.
|
||||||
|
|
|
@ -135,7 +135,7 @@ floatms_t getSpeedDensityFuel(float map DECLARE_GLOBAL_SUFFIX) {
|
||||||
warning(CUSTOM_ERR_6685, "NaN airMass");
|
warning(CUSTOM_ERR_6685, "NaN airMass");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__)
|
#if EFI_PRINTF_FUEL_DETAILS
|
||||||
printf("map=%.2f adjustedMap=%.2f airMass=%.2f\t\n",
|
printf("map=%.2f adjustedMap=%.2f airMass=%.2f\t\n",
|
||||||
map, adjustedMap, engine->engineState.airMass);
|
map, adjustedMap, engine->engineState.airMass);
|
||||||
#endif /*EFI_PRINTF_FUEL_DETAILS */
|
#endif /*EFI_PRINTF_FUEL_DETAILS */
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#if EFI_CAN_SUPPORT || defined(__DOXYGEN__)
|
#if EFI_CAN_SUPPORT
|
||||||
|
|
||||||
|
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
@ -192,7 +192,7 @@ static void handleDtcRequest(int numCodes, int *dtcCode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAL_USE_CAN || defined(__DOXYGEN__)
|
#if HAL_USE_CAN
|
||||||
void obdOnCanPacketRx(CANRxFrame *rx) {
|
void obdOnCanPacketRx(CANRxFrame *rx) {
|
||||||
if (rx->SID != OBD_TEST_REQUEST) {
|
if (rx->SID != OBD_TEST_REQUEST) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#define PID_SUPPORTED_PIDS_REQUEST_41_60 0x40
|
#define PID_SUPPORTED_PIDS_REQUEST_41_60 0x40
|
||||||
#define PID_FUEL_RATE 0x5E
|
#define PID_FUEL_RATE 0x5E
|
||||||
|
|
||||||
#if HAL_USE_CAN || defined(__DOXYGEN__)
|
#if HAL_USE_CAN
|
||||||
void obdOnCanPacketRx(CANRxFrame *rx);
|
void obdOnCanPacketRx(CANRxFrame *rx);
|
||||||
#endif /* HAL_USE_CAN */
|
#endif /* HAL_USE_CAN */
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ bool EventQueue::checkIfPending(scheduling_s *scheduling) {
|
||||||
* @return true if inserted into the head of the list
|
* @return true if inserted into the head of the list
|
||||||
*/
|
*/
|
||||||
bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t callback, void *param) {
|
bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t callback, void *param) {
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
assertListIsSorted();
|
assertListIsSorted();
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, callback != NULL, "NULL callback", false);
|
efiAssert(CUSTOM_ERR_ASSERT, callback != NULL, "NULL callback", false);
|
||||||
|
@ -47,7 +47,7 @@ bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t
|
||||||
// please note that simulator does not use this code at all - simulator uses signal_executor_sleep
|
// please note that simulator does not use this code at all - simulator uses signal_executor_sleep
|
||||||
|
|
||||||
if (scheduling->isScheduled) {
|
if (scheduling->isScheduled) {
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
printf("Already scheduled was %d\r\n", (int)scheduling->momentX);
|
printf("Already scheduled was %d\r\n", (int)scheduling->momentX);
|
||||||
printf("Already scheduled now %d\r\n", (int)timeX);
|
printf("Already scheduled now %d\r\n", (int)timeX);
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
@ -62,7 +62,7 @@ bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t
|
||||||
if (head == NULL || timeX < head->momentX) {
|
if (head == NULL || timeX < head->momentX) {
|
||||||
// here we insert into head of the linked list
|
// here we insert into head of the linked list
|
||||||
LL_PREPEND(head, scheduling);
|
LL_PREPEND(head, scheduling);
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
assertListIsSorted();
|
assertListIsSorted();
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
return true;
|
return true;
|
||||||
|
@ -75,7 +75,7 @@ bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t
|
||||||
|
|
||||||
scheduling->next = insertPosition->next;
|
scheduling->next = insertPosition->next;
|
||||||
insertPosition->next = scheduling;
|
insertPosition->next = scheduling;
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
assertListIsSorted();
|
assertListIsSorted();
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
return false;
|
return false;
|
||||||
|
@ -154,7 +154,7 @@ int EventQueue::executeAll(efitime_t now) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
assertListIsSorted();
|
assertListIsSorted();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ int EventQueue::executeAll(efitime_t now) {
|
||||||
current->isScheduled = false;
|
current->isScheduled = false;
|
||||||
uint32_t howFarOff = now - current->momentX;
|
uint32_t howFarOff = now - current->momentX;
|
||||||
maxSchedulingPrecisionLoss = maxI(maxSchedulingPrecisionLoss, howFarOff);
|
maxSchedulingPrecisionLoss = maxI(maxSchedulingPrecisionLoss, howFarOff);
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
printf("QUEUE: execute current=%d param=%d\r\n", (long)current, (long)current->param);
|
printf("QUEUE: execute current=%d param=%d\r\n", (long)current, (long)current->param);
|
||||||
#endif
|
#endif
|
||||||
current->callback(current->param);
|
current->callback(current->param);
|
||||||
|
@ -192,7 +192,7 @@ int EventQueue::size(void) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
void EventQueue::assertListIsSorted() {
|
void EventQueue::assertListIsSorted() {
|
||||||
scheduling_s *current = head;
|
scheduling_s *current = head;
|
||||||
while (current != NULL && current->next != NULL) {
|
while (current != NULL && current->next != NULL) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ class scheduling_s {
|
||||||
public:
|
public:
|
||||||
scheduling_s();
|
scheduling_s();
|
||||||
|
|
||||||
#if EFI_SIGNAL_EXECUTOR_SLEEP || defined(__DOXYGEN__)
|
#if EFI_SIGNAL_EXECUTOR_SLEEP
|
||||||
virtual_timer_t timer;
|
virtual_timer_t timer;
|
||||||
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */
|
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER
|
||||||
#include "engine_sniffer.h"
|
#include "engine_sniffer.h"
|
||||||
extern WaveChart waveChart;
|
extern WaveChart waveChart;
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
|
|
|
@ -27,19 +27,19 @@
|
||||||
#include "signal_executor.h"
|
#include "signal_executor.h"
|
||||||
#include "main_trigger_callback.h"
|
#include "main_trigger_callback.h"
|
||||||
|
|
||||||
#if EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_SIMULATOR
|
||||||
// this is about debugging
|
// this is about debugging
|
||||||
#include "efi_gpio.h"
|
#include "efi_gpio.h"
|
||||||
#endif /* EFI_SIMULATOR */
|
#endif /* EFI_SIMULATOR */
|
||||||
|
|
||||||
#if EFI_SIGNAL_EXECUTOR_SLEEP || defined(__DOXYGEN__)
|
#if EFI_SIGNAL_EXECUTOR_SLEEP
|
||||||
|
|
||||||
void SleepExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param) {
|
void SleepExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param) {
|
||||||
scheduleForLater(scheduling, timeUs - getTimeNowUs(), callback, param);
|
scheduleForLater(scheduling, timeUs - getTimeNowUs(), callback, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void timerCallback(scheduling_s *scheduling) {
|
static void timerCallback(scheduling_s *scheduling) {
|
||||||
#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__)
|
#if EFI_PRINTF_FUEL_DETAILS
|
||||||
if (scheduling->callback == (schfunc_t)&seTurnPinLow) {
|
if (scheduling->callback == (schfunc_t)&seTurnPinLow) {
|
||||||
printf("executing cb=seTurnPinLow p=%d sch=%d now=%d\r\n", (int)scheduling->param, (int)scheduling,
|
printf("executing cb=seTurnPinLow p=%d sch=%d now=%d\r\n", (int)scheduling->param, (int)scheduling,
|
||||||
(int)getTimeNowUs());
|
(int)getTimeNowUs());
|
||||||
|
@ -73,7 +73,7 @@ static void doScheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t
|
||||||
chVTResetI(&scheduling->timer);
|
chVTResetI(&scheduling->timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_SIMULATOR
|
||||||
if (callback == (schfunc_t)&seTurnPinLow) {
|
if (callback == (schfunc_t)&seTurnPinLow) {
|
||||||
printf("setTime cb=seTurnPinLow p=%d\r\n", (int)param);
|
printf("setTime cb=seTurnPinLow p=%d\r\n", (int)param);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "efitime.h"
|
#include "efitime.h"
|
||||||
|
|
||||||
|
|
||||||
#if EFI_SIGNAL_EXECUTOR_ONE_TIMER || defined(__DOXYGEN__)
|
#if EFI_SIGNAL_EXECUTOR_ONE_TIMER
|
||||||
#include "microsecond_timer.h"
|
#include "microsecond_timer.h"
|
||||||
#include "tunerstudio_configuration.h"
|
#include "tunerstudio_configuration.h"
|
||||||
#include "rfiutil.h"
|
#include "rfiutil.h"
|
||||||
|
@ -161,13 +161,13 @@ void initSingleTimerExecutorHardware(void) {
|
||||||
initMicrosecondTimer();
|
initMicrosecondTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
||||||
void executorStatistics() {
|
void executorStatistics() {
|
||||||
if (engineConfiguration->debugMode == DBG_EXECUTOR) {
|
if (engineConfiguration->debugMode == DBG_EXECUTOR) {
|
||||||
#if (EFI_TUNER_STUDIO && EFI_SIGNAL_EXECUTOR_ONE_TIMER) || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO && EFI_SIGNAL_EXECUTOR_ONE_TIMER
|
||||||
tsOutputChannels.debugIntField1 = ___engine.executor.timerCallbackCounter;
|
tsOutputChannels.debugIntField1 = ___engine.executor.timerCallbackCounter;
|
||||||
tsOutputChannels.debugIntField2 = ___engine.executor.doExecuteCounter;
|
tsOutputChannels.debugIntField2 = ___engine.executor.doExecuteCounter;
|
||||||
tsOutputChannels.debugIntField3 = ___engine.executor.scheduleCounter;
|
tsOutputChannels.debugIntField3 = ___engine.executor.scheduleCounter;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "analog_input.h"
|
#include "analog_input.h"
|
||||||
#include "cyclic_buffer.h"
|
#include "cyclic_buffer.h"
|
||||||
|
|
||||||
#if EFI_CJ125 || defined(__DOXYGEN__)
|
#if EFI_CJ125
|
||||||
#include "cj125.h"
|
#include "cj125.h"
|
||||||
#endif /* EFI_CJ125 */
|
#endif /* EFI_CJ125 */
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ void initEgoAveraging(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool hasAfrSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
bool hasAfrSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#if (EFI_CJ125 && HAL_USE_SPI) || defined(__DOXYGEN__)
|
#if EFI_CJ125 && HAL_USE_SPI
|
||||||
if (CONFIGB(isCJ125Enabled)) {
|
if (CONFIGB(isCJ125Enabled)) {
|
||||||
return cjHasAfrSensor(PASS_ENGINE_PARAMETER_SIGNATURE);
|
return cjHasAfrSensor(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ bool hasAfrSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float getAfr(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
float getAfr(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#if (EFI_CJ125 && HAL_USE_SPI) || defined(__DOXYGEN__)
|
#if EFI_CJ125 && HAL_USE_SPI
|
||||||
if (CONFIGB(isCJ125Enabled)) {
|
if (CONFIGB(isCJ125Enabled)) {
|
||||||
return cjGetAfr(PASS_ENGINE_PARAMETER_SIGNATURE);
|
return cjGetAfr(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "engine_controller.h"
|
#include "engine_controller.h"
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
#include "digital_input_hw.h"
|
#include "digital_input_hw.h"
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
|
#if EFI_ANALOG_SENSORS
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ float validateBaroMap(float mapKPa DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
* @returns kPa value
|
* @returns kPa value
|
||||||
*/
|
*/
|
||||||
float getMapByVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
float getMapByVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if EFI_ENABLE_MOCK_ADC || defined(__DOXYGEN__)
|
#if EFI_ENABLE_MOCK_ADC
|
||||||
int mapChannel = engineConfiguration->map.sensor.hwChannel;
|
int mapChannel = engineConfiguration->map.sensor.hwChannel;
|
||||||
if (engine->engineState.mockAdcState.hasMockAdc[mapChannel])
|
if (engine->engineState.mockAdcState.hasMockAdc[mapChannel])
|
||||||
voltage = adcToVolts(engine->engineState.mockAdcState.getMockAdcValue(mapChannel) * engineConfiguration->analogInputDividerCoefficient);
|
voltage = adcToVolts(engine->engineState.mockAdcState.getMockAdcValue(mapChannel) * engineConfiguration->analogInputDividerCoefficient);
|
||||||
|
@ -212,12 +212,12 @@ static void digitalMapWidthCallback(void) {
|
||||||
prevWidthTimeNt = nowNt;
|
prevWidthTimeNt = nowNt;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
|
|
||||||
extern int mapMinBufferLength;
|
extern int mapMinBufferLength;
|
||||||
|
|
||||||
static void printMAPInfo(void) {
|
static void printMAPInfo(void) {
|
||||||
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
|
#if EFI_ANALOG_SENSORS
|
||||||
scheduleMsg(logger, "instant value=%.2fkPa", getRawMap());
|
scheduleMsg(logger, "instant value=%.2fkPa", getRawMap());
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
applyConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
applyConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
//engine->configurationListeners.registerCallback(applyConfiguration);
|
//engine->configurationListeners.registerCallback(applyConfiguration);
|
||||||
|
|
||||||
#if HAL_USE_ICU || defined(__DOXYGEN__)
|
#if HAL_USE_ICU
|
||||||
if (engineConfiguration->hasFrequencyReportingMapSensor) {
|
if (engineConfiguration->hasFrequencyReportingMapSensor) {
|
||||||
digital_input_s* digitalMapInput = addWaveAnalyzerDriver("map freq", CONFIGB(frequencyReportingMapInputPin));
|
digital_input_s* digitalMapInput = addWaveAnalyzerDriver("map freq", CONFIGB(frequencyReportingMapInputPin));
|
||||||
startInputDriver("MAP", digitalMapInput, true);
|
startInputDriver("MAP", digitalMapInput, true);
|
||||||
|
|
|
@ -148,7 +148,7 @@ void ThermistorMath::prepareThermistorCurve(thermistor_conf_s *tc) {
|
||||||
float T1 = tc->tempC_1 + KELV;
|
float T1 = tc->tempC_1 + KELV;
|
||||||
float T2 = tc->tempC_2 + KELV;
|
float T2 = tc->tempC_2 + KELV;
|
||||||
float T3 = tc->tempC_3 + KELV;
|
float T3 = tc->tempC_3 + KELV;
|
||||||
#if EXTREME_TERM_LOGGING || defined(__DOXYGEN__)
|
#if EXTREME_TERM_LOGGING
|
||||||
scheduleMsg(logger, "T1=%.5f/T2=%.5f/T3=%.5f", T1, T2, T3);
|
scheduleMsg(logger, "T1=%.5f/T2=%.5f/T3=%.5f", T1, T2, T3);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ void ThermistorMath::prepareThermistorCurve(thermistor_conf_s *tc) {
|
||||||
}
|
}
|
||||||
float L2 = logf(tc->resistance_2);
|
float L2 = logf(tc->resistance_2);
|
||||||
float L3 = logf(tc->resistance_3);
|
float L3 = logf(tc->resistance_3);
|
||||||
#if EXTREME_TERM_LOGGING || defined(__DOXYGEN__)
|
#if EXTREME_TERM_LOGGING
|
||||||
scheduleMsg(logger, "R1=%.5f/R2=%.5f/R3=%.5f", tc->resistance_1, tc->resistance_2,
|
scheduleMsg(logger, "R1=%.5f/R2=%.5f/R3=%.5f", tc->resistance_1, tc->resistance_2,
|
||||||
tc->resistance_3);
|
tc->resistance_3);
|
||||||
scheduleMsg(logger, "L1=%.5f/L2=%.5f/L3=%.5f", L1, L2, L3);
|
scheduleMsg(logger, "L1=%.5f/L2=%.5f/L3=%.5f", L1, L2, L3);
|
||||||
|
@ -181,7 +181,7 @@ void ThermistorMath::prepareThermistorCurve(thermistor_conf_s *tc) {
|
||||||
s_h_b = U2 - s_h_c * (L1 * L1 + L1 * L2 + L2 * L2);
|
s_h_b = U2 - s_h_c * (L1 * L1 + L1 * L2 + L2 * L2);
|
||||||
s_h_a = Y1 - (s_h_b + L1 * L1 * s_h_c) * L1;
|
s_h_a = Y1 - (s_h_b + L1 * L1 * s_h_c) * L1;
|
||||||
|
|
||||||
#if EXTREME_TERM_LOGGING || defined(__DOXYGEN__)
|
#if EXTREME_TERM_LOGGING
|
||||||
scheduleMsg(logger, "Y1=%.5f/Y2=%.5f/Y3=%.5f", Y1, Y2, Y3);
|
scheduleMsg(logger, "Y1=%.5f/Y2=%.5f/Y3=%.5f", Y1, Y2, Y3);
|
||||||
scheduleMsg(logger, "U2=%.5f/U3=%.5f", U2, U3);
|
scheduleMsg(logger, "U2=%.5f/U3=%.5f", U2, U3);
|
||||||
scheduleMsg(logger, "s_h_c=%.5f/s_h_b=%.5f/s_h_a=%.5f", curve->s_h_c, curve->s_h_b,
|
scheduleMsg(logger, "s_h_c=%.5f/s_h_b=%.5f/s_h_a=%.5f", curve->s_h_c, curve->s_h_b,
|
||||||
|
@ -204,7 +204,7 @@ float getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->useLinearIatSensor);
|
engineConfiguration->useLinearIatSensor);
|
||||||
if (!isValidIntakeAirTemperature(temperature)) {
|
if (!isValidIntakeAirTemperature(temperature)) {
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, engineConfiguration!=NULL, "NULL engineConfiguration", NAN);
|
efiAssert(CUSTOM_ERR_ASSERT, engineConfiguration!=NULL, "NULL engineConfiguration", NAN);
|
||||||
#if EFI_PROD_CODE || EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_UNIT_TEST
|
||||||
warning(OBD_Intake_Air_Temperature_Circuit_Malfunction, "unrealistic IAT %.2f", temperature);
|
warning(OBD_Intake_Air_Temperature_Circuit_Malfunction, "unrealistic IAT %.2f", temperature);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
return LIMPING_MODE_IAT_TEMPERATURE;
|
return LIMPING_MODE_IAT_TEMPERATURE;
|
||||||
|
@ -232,7 +232,7 @@ void set10K_4050K(ThermistorConf *thermistorConf) {
|
||||||
setThermistorConfiguration(thermistorConf, -30, 108000, 25.0, 10000, 130.0, 225);
|
setThermistorConfiguration(thermistorConf, -30, 108000, 25.0, 10000, 130.0, 225);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
static void testCltByR(float resistance) {
|
static void testCltByR(float resistance) {
|
||||||
if (logger == NULL) {
|
if (logger == NULL) {
|
||||||
firmwareError(CUSTOM_ERR_THERM, "thermstr not initialized");
|
firmwareError(CUSTOM_ERR_THERM, "thermstr not initialized");
|
||||||
|
@ -249,7 +249,7 @@ void initThermistors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
logger = sharedLogger;
|
logger = sharedLogger;
|
||||||
efiAssertVoid(CUSTOM_ERR_6578, engine!=NULL, "e NULL initThermistors");
|
efiAssertVoid(CUSTOM_ERR_6578, engine!=NULL, "e NULL initThermistors");
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
addConsoleActionF("test_clt_by_r", testCltByR);
|
addConsoleActionF("test_clt_by_r", testCltByR);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,13 +79,13 @@ percent_t getTpsValue(int adc DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
}
|
}
|
||||||
float result = interpolateMsg("TPS", TPS_TS_CONVERSION * engineConfiguration->tpsMax, 100, TPS_TS_CONVERSION * engineConfiguration->tpsMin, 0, adc);
|
float result = interpolateMsg("TPS", TPS_TS_CONVERSION * engineConfiguration->tpsMax, 100, TPS_TS_CONVERSION * engineConfiguration->tpsMin, 0, adc);
|
||||||
if (result < engineConfiguration->tpsErrorDetectionTooLow) {
|
if (result < engineConfiguration->tpsErrorDetectionTooLow) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
// too much noise with simulator
|
// too much noise with simulator
|
||||||
warning(OBD_Throttle_Position_Sensor_Circuit_Malfunction, "TPS too low: %.2f", result);
|
warning(OBD_Throttle_Position_Sensor_Circuit_Malfunction, "TPS too low: %.2f", result);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
}
|
}
|
||||||
if (result > engineConfiguration->tpsErrorDetectionTooHigh) {
|
if (result > engineConfiguration->tpsErrorDetectionTooHigh) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
// too much noise with simulator
|
// too much noise with simulator
|
||||||
warning(OBD_Throttle_Position_Sensor_Range_Performance_Problem, "TPS too high: %.2f", result);
|
warning(OBD_Throttle_Position_Sensor_Range_Performance_Problem, "TPS too high: %.2f", result);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "alternator_controller.h"
|
#include "alternator_controller.h"
|
||||||
#include "trigger_emulator.h"
|
#include "trigger_emulator.h"
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
#include "vehicle_speed.h"
|
#include "vehicle_speed.h"
|
||||||
#include "electronic_throttle.h"
|
#include "electronic_throttle.h"
|
||||||
#include "rtc_helper.h"
|
#include "rtc_helper.h"
|
||||||
|
@ -38,17 +38,17 @@
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH || defined(__DOXYGEN__)
|
#if EFI_INTERNAL_FLASH
|
||||||
#include "flash_main.h"
|
#include "flash_main.h"
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* EFI_INTERNAL_FLASH */
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER
|
||||||
#include "engine_sniffer.h"
|
#include "engine_sniffer.h"
|
||||||
extern int waveChartUsedSize;
|
extern int waveChartUsedSize;
|
||||||
extern WaveChart waveChart;
|
extern WaveChart waveChart;
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
|
|
||||||
#if !defined(SETTINGS_LOGGING_BUFFER_SIZE) || defined(__DOXYGEN__)
|
#if !defined(SETTINGS_LOGGING_BUFFER_SIZE)
|
||||||
#define SETTINGS_LOGGING_BUFFER_SIZE 1000
|
#define SETTINGS_LOGGING_BUFFER_SIZE 1000
|
||||||
#endif /* SETTINGS_LOGGING_BUFFER_SIZE */
|
#endif /* SETTINGS_LOGGING_BUFFER_SIZE */
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ void setEngineType(int value) {
|
||||||
|
|
||||||
engineConfiguration->engineType = (engine_type_e) value;
|
engineConfiguration->engineType = (engine_type_e) value;
|
||||||
resetConfigurationExt(&logger, (engine_type_e) value PASS_ENGINE_PARAMETER_SUFFIX);
|
resetConfigurationExt(&logger, (engine_type_e) value PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER
|
||||||
if (engine->isTestMode)
|
if (engine->isTestMode)
|
||||||
waveChart.reset();
|
waveChart.reset();
|
||||||
#endif
|
#endif
|
||||||
|
@ -409,7 +409,7 @@ static void printThermistor(const char *msg, ThermistorConf *config, ThermistorM
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printTPSInfo(void) {
|
static void printTPSInfo(void) {
|
||||||
#if (EFI_PROD_CODE && HAL_USE_ADC) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE && HAL_USE_ADC
|
||||||
if (!hasTpsSensor()) {
|
if (!hasTpsSensor()) {
|
||||||
scheduleMsg(&logger, "NO TPS SENSOR");
|
scheduleMsg(&logger, "NO TPS SENSOR");
|
||||||
return;
|
return;
|
||||||
|
@ -424,7 +424,7 @@ static void printTPSInfo(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printTemperatureInfo(void) {
|
static void printTemperatureInfo(void) {
|
||||||
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
|
#if EFI_ANALOG_SENSORS
|
||||||
printThermistor("CLT", &engineConfiguration->clt, &engine->engineState.cltCurve,
|
printThermistor("CLT", &engineConfiguration->clt, &engine->engineState.cltCurve,
|
||||||
engineConfiguration->useLinearCltSensor);
|
engineConfiguration->useLinearCltSensor);
|
||||||
if (!isValidCoolantTemperature(getCoolantTemperature(PASS_ENGINE_PARAMETER_SIGNATURE))) {
|
if (!isValidCoolantTemperature(getCoolantTemperature(PASS_ENGINE_PARAMETER_SIGNATURE))) {
|
||||||
|
@ -767,7 +767,7 @@ static void setTriggerSimulatorPin(const char *indexStr, const char *pinName) {
|
||||||
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
|
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
#if HAL_USE_ADC
|
||||||
static void setAnalogInputPin(const char *sensorStr, const char *pinName) {
|
static void setAnalogInputPin(const char *sensorStr, const char *pinName) {
|
||||||
brain_pin_e pin = parseBrainPin(pinName);
|
brain_pin_e pin = parseBrainPin(pinName);
|
||||||
if (pin == GPIO_INVALID) {
|
if (pin == GPIO_INVALID) {
|
||||||
|
@ -880,9 +880,9 @@ static void enableOrDisable(const char *param, bool isEnabled) {
|
||||||
engineConfiguration->isEngineChartEnabled = isEnabled;
|
engineConfiguration->isEngineChartEnabled = isEnabled;
|
||||||
} else if (strEqualCaseInsensitive(param, "step1limimter")) {
|
} else if (strEqualCaseInsensitive(param, "step1limimter")) {
|
||||||
boardConfiguration->enabledStep1Limiter = isEnabled;
|
boardConfiguration->enabledStep1Limiter = isEnabled;
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
} else if (strEqualCaseInsensitive(param, "auto_idle")) {
|
} else if (strEqualCaseInsensitive(param, "auto_idle")) {
|
||||||
#if EFI_IDLE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_IDLE_CONTROL
|
||||||
setIdleMode(isEnabled ? IM_MANUAL : IM_AUTO);
|
setIdleMode(isEnabled ? IM_MANUAL : IM_AUTO);
|
||||||
#endif /* EFI_IDLE_CONTROL */
|
#endif /* EFI_IDLE_CONTROL */
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
@ -1007,7 +1007,7 @@ typedef struct {
|
||||||
} plain_get_float_s;
|
} plain_get_float_s;
|
||||||
|
|
||||||
|
|
||||||
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if ! EFI_UNIT_TEST
|
||||||
const plain_get_short_s getS_plain[] = {
|
const plain_get_short_s getS_plain[] = {
|
||||||
{"idle_pid_min", (uint16_t *)&engineConfiguration->idleRpmPid.minValue},
|
{"idle_pid_min", (uint16_t *)&engineConfiguration->idleRpmPid.minValue},
|
||||||
{"idle_pid_max", (uint16_t *)&engineConfiguration->idleRpmPid.maxValue},
|
{"idle_pid_max", (uint16_t *)&engineConfiguration->idleRpmPid.maxValue},
|
||||||
|
@ -1065,7 +1065,7 @@ const plain_get_float_s getF_plain[] = {
|
||||||
|
|
||||||
|
|
||||||
static void getValue(const char *paramStr) {
|
static void getValue(const char *paramStr) {
|
||||||
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if ! EFI_UNIT_TEST
|
||||||
{
|
{
|
||||||
const plain_get_integer_s *currentI = &getI_plain[0];
|
const plain_get_integer_s *currentI = &getI_plain[0];
|
||||||
while (currentI < getI_plain + sizeof(getI_plain)/sizeof(getI_plain[0])) {
|
while (currentI < getI_plain + sizeof(getI_plain)/sizeof(getI_plain[0])) {
|
||||||
|
@ -1093,7 +1093,7 @@ static void getValue(const char *paramStr) {
|
||||||
|
|
||||||
if (strEqualCaseInsensitive(paramStr, "isCJ125Enabled")) {
|
if (strEqualCaseInsensitive(paramStr, "isCJ125Enabled")) {
|
||||||
scheduleMsg(&logger, "isCJ125Enabled=%d", boardConfiguration->isCJ125Enabled);
|
scheduleMsg(&logger, "isCJ125Enabled=%d", boardConfiguration->isCJ125Enabled);
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
} else if (strEqualCaseInsensitive(paramStr, "bor")) {
|
} else if (strEqualCaseInsensitive(paramStr, "bor")) {
|
||||||
showBor();
|
showBor();
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
@ -1111,7 +1111,7 @@ static void getValue(const char *paramStr) {
|
||||||
scheduleMsg(&logger, "isHip9011Enabled=%d", boardConfiguration->isHip9011Enabled);
|
scheduleMsg(&logger, "isHip9011Enabled=%d", boardConfiguration->isHip9011Enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_RTC || defined(__DOXYGEN__)
|
#if EFI_RTC
|
||||||
else if (strEqualCaseInsensitive(paramStr, "date")) {
|
else if (strEqualCaseInsensitive(paramStr, "date")) {
|
||||||
printDateTime();
|
printDateTime();
|
||||||
}
|
}
|
||||||
|
@ -1140,7 +1140,7 @@ typedef struct {
|
||||||
} command_f_s;
|
} command_f_s;
|
||||||
|
|
||||||
const command_f_s commandsF[] = {
|
const command_f_s commandsF[] = {
|
||||||
#if (EFI_ENGINE_CONTROL && EFI_ENABLE_MOCK_ADC) || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL && EFI_ENABLE_MOCK_ADC
|
||||||
{"mock_iat_voltage", setMockIatVoltage},
|
{"mock_iat_voltage", setMockIatVoltage},
|
||||||
{"mock_pedal_position", setMockPedalPosition},
|
{"mock_pedal_position", setMockPedalPosition},
|
||||||
{"mock_maf_voltage", setMockMafVoltage},
|
{"mock_maf_voltage", setMockMafVoltage},
|
||||||
|
@ -1172,11 +1172,11 @@ const command_f_s commandsF[] = {
|
||||||
{"engine_decel_threshold", setDecelThr},
|
{"engine_decel_threshold", setDecelThr},
|
||||||
{"engine_decel_multiplier", setDecelMult},
|
{"engine_decel_multiplier", setDecelMult},
|
||||||
{"flat_injector_lag", setFlatInjectorLag},
|
{"flat_injector_lag", setFlatInjectorLag},
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
#if EFI_VEHICLE_SPEED || defined(__DOXYGEN__)
|
#if EFI_VEHICLE_SPEED
|
||||||
{"mock_vehicle_speed", setMockVehicleSpeed},
|
{"mock_vehicle_speed", setMockVehicleSpeed},
|
||||||
#endif /* EFI_VEHICLE_SPEED */
|
#endif /* EFI_VEHICLE_SPEED */
|
||||||
#if EFI_IDLE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_IDLE_CONTROL
|
||||||
{"idle_offset", setIdleOffset},
|
{"idle_offset", setIdleOffset},
|
||||||
{"idle_p", setIdlePFactor},
|
{"idle_p", setIdlePFactor},
|
||||||
{"idle_i", setIdleIFactor},
|
{"idle_i", setIdleIFactor},
|
||||||
|
@ -1231,12 +1231,12 @@ const command_i_s commandsI[] = {{"ignition_mode", setIgnitionMode},
|
||||||
{"idle_solenoid_freq", setIdleSolenoidFrequency},
|
{"idle_solenoid_freq", setIdleSolenoidFrequency},
|
||||||
{"tps_accel_len", setTpsAccelLen},
|
{"tps_accel_len", setTpsAccelLen},
|
||||||
{"engine_load_accel_len", setEngineLoadAccelLen},
|
{"engine_load_accel_len", setEngineLoadAccelLen},
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
{"bor", setBor},
|
{"bor", setBor},
|
||||||
#if EFI_CAN_SUPPORT || defined(__DOXYGEN__)
|
#if EFI_CAN_SUPPORT
|
||||||
{"can_mode", setCanType},
|
{"can_mode", setCanType},
|
||||||
#endif /* EFI_CAN_SUPPORT */
|
#endif /* EFI_CAN_SUPPORT */
|
||||||
#if EFI_IDLE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_IDLE_CONTROL
|
||||||
{"idle_position", setIdleValvePosition},
|
{"idle_position", setIdleValvePosition},
|
||||||
{"idle_rpm", setTargetIdleRpm},
|
{"idle_rpm", setTargetIdleRpm},
|
||||||
{"idle_dt", setIdleDT},
|
{"idle_dt", setIdleDT},
|
||||||
|
@ -1279,7 +1279,7 @@ static void setValue(const char *paramStr, const char *valueStr) {
|
||||||
|
|
||||||
if (strEqualCaseInsensitive(paramStr, "vsscoeff")) {
|
if (strEqualCaseInsensitive(paramStr, "vsscoeff")) {
|
||||||
engineConfiguration->vehicleSpeedCoef = valueF;
|
engineConfiguration->vehicleSpeedCoef = valueF;
|
||||||
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ALTERNATOR_CONTROL
|
||||||
} else if (strEqualCaseInsensitive(paramStr, "alt_t")) {
|
} else if (strEqualCaseInsensitive(paramStr, "alt_t")) {
|
||||||
if (valueI > 10) {
|
if (valueI > 10) {
|
||||||
engineConfiguration->alternatorControl.periodMs = valueI;
|
engineConfiguration->alternatorControl.periodMs = valueI;
|
||||||
|
@ -1308,7 +1308,7 @@ static void setValue(const char *paramStr, const char *valueStr) {
|
||||||
engineConfiguration->tpsMax = valueI;
|
engineConfiguration->tpsMax = valueI;
|
||||||
} else if (strEqualCaseInsensitive(paramStr, "tps_min")) {
|
} else if (strEqualCaseInsensitive(paramStr, "tps_min")) {
|
||||||
engineConfiguration->tpsMin = valueI;
|
engineConfiguration->tpsMin = valueI;
|
||||||
#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__)
|
#if EFI_EMULATE_POSITION_SENSORS
|
||||||
} else if (strEqualCaseInsensitive(paramStr, "rpm")) {
|
} else if (strEqualCaseInsensitive(paramStr, "rpm")) {
|
||||||
setTriggerEmulatorRPM(valueI);
|
setTriggerEmulatorRPM(valueI);
|
||||||
#endif /* EFI_EMULATE_POSITION_SENSORS */
|
#endif /* EFI_EMULATE_POSITION_SENSORS */
|
||||||
|
@ -1330,7 +1330,7 @@ static void setValue(const char *paramStr, const char *valueStr) {
|
||||||
engineConfiguration->ignitionDwellForCrankingMs = valueF;
|
engineConfiguration->ignitionDwellForCrankingMs = valueF;
|
||||||
} else if (strEqualCaseInsensitive(paramStr, "targetvbatt")) {
|
} else if (strEqualCaseInsensitive(paramStr, "targetvbatt")) {
|
||||||
engineConfiguration->targetVBatt = valueF;
|
engineConfiguration->targetVBatt = valueF;
|
||||||
#if EFI_RTC || defined(__DOXYGEN__)
|
#if EFI_RTC
|
||||||
} else if (strEqualCaseInsensitive(paramStr, "date")) {
|
} else if (strEqualCaseInsensitive(paramStr, "date")) {
|
||||||
// rusEfi console invokes this method with timestamp in local timezone
|
// rusEfi console invokes this method with timestamp in local timezone
|
||||||
setDateTime(valueStr);
|
setDateTime(valueStr);
|
||||||
|
@ -1385,7 +1385,7 @@ void initSettings(void) {
|
||||||
addConsoleActionSS("set", setValue);
|
addConsoleActionSS("set", setValue);
|
||||||
addConsoleActionS("get", getValue);
|
addConsoleActionS("get", getValue);
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
addConsoleActionS("showpin", showPinFunction);
|
addConsoleActionS("showpin", showPinFunction);
|
||||||
addConsoleActionSS("set_injection_pin", setInjectionPin);
|
addConsoleActionSS("set_injection_pin", setInjectionPin);
|
||||||
addConsoleActionSS("set_ignition_pin", setIgnitionPin);
|
addConsoleActionSS("set_ignition_pin", setIgnitionPin);
|
||||||
|
@ -1402,7 +1402,7 @@ void initSettings(void) {
|
||||||
addConsoleActionS("set_idle_pin", setIdlePin);
|
addConsoleActionS("set_idle_pin", setIdlePin);
|
||||||
addConsoleActionS("set_main_relay_pin", setMainRelayPin);
|
addConsoleActionS("set_main_relay_pin", setMainRelayPin);
|
||||||
|
|
||||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
#if HAL_USE_ADC
|
||||||
addConsoleActionSS("set_analog_input_pin", setAnalogInputPin);
|
addConsoleActionSS("set_analog_input_pin", setAnalogInputPin);
|
||||||
#endif
|
#endif
|
||||||
addConsoleActionSS("set_logic_input_pin", setLogicInputPin);
|
addConsoleActionSS("set_logic_input_pin", setLogicInputPin);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "efi_gpio.h"
|
#include "efi_gpio.h"
|
||||||
#include "drivers/gpio/gpio_ext.h"
|
#include "drivers/gpio/gpio_ext.h"
|
||||||
|
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
#include "io_pins.h"
|
#include "io_pins.h"
|
||||||
#endif /* EFI_GPIO_HARDWARE */
|
#endif /* EFI_GPIO_HARDWARE */
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER
|
||||||
#include "engine_sniffer.h"
|
#include "engine_sniffer.h"
|
||||||
extern WaveChart waveChart;
|
extern WaveChart waveChart;
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
|
@ -98,7 +98,7 @@ void EnginePins::unregisterPins() {
|
||||||
#if EFI_ELECTRONIC_THROTTLE_BODY
|
#if EFI_ELECTRONIC_THROTTLE_BODY
|
||||||
unregisterEtbPins();
|
unregisterEtbPins();
|
||||||
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
fuelPumpRelay.unregisterOutput(activeConfiguration.bc.fuelPumpPin, engineConfiguration->bc.fuelPumpPin);
|
fuelPumpRelay.unregisterOutput(activeConfiguration.bc.fuelPumpPin, engineConfiguration->bc.fuelPumpPin);
|
||||||
fanRelay.unregisterOutput(activeConfiguration.bc.fanPin, engineConfiguration->bc.fanPin);
|
fanRelay.unregisterOutput(activeConfiguration.bc.fanPin, engineConfiguration->bc.fanPin);
|
||||||
hipCs.unregisterOutput(activeConfiguration.bc.hip9011CsPin, engineConfiguration->bc.hip9011CsPin);
|
hipCs.unregisterOutput(activeConfiguration.bc.hip9011CsPin, engineConfiguration->bc.hip9011CsPin);
|
||||||
|
@ -143,7 +143,7 @@ void EnginePins::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnginePins::stopIgnitionPins(void) {
|
void EnginePins::stopIgnitionPins(void) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
for (int i = 0; i < IGNITION_PIN_COUNT; i++) {
|
for (int i = 0; i < IGNITION_PIN_COUNT; i++) {
|
||||||
NamedOutputPin *output = &enginePins.coils[i];
|
NamedOutputPin *output = &enginePins.coils[i];
|
||||||
output->unregisterOutput(activeConfiguration.bc.ignitionPins[i],
|
output->unregisterOutput(activeConfiguration.bc.ignitionPins[i],
|
||||||
|
@ -153,7 +153,7 @@ void EnginePins::stopIgnitionPins(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnginePins::stopInjectionPins(void) {
|
void EnginePins::stopInjectionPins(void) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
for (int i = 0; i < INJECTION_PIN_COUNT; i++) {
|
for (int i = 0; i < INJECTION_PIN_COUNT; i++) {
|
||||||
NamedOutputPin *output = &enginePins.injectors[i];
|
NamedOutputPin *output = &enginePins.injectors[i];
|
||||||
output->unregisterOutput(activeConfiguration.bc.injectionPins[i],
|
output->unregisterOutput(activeConfiguration.bc.injectionPins[i],
|
||||||
|
@ -163,7 +163,7 @@ void EnginePins::stopInjectionPins(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnginePins::startAuxValves(void) {
|
void EnginePins::startAuxValves(void) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
for (int i = 0; i < AUX_DIGITAL_VALVE_COUNT; i++) {
|
for (int i = 0; i < AUX_DIGITAL_VALVE_COUNT; i++) {
|
||||||
NamedOutputPin *output = &enginePins.auxValve[i];
|
NamedOutputPin *output = &enginePins.auxValve[i];
|
||||||
output->initPin(output->name, engineConfiguration->auxValves[i]);
|
output->initPin(output->name, engineConfiguration->auxValves[i]);
|
||||||
|
@ -172,7 +172,7 @@ void EnginePins::startAuxValves(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnginePins::startIgnitionPins(void) {
|
void EnginePins::startIgnitionPins(void) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||||
NamedOutputPin *output = &enginePins.coils[i];
|
NamedOutputPin *output = &enginePins.coils[i];
|
||||||
// todo: we need to check if mode has changed
|
// todo: we need to check if mode has changed
|
||||||
|
@ -191,7 +191,7 @@ void EnginePins::startIgnitionPins(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnginePins::startInjectionPins(void) {
|
void EnginePins::startInjectionPins(void) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
// todo: should we move this code closer to the injection logic?
|
// todo: should we move this code closer to the injection logic?
|
||||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||||
NamedOutputPin *output = &enginePins.injectors[i];
|
NamedOutputPin *output = &enginePins.injectors[i];
|
||||||
|
@ -214,14 +214,14 @@ NamedOutputPin::NamedOutputPin(const char *name) : OutputPin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NamedOutputPin::setHigh() {
|
void NamedOutputPin::setHigh() {
|
||||||
#if EFI_DEFAILED_LOGGING || defined(__DOXYGEN__)
|
#if EFI_DEFAILED_LOGGING
|
||||||
// signal->hi_time = hTimeNow();
|
// signal->hi_time = hTimeNow();
|
||||||
#endif /* EFI_DEFAILED_LOGGING */
|
#endif /* EFI_DEFAILED_LOGGING */
|
||||||
|
|
||||||
// turn the output level ACTIVE
|
// turn the output level ACTIVE
|
||||||
setValue(true);
|
setValue(true);
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER
|
||||||
|
|
||||||
addEngineSnifferEvent(name, WC_UP);
|
addEngineSnifferEvent(name, WC_UP);
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
|
@ -231,13 +231,13 @@ void NamedOutputPin::setLow() {
|
||||||
// turn off the output
|
// turn off the output
|
||||||
setValue(false);
|
setValue(false);
|
||||||
|
|
||||||
#if EFI_DEFAILED_LOGGING || defined(__DOXYGEN__)
|
#if EFI_DEFAILED_LOGGING
|
||||||
// systime_t after = getTimeNowUs();
|
// systime_t after = getTimeNowUs();
|
||||||
// debugInt(&signal->logging, "a_time", after - signal->hi_time);
|
// debugInt(&signal->logging, "a_time", after - signal->hi_time);
|
||||||
// scheduleLogging(&signal->logging);
|
// scheduleLogging(&signal->logging);
|
||||||
#endif /* EFI_DEFAILED_LOGGING */
|
#endif /* EFI_DEFAILED_LOGGING */
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER
|
||||||
addEngineSnifferEvent(name, WC_DOWN);
|
addEngineSnifferEvent(name, WC_DOWN);
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ InjectorOutputPin::InjectorOutputPin() : NamedOutputPin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NamedOutputPin::stop() {
|
bool NamedOutputPin::stop() {
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE
|
||||||
if (isInitialized() && getLogicValue()) {
|
if (isInitialized() && getLogicValue()) {
|
||||||
setValue(false);
|
setValue(false);
|
||||||
scheduleMsg(&sharedLogger, "turning off %s", name);
|
scheduleMsg(&sharedLogger, "turning off %s", name);
|
||||||
|
@ -277,7 +277,7 @@ void IgnitionOutputPin::reset() {
|
||||||
|
|
||||||
OutputPin::OutputPin() {
|
OutputPin::OutputPin() {
|
||||||
modePtr = &DEFAULT_OUTPUT;
|
modePtr = &DEFAULT_OUTPUT;
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE
|
||||||
port = NULL;
|
port = NULL;
|
||||||
pin = 0;
|
pin = 0;
|
||||||
#endif /* EFI_GPIO_HARDWARE */
|
#endif /* EFI_GPIO_HARDWARE */
|
||||||
|
@ -285,7 +285,7 @@ OutputPin::OutputPin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OutputPin::isInitialized() {
|
bool OutputPin::isInitialized() {
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE
|
||||||
return port != NULL;
|
return port != NULL;
|
||||||
#else /* EFI_GPIO_HARDWARE */
|
#else /* EFI_GPIO_HARDWARE */
|
||||||
return true;
|
return true;
|
||||||
|
@ -337,7 +337,7 @@ void OutputPin::setDefaultPinState(const pin_output_mode_e *outputMode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initOutputPins(void) {
|
void initOutputPins(void) {
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE
|
||||||
/**
|
/**
|
||||||
* want to make sure it's all zeros so that we can compare in initOutputPinExt() method
|
* want to make sure it's all zeros so that we can compare in initOutputPinExt() method
|
||||||
*/
|
*/
|
||||||
|
@ -345,7 +345,7 @@ void initOutputPins(void) {
|
||||||
// todo: fix this?
|
// todo: fix this?
|
||||||
// memset(&outputs, 0, sizeof(outputs));
|
// memset(&outputs, 0, sizeof(outputs));
|
||||||
|
|
||||||
#if HAL_USE_SPI || defined(__DOXYGEN__)
|
#if HAL_USE_SPI
|
||||||
enginePins.sdCsPin.initPin("spi CS5", CONFIGB(sdCardCsPin));
|
enginePins.sdCsPin.initPin("spi CS5", CONFIGB(sdCardCsPin));
|
||||||
#endif /* HAL_USE_SPI */
|
#endif /* HAL_USE_SPI */
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_mode_e *outputMode) {
|
void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_mode_e *outputMode) {
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE
|
||||||
if (brainPin == GPIO_UNASSIGNED)
|
if (brainPin == GPIO_UNASSIGNED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_
|
||||||
#endif /* EFI_GPIO_HARDWARE */
|
#endif /* EFI_GPIO_HARDWARE */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE
|
||||||
|
|
||||||
void initPrimaryPins(void) {
|
void initPrimaryPins(void) {
|
||||||
enginePins.errorLedPin.initPin("led: ERROR status", LED_ERROR_BRAIN_PIN);
|
enginePins.errorLedPin.initPin("led: ERROR status", LED_ERROR_BRAIN_PIN);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
void initPrimaryPins(void);
|
void initPrimaryPins(void);
|
||||||
void initOutputPins(void);
|
void initOutputPins(void);
|
||||||
|
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE
|
||||||
void turnAllPinsOff(void);
|
void turnAllPinsOff(void);
|
||||||
#else /* EFI_GPIO_HARDWARE */
|
#else /* EFI_GPIO_HARDWARE */
|
||||||
#define turnAllPinsOff() {}
|
#define turnAllPinsOff() {}
|
||||||
|
@ -48,7 +48,7 @@ public:
|
||||||
bool getLogicValue();
|
bool getLogicValue();
|
||||||
|
|
||||||
|
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE
|
||||||
ioportid_t port;
|
ioportid_t port;
|
||||||
uint8_t pin;
|
uint8_t pin;
|
||||||
#if (BOARD_EXT_GPIOCHIPS > 0)
|
#if (BOARD_EXT_GPIOCHIPS > 0)
|
||||||
|
@ -167,7 +167,7 @@ public:
|
||||||
#define getElectricalValue(logicalValue, mode) \
|
#define getElectricalValue(logicalValue, mode) \
|
||||||
(logicalValue ? getElectricalValue1(mode) : getElectricalValue0(mode))
|
(logicalValue ? getElectricalValue1(mode) : getElectricalValue0(mode))
|
||||||
|
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE
|
||||||
|
|
||||||
EXTERNC ioportmask_t getHwPin(const char *msg, brain_pin_e brainPin);
|
EXTERNC ioportmask_t getHwPin(const char *msg, brain_pin_e brainPin);
|
||||||
EXTERNC ioportid_t getHwPort(const char *msg, brain_pin_e brainPin);
|
EXTERNC ioportid_t getHwPort(const char *msg, brain_pin_e brainPin);
|
||||||
|
|
|
@ -37,7 +37,7 @@ static void turnOff(NamedOutputPin *output) {
|
||||||
static void auxValveTriggerCallback(trigger_event_e ckpSignalType,
|
static void auxValveTriggerCallback(trigger_event_e ckpSignalType,
|
||||||
uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
UNUSED(ckpSignalType);
|
UNUSED(ckpSignalType);
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
if (index != SCHEDULING_TRIGGER_INDEX) {
|
if (index != SCHEDULING_TRIGGER_INDEX) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ static void auxValveTriggerCallback(trigger_event_e ckpSignalType,
|
||||||
|
|
||||||
void initAuxValves(Logging *sharedLogger) {
|
void initAuxValves(Logging *sharedLogger) {
|
||||||
UNUSED(sharedLogger);
|
UNUSED(sharedLogger);
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
if (engineConfiguration->auxValves[0] == GPIO_UNASSIGNED) {
|
if (engineConfiguration->auxValves[0] == GPIO_UNASSIGNED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include "trigger_vw.h"
|
#include "trigger_vw.h"
|
||||||
#include "trigger_universal.h"
|
#include "trigger_universal.h"
|
||||||
|
|
||||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
#if EFI_SENSOR_CHART
|
||||||
#include "sensor_chart.h"
|
#include "sensor_chart.h"
|
||||||
#endif /* EFI_SENSOR_CHART */
|
#endif /* EFI_SENSOR_CHART */
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ void TriggerShape::initialize(operation_mode_e operationMode, bool needSecondTri
|
||||||
previousAngle = 0;
|
previousAngle = 0;
|
||||||
memset(riseOnlyIndexes, 0, sizeof(riseOnlyIndexes));
|
memset(riseOnlyIndexes, 0, sizeof(riseOnlyIndexes));
|
||||||
memset(isRiseEvent, 0, sizeof(isRiseEvent));
|
memset(isRiseEvent, 0, sizeof(isRiseEvent));
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
memset(&triggerSignals, 0, sizeof(triggerSignals));
|
memset(&triggerSignals, 0, sizeof(triggerSignals));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ operation_mode_e TriggerShape::getOperationMode() {
|
||||||
return operationMode;
|
return operationMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
extern bool printTriggerDebug;
|
extern bool printTriggerDebug;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const channelIndex, t
|
||||||
|
|
||||||
efiAssertVoid(CUSTOM_ERR_6598, channelIndex!= T_SECONDARY || needSecondTriggerInput, "secondary needed or not?");
|
efiAssertVoid(CUSTOM_ERR_6598, channelIndex!= T_SECONDARY || needSecondTriggerInput, "secondary needed or not?");
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
printf("addEvent2 %.2f i=%d r/f=%d\r\n", angle, channelIndex, stateParam);
|
printf("addEvent2 %.2f i=%d r/f=%d\r\n", angle, channelIndex, stateParam);
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const channelIndex, t
|
||||||
state = stateParam;
|
state = stateParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
int signal = channelIndex * 1000 + stateParam;
|
int signal = channelIndex * 1000 + stateParam;
|
||||||
triggerSignals[privateTriggerDefinitionSize] = signal;
|
triggerSignals[privateTriggerDefinitionSize] = signal;
|
||||||
#endif
|
#endif
|
||||||
|
@ -278,7 +278,7 @@ angle_t TriggerShape::getSwitchAngle(int index) const {
|
||||||
|
|
||||||
void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped,
|
void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped,
|
||||||
operation_mode_e operationMode) {
|
operation_mode_e operationMode) {
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
|
|
||||||
s->useRiseEdge = true;
|
s->useRiseEdge = true;
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ void TriggerShape::setTriggerSynchronizationGap3(int gapIndex, float syncRatioFr
|
||||||
this->syncRatioAvg = (int)efiRound((syncRatioFrom + syncRatioTo) * 0.5f, 1.0f);
|
this->syncRatioAvg = (int)efiRound((syncRatioFrom + syncRatioTo) * 0.5f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
printf("setTriggerSynchronizationGap3 %d %.2f %.2f\r\n", gapIndex, syncRatioFrom, syncRatioTo);
|
printf("setTriggerSynchronizationGap3 %d %.2f %.2f\r\n", gapIndex, syncRatioFrom, syncRatioTo);
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ void TriggerShape::findTriggerPosition(event_trigger_position_s *position,
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerShape::prepareShape() {
|
void TriggerShape::prepareShape() {
|
||||||
#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||||
int engineCycleInt = (int) getEngineCycle(operationMode);
|
int engineCycleInt = (int) getEngineCycle(operationMode);
|
||||||
for (int angle = 0; angle < engineCycleInt; angle++) {
|
for (int angle = 0; angle < engineCycleInt; angle++) {
|
||||||
int triggerShapeIndex = findAngleIndex(angle);
|
int triggerShapeIndex = findAngleIndex(angle);
|
||||||
|
@ -403,7 +403,7 @@ void TriggerShape::setSecondTriggerSynchronizationGap(float syncRatio) {
|
||||||
*/
|
*/
|
||||||
void TriggerShape::initializeTriggerShape(Logging *logger, operation_mode_e operationMode, bool useOnlyRisingEdgeForTrigger, const trigger_config_s *triggerConfig) {
|
void TriggerShape::initializeTriggerShape(Logging *logger, operation_mode_e operationMode, bool useOnlyRisingEdgeForTrigger, const trigger_config_s *triggerConfig) {
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
efiAssertVoid(CUSTOM_ERR_6641, getCurrentRemainingStack() > 256, "init t");
|
efiAssertVoid(CUSTOM_ERR_6641, getCurrentRemainingStack() > 256, "init t");
|
||||||
scheduleMsg(logger, "initializeTriggerShape(%s/%d)", getTrigger_type_e(triggerConfig->type), (int) triggerConfig->type);
|
scheduleMsg(logger, "initializeTriggerShape(%s/%d)", getTrigger_type_e(triggerConfig->type), (int) triggerConfig->type);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -175,7 +175,7 @@ public:
|
||||||
*/
|
*/
|
||||||
uint32_t expectedEventCount[PWM_PHASE_MAX_WAVE_PER_PWM];
|
uint32_t expectedEventCount[PWM_PHASE_MAX_WAVE_PER_PWM];
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
/**
|
/**
|
||||||
* These signals are used for trigger export only
|
* These signals are used for trigger export only
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
#include <nvic.h>
|
#include <nvic.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||||
|
|
||||||
#include "main_trigger_callback.h"
|
#include "main_trigger_callback.h"
|
||||||
#include "efi_gpio.h"
|
#include "efi_gpio.h"
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
#include "histogram.h"
|
#include "histogram.h"
|
||||||
#include "engine_controller.h"
|
#include "engine_controller.h"
|
||||||
#include "efi_gpio.h"
|
#include "efi_gpio.h"
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
#include "rfiutil.h"
|
#include "rfiutil.h"
|
||||||
#endif /* EFI_HISTOGRAMS */
|
#endif /* EFI_HISTOGRAMS */
|
||||||
#include "local_version_holder.h"
|
#include "local_version_holder.h"
|
||||||
|
@ -67,7 +67,7 @@ static Logging *logger;
|
||||||
#if ! EFI_UNIT_TEST
|
#if ! EFI_UNIT_TEST
|
||||||
static pid_s *fuelPidS = &persistentState.persistentConfiguration.engineConfiguration.fuelClosedLoopPid;
|
static pid_s *fuelPidS = &persistentState.persistentConfiguration.engineConfiguration.fuelClosedLoopPid;
|
||||||
static Pid fuelPid(fuelPidS);
|
static Pid fuelPid(fuelPidS);
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
#endif
|
#endif
|
||||||
|
@ -92,7 +92,7 @@ static void endSimultaniousInjectionOnlyTogglePins(Engine *engine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void endSimultaniousInjection(InjectionEvent *event) {
|
void endSimultaniousInjection(InjectionEvent *event) {
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
Engine *engine = event->engine;
|
Engine *engine = event->engine;
|
||||||
EXPAND_Engine;
|
EXPAND_Engine;
|
||||||
#endif
|
#endif
|
||||||
|
@ -103,7 +103,7 @@ void endSimultaniousInjection(InjectionEvent *event) {
|
||||||
static inline void tempTurnPinHigh(InjectorOutputPin *output) {
|
static inline void tempTurnPinHigh(InjectorOutputPin *output) {
|
||||||
output->overlappingCounter++;
|
output->overlappingCounter++;
|
||||||
|
|
||||||
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
printf("seTurnPinHigh %s %d %d\r\n", output->name, output->overlappingCounter, (int)getTimeNowUs());
|
printf("seTurnPinHigh %s %d %d\r\n", output->name, output->overlappingCounter, (int)getTimeNowUs());
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
|
@ -112,11 +112,11 @@ static inline void tempTurnPinHigh(InjectorOutputPin *output) {
|
||||||
// * #299
|
// * #299
|
||||||
// * this is another kind of overlap which happens in case of a small duty cycle after a large duty cycle
|
// * this is another kind of overlap which happens in case of a small duty cycle after a large duty cycle
|
||||||
// */
|
// */
|
||||||
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
printf("overlapping, no need to touch pin %s %d\r\n", output->name, (int)getTimeNowUs());
|
printf("overlapping, no need to touch pin %s %d\r\n", output->name, (int)getTimeNowUs());
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
} else {
|
} else {
|
||||||
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
const char * w = output->currentLogicValue == true ? "err" : "";
|
const char * w = output->currentLogicValue == true ? "err" : "";
|
||||||
// scheduleMsg(&sharedLogger, "^ %spin=%s eventIndex %d %d", w, output->name,
|
// scheduleMsg(&sharedLogger, "^ %spin=%s eventIndex %d %d", w, output->name,
|
||||||
// getRevolutionCounter(), getTimeNowUs());
|
// getRevolutionCounter(), getTimeNowUs());
|
||||||
|
@ -137,7 +137,7 @@ void seTurnPinHigh(InjectionSignalPair *pair) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void tempTurnPinLow(InjectorOutputPin *output) {
|
static inline void tempTurnPinLow(InjectorOutputPin *output) {
|
||||||
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
printf("seTurnPinLow %s %d %d\r\n", output->name, output->overlappingCounter, (int)getTimeNowUs());
|
printf("seTurnPinLow %s %d %d\r\n", output->name, output->overlappingCounter, (int)getTimeNowUs());
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
|
@ -152,12 +152,12 @@ static inline void tempTurnPinLow(InjectorOutputPin *output) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
output->cancelNextTurningInjectorOff = false;
|
output->cancelNextTurningInjectorOff = false;
|
||||||
#if EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_SIMULATOR
|
||||||
printf("was cancelled %s %d\r\n", output->name, (int)getTimeNowUs());
|
printf("was cancelled %s %d\r\n", output->name, (int)getTimeNowUs());
|
||||||
#endif /* EFI_SIMULATOR */
|
#endif /* EFI_SIMULATOR */
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
const char * w = output->currentLogicValue == false ? "err" : "";
|
const char * w = output->currentLogicValue == false ? "err" : "";
|
||||||
|
|
||||||
// scheduleMsg(&sharedLogger, "- %spin=%s eventIndex %d %d", w, output->name,
|
// scheduleMsg(&sharedLogger, "- %spin=%s eventIndex %d %d", w, output->name,
|
||||||
|
@ -166,7 +166,7 @@ static inline void tempTurnPinLow(InjectorOutputPin *output) {
|
||||||
|
|
||||||
output->overlappingCounter--;
|
output->overlappingCounter--;
|
||||||
if (output->overlappingCounter > 0) {
|
if (output->overlappingCounter > 0) {
|
||||||
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
printf("was overlapping, no need to touch pin %s %d\r\n", output->name, (int)getTimeNowUs());
|
printf("was overlapping, no need to touch pin %s %d\r\n", output->name, (int)getTimeNowUs());
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
} else {
|
} else {
|
||||||
|
@ -184,7 +184,7 @@ void seTurnPinLow(InjectionSignalPair *pair) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
efiAssertVoid(CUSTOM_ERR_6626, pair->event != NULL, "pair event");
|
efiAssertVoid(CUSTOM_ERR_6626, pair->event != NULL, "pair event");
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
Engine *engine = pair->event->engine;
|
Engine *engine = pair->event->engine;
|
||||||
EXPAND_Engine;
|
EXPAND_Engine;
|
||||||
#endif
|
#endif
|
||||||
|
@ -192,7 +192,7 @@ void seTurnPinLow(InjectionSignalPair *pair) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sescheduleByTimestamp(scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, InjectionSignalPair *pair DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
static void sescheduleByTimestamp(scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, InjectionSignalPair *pair DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
InjectorOutputPin *param = pair->outputs[0];
|
InjectorOutputPin *param = pair->outputs[0];
|
||||||
// scheduleMsg(&sharedLogger, "schX %s %x %d", prefix, scheduling, time);
|
// scheduleMsg(&sharedLogger, "schX %s %x %d", prefix, scheduling, time);
|
||||||
// scheduleMsg(&sharedLogger, "schX %s", param->name);
|
// scheduleMsg(&sharedLogger, "schX %s", param->name);
|
||||||
|
@ -213,7 +213,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
|
||||||
* x2 or /2?
|
* x2 or /2?
|
||||||
*/
|
*/
|
||||||
const floatms_t injectionDuration = ENGINE(wallFuel).adjust(event->outputs[0]->injectorIndex, ENGINE(injectionDuration) PASS_ENGINE_PARAMETER_SUFFIX);
|
const floatms_t injectionDuration = ENGINE(wallFuel).adjust(event->outputs[0]->injectorIndex, ENGINE(injectionDuration) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__)
|
#if EFI_PRINTF_FUEL_DETAILS
|
||||||
printf("fuel injectionDuration=%.2f adjusted=%.2f\t\n", ENGINE(injectionDuration), injectionDuration);
|
printf("fuel injectionDuration=%.2f adjusted=%.2f\t\n", ENGINE(injectionDuration), injectionDuration);
|
||||||
#endif /*EFI_PRINTF_FUEL_DETAILS */
|
#endif /*EFI_PRINTF_FUEL_DETAILS */
|
||||||
|
|
||||||
|
@ -253,14 +253,14 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
|
||||||
floatus_t durationUs = MS2US(injectionDuration);
|
floatus_t durationUs = MS2US(injectionDuration);
|
||||||
|
|
||||||
|
|
||||||
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
// scheduleMsg(logger, "handleFuel totalPerCycle=%.2f", totalPerCycle);
|
// scheduleMsg(logger, "handleFuel totalPerCycle=%.2f", totalPerCycle);
|
||||||
// scheduleMsg(logger, "handleFuel engineCycleDuration=%.2f", engineCycleDuration);
|
// scheduleMsg(logger, "handleFuel engineCycleDuration=%.2f", engineCycleDuration);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
floatus_t injectionStartDelayUs = ENGINE(rpmCalculator.oneDegreeUs) * event->injectionStart.angleOffset;
|
floatus_t injectionStartDelayUs = ENGINE(rpmCalculator.oneDegreeUs) * event->injectionStart.angleOffset;
|
||||||
|
|
||||||
#if EFI_DEFAILED_LOGGING || defined(__DOXYGEN__)
|
#if EFI_DEFAILED_LOGGING
|
||||||
scheduleMsg(logger, "handleFuel pin=%s eventIndex %d duration=%.2fms %d", event->outputs[0]->name,
|
scheduleMsg(logger, "handleFuel pin=%s eventIndex %d duration=%.2fms %d", event->outputs[0]->name,
|
||||||
injEventIndex,
|
injEventIndex,
|
||||||
injectionDuration,
|
injectionDuration,
|
||||||
|
@ -287,7 +287,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
|
||||||
(schfunc_t) &endSimultaniousInjection, event);
|
(schfunc_t) &endSimultaniousInjection, event);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
printf("scheduling injection angle=%.2f/delay=%.2f injectionDuration=%.2f\r\n", event->injectionStart.angleOffset, injectionStartDelayUs, injectionDuration);
|
printf("scheduling injection angle=%.2f/delay=%.2f injectionDuration=%.2f\r\n", event->injectionStart.angleOffset, injectionStartDelayUs, injectionDuration);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -306,14 +306,14 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
|
||||||
efitimeus_t nowUs = getTimeNowUs();
|
efitimeus_t nowUs = getTimeNowUs();
|
||||||
|
|
||||||
InjectorOutputPin *output = event->outputs[0];
|
InjectorOutputPin *output = event->outputs[0];
|
||||||
#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__)
|
#if EFI_PRINTF_FUEL_DETAILS
|
||||||
printf("fuelout %s duration %d total=%d\t\n", output->name, (int)durationUs,
|
printf("fuelout %s duration %d total=%d\t\n", output->name, (int)durationUs,
|
||||||
(int)MS2US(getCrankshaftRevolutionTimeMs(GET_RPM_VALUE)));
|
(int)MS2US(getCrankshaftRevolutionTimeMs(GET_RPM_VALUE)));
|
||||||
#endif /*EFI_PRINTF_FUEL_DETAILS */
|
#endif /*EFI_PRINTF_FUEL_DETAILS */
|
||||||
|
|
||||||
|
|
||||||
if (pair->isScheduled) {
|
if (pair->isScheduled) {
|
||||||
#if EFI_UNIT_TEST || EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST || EFI_SIMULATOR
|
||||||
printf("still used1 %s %d\r\n", output->name, (int)getTimeNowUs());
|
printf("still used1 %s %d\r\n", output->name, (int)getTimeNowUs());
|
||||||
#endif /* EFI_UNIT_TEST || EFI_SIMULATOR */
|
#endif /* EFI_UNIT_TEST || EFI_SIMULATOR */
|
||||||
return; // this InjectionSignalPair is still needed for an extremely long injection scheduled previously
|
return; // this InjectionSignalPair is still needed for an extremely long injection scheduled previously
|
||||||
|
@ -330,7 +330,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
|
||||||
|
|
||||||
if (isSecondaryOverlapping) {
|
if (isSecondaryOverlapping) {
|
||||||
output->cancelNextTurningInjectorOff = true;
|
output->cancelNextTurningInjectorOff = true;
|
||||||
#if EFI_UNIT_TEST || EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST || EFI_SIMULATOR
|
||||||
printf("please cancel %s %d %d\r\n", output->name, (int)getTimeNowUs(), output->overlappingCounter);
|
printf("please cancel %s %d %d\r\n", output->name, (int)getTimeNowUs(), output->overlappingCounter);
|
||||||
#endif /* EFI_UNIT_TEST || EFI_SIMULATOR */
|
#endif /* EFI_UNIT_TEST || EFI_SIMULATOR */
|
||||||
} else {
|
} else {
|
||||||
|
@ -355,7 +355,7 @@ static void fuelClosedLoopCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
|
|
||||||
engine->engineState.fuelPidCorrection = fuelPid.getOutput(ENGINE(engineState.targetAFR), ENGINE(sensors.currentAfr), 1);
|
engine->engineState.fuelPidCorrection = fuelPid.getOutput(ENGINE(engineState.targetAFR), ENGINE(sensors.currentAfr), 1);
|
||||||
if (engineConfiguration->debugMode == DBG_FUEL_PID_CORRECTION) {
|
if (engineConfiguration->debugMode == DBG_FUEL_PID_CORRECTION) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels.debugFloatField1 = engine->engineState.fuelPidCorrection;
|
tsOutputChannels.debugFloatField1 = engine->engineState.fuelPidCorrection;
|
||||||
fuelPid.postState(&tsOutputChannels);
|
fuelPid.postState(&tsOutputChannels);
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
@ -386,7 +386,7 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn
|
||||||
fs->addFuelEvents(PASS_ENGINE_PARAMETER_SIGNATURE);
|
fs->addFuelEvents(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "handleFuel ind=%d %d", trgEventIndex, getRevolutionCounter());
|
scheduleMsg(logger, "handleFuel ind=%d %d", trgEventIndex, getRevolutionCounter());
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
|
@ -414,17 +414,17 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
#if EFI_HISTOGRAMS
|
||||||
static histogram_s mainLoopHistogram;
|
static histogram_s mainLoopHistogram;
|
||||||
#endif /* EFI_HISTOGRAMS */
|
#endif /* EFI_HISTOGRAMS */
|
||||||
|
|
||||||
void showMainHistogram(void) {
|
void showMainHistogram(void) {
|
||||||
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
#if EFI_HISTOGRAMS
|
||||||
printHistogram(logger, &mainLoopHistogram);
|
printHistogram(logger, &mainLoopHistogram);
|
||||||
#endif /* EFI_HISTOGRAMS */
|
#endif /* EFI_HISTOGRAMS */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
/**
|
/**
|
||||||
* this field is used as an Expression in IAR debugger
|
* this field is used as an Expression in IAR debugger
|
||||||
*/
|
*/
|
||||||
|
@ -483,7 +483,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D
|
||||||
warning(CUSTOM_SKIPPING_STROKE, "skipping stroke due to rpm=%d", rpm);
|
warning(CUSTOM_SKIPPING_STROKE, "skipping stroke due to rpm=%d", rpm);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (EFI_HISTOGRAMS && EFI_PROD_CODE) || defined(__DOXYGEN__)
|
#if EFI_HISTOGRAMS && EFI_PROD_CODE
|
||||||
int beforeCallback = hal_lld_get_counter_value();
|
int beforeCallback = hal_lld_get_counter_value();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -523,7 +523,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D
|
||||||
* For spark we schedule both start of coil charge and actual spark based on trigger angle
|
* For spark we schedule both start of coil charge and actual spark based on trigger angle
|
||||||
*/
|
*/
|
||||||
handleSpark(limitedSpark, trgEventIndex, rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
handleSpark(limitedSpark, trgEventIndex, rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
#if EFI_HISTOGRAMS
|
||||||
int diff = hal_lld_get_counter_value() - beforeCallback;
|
int diff = hal_lld_get_counter_value() - beforeCallback;
|
||||||
if (diff > 0)
|
if (diff > 0)
|
||||||
hsAdd(&mainLoopHistogram, diff);
|
hsAdd(&mainLoopHistogram, diff);
|
||||||
|
@ -548,7 +548,7 @@ static bool isPrimeInjectionPulseSkipped(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
// First, we need a protection against 'fake' ignition switch on and off (i.e. no engine started), to avoid repeated prime pulses.
|
// First, we need a protection against 'fake' ignition switch on and off (i.e. no engine started), to avoid repeated prime pulses.
|
||||||
// So we check and update the ignition switch counter in non-volatile backup-RAM
|
// So we check and update the ignition switch counter in non-volatile backup-RAM
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
uint32_t ignSwitchCounter = backupRamLoad(BACKUP_IGNITION_SWITCH_COUNTER);
|
uint32_t ignSwitchCounter = backupRamLoad(BACKUP_IGNITION_SWITCH_COUNTER);
|
||||||
#else /* EFI_PROD_CODE */
|
#else /* EFI_PROD_CODE */
|
||||||
uint32_t ignSwitchCounter = 0;
|
uint32_t ignSwitchCounter = 0;
|
||||||
|
@ -564,7 +564,7 @@ void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
// start prime injection if this is a 'fresh start'
|
// start prime injection if this is a 'fresh start'
|
||||||
if (ignSwitchCounter == 0) {
|
if (ignSwitchCounter == 0) {
|
||||||
// fill-in the prime event struct
|
// fill-in the prime event struct
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
primeInjEvent.engine = engine;
|
primeInjEvent.engine = engine;
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
primeInjEvent.ownIndex = 0;
|
primeInjEvent.ownIndex = 0;
|
||||||
|
@ -582,14 +582,14 @@ void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engine->executor.scheduleForLater(sDown, turnOffDelayUs, (schfunc_t) &endSimultaniousInjectionOnlyTogglePins, engine);
|
engine->executor.scheduleForLater(sDown, turnOffDelayUs, (schfunc_t) &endSimultaniousInjectionOnlyTogglePins, engine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
// we'll reset it later when the engine starts
|
// we'll reset it later when the engine starts
|
||||||
backupRamSave(BACKUP_IGNITION_SWITCH_COUNTER, ignSwitchCounter + 1);
|
backupRamSave(BACKUP_IGNITION_SWITCH_COUNTER, ignSwitchCounter + 1);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
}
|
}
|
||||||
|
|
||||||
void updatePrimeInjectionPulseState(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void updatePrimeInjectionPulseState(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
static bool counterWasReset = false;
|
static bool counterWasReset = false;
|
||||||
if (counterWasReset)
|
if (counterWasReset)
|
||||||
return;
|
return;
|
||||||
|
@ -601,20 +601,20 @@ void updatePrimeInjectionPulseState(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER
|
||||||
#include "engine_sniffer.h"
|
#include "engine_sniffer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void showTriggerHistogram(void) {
|
static void showTriggerHistogram(void) {
|
||||||
printAllCallbacksHistogram();
|
printAllCallbacksHistogram();
|
||||||
showMainHistogram();
|
showMainHistogram();
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER
|
||||||
showWaveChartHistogram();
|
showWaveChartHistogram();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showMainInfo(Engine *engine) {
|
static void showMainInfo(Engine *engine) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
int rpm = GET_RPM();
|
int rpm = GET_RPM();
|
||||||
float el = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE);
|
float el = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
scheduleMsg(logger, "rpm %d engine_load %.2f", rpm, el);
|
scheduleMsg(logger, "rpm %d engine_load %.2f", rpm, el);
|
||||||
|
@ -629,7 +629,7 @@ void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX
|
||||||
|
|
||||||
initAuxValves(logger);
|
initAuxValves(logger);
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
addConsoleAction("performanceinfo", showTriggerHistogram);
|
addConsoleAction("performanceinfo", showTriggerHistogram);
|
||||||
addConsoleActionP("maininfo", (VoidPtr) showMainInfo, engine);
|
addConsoleActionP("maininfo", (VoidPtr) showMainInfo, engine);
|
||||||
|
|
||||||
|
@ -638,7 +638,7 @@ void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX
|
||||||
printMsg(logger, "!!!!!!!!!!!!!!!!!!! injection disabled");
|
printMsg(logger, "!!!!!!!!!!!!!!!!!!! injection disabled");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
#if EFI_HISTOGRAMS
|
||||||
initHistogram(&mainLoopHistogram, "main callback");
|
initHistogram(&mainLoopHistogram, "main callback");
|
||||||
#endif /* EFI_HISTOGRAMS */
|
#endif /* EFI_HISTOGRAMS */
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
#if EFI_SENSOR_CHART
|
||||||
#include "sensor_chart.h"
|
#include "sensor_chart.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ int RpmCalculator::getRpm(DECLARE_ENGINE_PARAMETER_SIGNATURE) const {
|
||||||
return rpmValue;
|
return rpmValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
|
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
|
@ -159,7 +159,7 @@ void RpmCalculator::setRpmValue(int value DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
*/
|
*/
|
||||||
state = CRANKING;
|
state = CRANKING;
|
||||||
}
|
}
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
// This presumably fixes injection mode change for cranking-to-running transition.
|
// This presumably fixes injection mode change for cranking-to-running transition.
|
||||||
// 'isSimultanious' flag should be updated for events if injection modes differ for cranking and running.
|
// 'isSimultanious' flag should be updated for events if injection modes differ for cranking and running.
|
||||||
if (state != oldState) {
|
if (state != oldState) {
|
||||||
|
@ -261,7 +261,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
#if EFI_SENSOR_CHART
|
||||||
// this 'index==0' case is here so that it happens after cycle callback so
|
// this 'index==0' case is here so that it happens after cycle callback so
|
||||||
// it goes into sniffer report into the first position
|
// it goes into sniffer report into the first position
|
||||||
if (ENGINE(sensorChartMode) == SC_TRIGGER) {
|
if (ENGINE(sensorChartMode) == SC_TRIGGER) {
|
||||||
|
@ -291,7 +291,7 @@ static scheduling_s tdcScheduler[2];
|
||||||
|
|
||||||
static char rpmBuffer[_MAX_FILLER];
|
static char rpmBuffer[_MAX_FILLER];
|
||||||
|
|
||||||
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
/**
|
/**
|
||||||
* This callback has nothing to do with actual engine control, it just sends a Top Dead Center mark to the dev console
|
* This callback has nothing to do with actual engine control, it just sends a Top Dead Center mark to the dev console
|
||||||
* digital sniffer.
|
* digital sniffer.
|
||||||
|
@ -347,7 +347,7 @@ void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
if (hasFirmwareError()) {
|
if (hasFirmwareError()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
|
|
||||||
addTriggerEventListener(tdcMarkCallback, "chart TDC mark", engine);
|
addTriggerEventListener(tdcMarkCallback, "chart TDC mark", engine);
|
||||||
#endif
|
#endif
|
||||||
|
@ -355,7 +355,7 @@ void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
addTriggerEventListener(rpmShaftPositionCallback, "rpm reporter", engine);
|
addTriggerEventListener(rpmShaftPositionCallback, "rpm reporter", engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
/**
|
/**
|
||||||
* Schedules a callback 'angle' degree of crankshaft from now.
|
* Schedules a callback 'angle' degree of crankshaft from now.
|
||||||
* The callback would be executed once after the duration of time which
|
* The callback would be executed once after the duration of time which
|
||||||
|
|
|
@ -31,7 +31,7 @@ int isIgnitionTimingError(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void turnSparkPinLow2(IgnitionEvent *event, IgnitionOutputPin *output) {
|
static void turnSparkPinLow2(IgnitionEvent *event, IgnitionOutputPin *output) {
|
||||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if SPARK_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "spark goes low %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
|
scheduleMsg(logger, "spark goes low %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
|
||||||
output->currentLogicValue, output->outOfOrder, event->sparkId);
|
output->currentLogicValue, output->outOfOrder, event->sparkId);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
@ -51,7 +51,7 @@ static void turnSparkPinLow2(IgnitionEvent *event, IgnitionOutputPin *output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
output->setLow();
|
output->setLow();
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
if (CONFIG(dizzySparkOutputPin) != GPIO_UNASSIGNED) {
|
if (CONFIG(dizzySparkOutputPin) != GPIO_UNASSIGNED) {
|
||||||
enginePins.dizzyOutput.setLow();
|
enginePins.dizzyOutput.setLow();
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngle, IgnitionEvent *e
|
||||||
assertAngleRange(a, "findAngle#a6", CUSTOM_ERR_6550);
|
assertAngleRange(a, "findAngle#a6", CUSTOM_ERR_6550);
|
||||||
TRIGGER_SHAPE(findTriggerPosition(&event->dwellPosition, a PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
|
TRIGGER_SHAPE(findTriggerPosition(&event->dwellPosition, a PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
|
||||||
|
|
||||||
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.eventIndex);
|
printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.eventIndex);
|
||||||
// scheduleMsg(logger, "addIgnitionEvent %s ind=%d", output->name, event->dwellPosition->eventIndex);
|
// scheduleMsg(logger, "addIgnitionEvent %s ind=%d", output->name, event->dwellPosition->eventIndex);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
@ -114,7 +114,7 @@ void turnSparkPinLow(IgnitionEvent *event) {
|
||||||
turnSparkPinLow2(event, output);
|
turnSparkPinLow2(event, output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
Engine *engine = event->engine;
|
Engine *engine = event->engine;
|
||||||
EXPAND_Engine;
|
EXPAND_Engine;
|
||||||
#endif
|
#endif
|
||||||
|
@ -130,7 +130,7 @@ void turnSparkPinLow(IgnitionEvent *event) {
|
||||||
|
|
||||||
static void turnSparkPinHigh2(IgnitionEvent *event, IgnitionOutputPin *output) {
|
static void turnSparkPinHigh2(IgnitionEvent *event, IgnitionOutputPin *output) {
|
||||||
|
|
||||||
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if ! EFI_UNIT_TEST
|
||||||
if (GET_RPM_VALUE > 2 * engineConfiguration->cranking.rpm) {
|
if (GET_RPM_VALUE > 2 * engineConfiguration->cranking.rpm) {
|
||||||
const char *outputName = output->name;
|
const char *outputName = output->name;
|
||||||
if (prevSparkName == outputName && getCurrentIgnitionMode(PASS_ENGINE_PARAMETER_SIGNATURE) != IM_ONE_COIL) {
|
if (prevSparkName == outputName && getCurrentIgnitionMode(PASS_ENGINE_PARAMETER_SIGNATURE) != IM_ONE_COIL) {
|
||||||
|
@ -141,7 +141,7 @@ static void turnSparkPinHigh2(IgnitionEvent *event, IgnitionOutputPin *output) {
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
|
|
||||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if SPARK_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "spark goes high %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
|
scheduleMsg(logger, "spark goes high %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(),
|
||||||
output->currentLogicValue, output->outOfOrder, event->sparkId);
|
output->currentLogicValue, output->outOfOrder, event->sparkId);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
@ -155,7 +155,7 @@ static void turnSparkPinHigh2(IgnitionEvent *event, IgnitionOutputPin *output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
output->setHigh();
|
output->setHigh();
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
if (CONFIG(dizzySparkOutputPin) != GPIO_UNASSIGNED) {
|
if (CONFIG(dizzySparkOutputPin) != GPIO_UNASSIGNED) {
|
||||||
enginePins.dizzyOutput.setHigh();
|
enginePins.dizzyOutput.setHigh();
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
||||||
int isIgnitionError = chargeDelayUs < 0;
|
int isIgnitionError = chargeDelayUs < 0;
|
||||||
ignitionErrorDetection.add(isIgnitionError);
|
ignitionErrorDetection.add(isIgnitionError);
|
||||||
if (isIgnitionError) {
|
if (isIgnitionError) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
scheduleMsg(logger, "Negative spark delay=%.2f", chargeDelayUs);
|
scheduleMsg(logger, "Negative spark delay=%.2f", chargeDelayUs);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
chargeDelayUs = 0;
|
chargeDelayUs = 0;
|
||||||
|
@ -212,7 +212,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
||||||
* The start of charge is always within the current trigger event range, so just plain time-based scheduling
|
* The start of charge is always within the current trigger event range, so just plain time-based scheduling
|
||||||
*/
|
*/
|
||||||
if (!limitedSpark) {
|
if (!limitedSpark) {
|
||||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if SPARK_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "scheduling sparkUp ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)chargeDelayUs,
|
scheduleMsg(logger, "scheduling sparkUp ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)chargeDelayUs,
|
||||||
iEvent->sparkId);
|
iEvent->sparkId);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
@ -234,7 +234,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
||||||
assertAngleRange(advance, "findAngle#a5", CUSTOM_ERR_6549);
|
assertAngleRange(advance, "findAngle#a5", CUSTOM_ERR_6549);
|
||||||
TRIGGER_SHAPE(findTriggerPosition(&iEvent->sparkPosition, advance PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
|
TRIGGER_SHAPE(findTriggerPosition(&iEvent->sparkPosition, advance PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
printf("spark dwell@ %d/%d spark@ %d/%d id=%d\r\n", iEvent->dwellPosition.eventIndex, (int)iEvent->dwellPosition.angleOffset,
|
printf("spark dwell@ %d/%d spark@ %d/%d id=%d\r\n", iEvent->dwellPosition.eventIndex, (int)iEvent->dwellPosition.angleOffset,
|
||||||
iEvent->sparkPosition.eventIndex, (int)iEvent->sparkPosition.angleOffset,
|
iEvent->sparkPosition.eventIndex, (int)iEvent->sparkPosition.angleOffset,
|
||||||
iEvent->sparkId);
|
iEvent->sparkId);
|
||||||
|
@ -259,13 +259,13 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
||||||
*/
|
*/
|
||||||
float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * iEvent->sparkPosition.angleOffset;
|
float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * iEvent->sparkPosition.angleOffset;
|
||||||
|
|
||||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if SPARK_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)timeTillIgnitionUs, iEvent->sparkId);
|
scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)timeTillIgnitionUs, iEvent->sparkId);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
engine->executor.scheduleForLater(sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent);
|
engine->executor.scheduleForLater(sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent);
|
||||||
} else {
|
} else {
|
||||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if SPARK_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "to queue sparkDown ind=%d %d %s %d for %d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), iEvent->sparkPosition.eventIndex);
|
scheduleMsg(logger, "to queue sparkDown ind=%d %d %s %d for %d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), iEvent->sparkPosition.eventIndex);
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
/**
|
/**
|
||||||
|
@ -273,7 +273,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
||||||
*/
|
*/
|
||||||
bool isPending = assertNotInList<IgnitionEvent>(ENGINE(iHead), iEvent);
|
bool isPending = assertNotInList<IgnitionEvent>(ENGINE(iHead), iEvent);
|
||||||
if (isPending) {
|
if (isPending) {
|
||||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if SPARK_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "not adding to queue sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs());
|
scheduleMsg(logger, "not adding to queue sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs());
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
return;
|
return;
|
||||||
|
@ -295,7 +295,7 @@ static void initializeIgnitionActions(IgnitionEventList *list DECLARE_ENGINE_PAR
|
||||||
|
|
||||||
for (int cylinderIndex = 0; cylinderIndex < CONFIG(specs.cylindersCount); cylinderIndex++) {
|
for (int cylinderIndex = 0; cylinderIndex < CONFIG(specs.cylindersCount); cylinderIndex++) {
|
||||||
list->elements[cylinderIndex].cylinderIndex = cylinderIndex;
|
list->elements[cylinderIndex].cylinderIndex = cylinderIndex;
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
list->elements[cylinderIndex].engine = engine;
|
list->elements[cylinderIndex].engine = engine;
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
prepareCylinderIgnitionSchedule(dwellAngle, &list->elements[cylinderIndex] PASS_ENGINE_PARAMETER_SUFFIX);
|
prepareCylinderIgnitionSchedule(dwellAngle, &list->elements[cylinderIndex] PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
@ -361,7 +361,7 @@ void handleSpark(bool limitedSpark, uint32_t trgEventIndex, int rpm
|
||||||
|
|
||||||
scheduling_s * sDown = ¤t->signalTimerDown;
|
scheduling_s * sDown = ¤t->signalTimerDown;
|
||||||
|
|
||||||
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if SPARK_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "time to sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), current->getOutputForLoggins()->name, (int)getTimeNowUs());
|
scheduleMsg(logger, "time to sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), current->getOutputForLoggins()->name, (int)getTimeNowUs());
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
|
|
|
@ -43,27 +43,27 @@ int TriggerCentral::getHwEventCounter(int index) {
|
||||||
return hwEventCounters[index];
|
return hwEventCounters[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
#include "rfiutil.h"
|
#include "rfiutil.h"
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
#include "tunerstudio.h"
|
#include "tunerstudio.h"
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER
|
||||||
#include "engine_sniffer.h"
|
#include "engine_sniffer.h"
|
||||||
WaveChart waveChart;
|
WaveChart waveChart;
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
#if EFI_HISTOGRAMS
|
||||||
static histogram_s triggerCallbackHistogram;
|
static histogram_s triggerCallbackHistogram;
|
||||||
#endif /* EFI_HISTOGRAMS */
|
#endif /* EFI_HISTOGRAMS */
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ void addTriggerEventListener(ShaftPositionListener listener, const char *name, E
|
||||||
engine->triggerCentral.addEventListener(listener, name, engine);
|
engine->triggerCentral.addEventListener(listener, name, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
|
|
||||||
int triggerReentraint = 0;
|
int triggerReentraint = 0;
|
||||||
int maxTriggerReentraint = 0;
|
int maxTriggerReentraint = 0;
|
||||||
|
@ -130,7 +130,7 @@ void hwHandleVvtCamSignal(trigger_value_e front) {
|
||||||
scheduleMsg(logger, "looks good: vvt ratio %.2f", ratio);
|
scheduleMsg(logger, "looks good: vvt ratio %.2f", ratio);
|
||||||
}
|
}
|
||||||
if (engineConfiguration->debugMode == DBG_VVT) {
|
if (engineConfiguration->debugMode == DBG_VVT) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels.debugIntField1++;
|
tsOutputChannels.debugIntField1++;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ void hwHandleVvtCamSignal(trigger_value_e front) {
|
||||||
*/
|
*/
|
||||||
tc->triggerState.incrementTotalEventCounter();
|
tc->triggerState.incrementTotalEventCounter();
|
||||||
if (engineConfiguration->debugMode == DBG_VVT) {
|
if (engineConfiguration->debugMode == DBG_VVT) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels.debugIntField1++;
|
tsOutputChannels.debugIntField1++;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ void hwHandleVvtCamSignal(trigger_value_e front) {
|
||||||
// see above comment
|
// see above comment
|
||||||
tc->triggerState.incrementTotalEventCounter();
|
tc->triggerState.incrementTotalEventCounter();
|
||||||
if (engineConfiguration->debugMode == DBG_VVT) {
|
if (engineConfiguration->debugMode == DBG_VVT) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels.debugIntField1++;
|
tsOutputChannels.debugIntField1++;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
|
||||||
}
|
}
|
||||||
|
|
||||||
if (triggerState.isValidIndex(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
if (triggerState.isValidIndex(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
||||||
#if TRIGGER_EXTREME_LOGGING || defined(__DOXYGEN__)
|
#if TRIGGER_EXTREME_LOGGING
|
||||||
scheduleMsg(logger, "trigger %d %d %d", triggerIndexForListeners, getRevolutionCounter(), (int)getTimeNowUs());
|
scheduleMsg(logger, "trigger %d %d %d", triggerIndexForListeners, getRevolutionCounter(), (int)getTimeNowUs());
|
||||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
#if EFI_HISTOGRAMS
|
||||||
int afterCallback = hal_lld_get_counter_value();
|
int afterCallback = hal_lld_get_counter_value();
|
||||||
int diff = afterCallback - beforeCallback;
|
int diff = afterCallback - beforeCallback;
|
||||||
// this counter is only 32 bits so it overflows every minute, let's ignore the value in case of the overflow for simplicity
|
// this counter is only 32 bits so it overflows every minute, let's ignore the value in case of the overflow for simplicity
|
||||||
|
@ -393,7 +393,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
|
||||||
}
|
}
|
||||||
|
|
||||||
void printAllCallbacksHistogram(void) {
|
void printAllCallbacksHistogram(void) {
|
||||||
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
#if EFI_HISTOGRAMS
|
||||||
printHistogram(logger, &triggerCallbackHistogram);
|
printHistogram(logger, &triggerCallbackHistogram);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
|
|
||||||
static void triggerShapeInfo(void) {
|
static void triggerShapeInfo(void) {
|
||||||
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
TriggerShape *s = &engine->triggerCentral.triggerShape;
|
TriggerShape *s = &engine->triggerCentral.triggerShape;
|
||||||
scheduleMsg(logger, "useRise=%s", boolToString(TRIGGER_SHAPE(useRiseEdge)));
|
scheduleMsg(logger, "useRise=%s", boolToString(TRIGGER_SHAPE(useRiseEdge)));
|
||||||
scheduleMsg(logger, "gap from %.2f to %.2f", TRIGGER_SHAPE(syncronizationRatioFrom[0]), TRIGGER_SHAPE(syncronizationRatioTo[0]));
|
scheduleMsg(logger, "gap from %.2f to %.2f", TRIGGER_SHAPE(syncronizationRatioFrom[0]), TRIGGER_SHAPE(syncronizationRatioTo[0]));
|
||||||
|
@ -413,7 +413,7 @@ static void triggerShapeInfo(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define TRIGGERS_FILE_NAME "triggers.txt"
|
#define TRIGGERS_FILE_NAME "triggers.txt"
|
||||||
|
@ -475,7 +475,7 @@ void printAllTriggers() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
extern PwmConfig triggerSignal;
|
extern PwmConfig triggerSignal;
|
||||||
#endif /* #if EFI_PROD_CODE */
|
#endif /* #if EFI_PROD_CODE */
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ extern uint32_t maxEventCallbackDuration;
|
||||||
extern int perSecondIrqDuration;
|
extern int perSecondIrqDuration;
|
||||||
extern int perSecondIrqCounter;
|
extern int perSecondIrqCounter;
|
||||||
|
|
||||||
#if (EFI_PROD_CODE) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
extern uint32_t maxPrecisionCallbackDuration;
|
extern uint32_t maxPrecisionCallbackDuration;
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
|
@ -499,23 +499,23 @@ extern int vvtEventRiseCounter;
|
||||||
extern int vvtEventFallCounter;
|
extern int vvtEventFallCounter;
|
||||||
|
|
||||||
void resetMaxValues() {
|
void resetMaxValues() {
|
||||||
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
maxEventCallbackDuration = triggerMaxDuration = 0;
|
maxEventCallbackDuration = triggerMaxDuration = 0;
|
||||||
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
||||||
|
|
||||||
maxSchedulingPrecisionLoss = 0;
|
maxSchedulingPrecisionLoss = 0;
|
||||||
|
|
||||||
#if EFI_CLOCK_LOCKS || defined(__DOXYGEN__)
|
#if EFI_CLOCK_LOCKS
|
||||||
maxLockedDuration = 0;
|
maxLockedDuration = 0;
|
||||||
#endif /* EFI_CLOCK_LOCKS */
|
#endif /* EFI_CLOCK_LOCKS */
|
||||||
|
|
||||||
#if (EFI_PROD_CODE) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
maxPrecisionCallbackDuration = 0;
|
maxPrecisionCallbackDuration = 0;
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggerInfo(void) {
|
void triggerInfo(void) {
|
||||||
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
|
|
||||||
TriggerShape *ts = &engine->triggerCentral.triggerShape;
|
TriggerShape *ts = &engine->triggerCentral.triggerShape;
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ void triggerInfo(void) {
|
||||||
|
|
||||||
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
if (engineConfiguration->camInput != GPIO_UNASSIGNED) {
|
if (engineConfiguration->camInput != GPIO_UNASSIGNED) {
|
||||||
scheduleMsg(logger, "VVT input: %s mode %s", hwPortname(engineConfiguration->camInput),
|
scheduleMsg(logger, "VVT input: %s mode %s", hwPortname(engineConfiguration->camInput),
|
||||||
getVvt_mode_e(engineConfiguration->vvtMode));
|
getVvt_mode_e(engineConfiguration->vvtMode));
|
||||||
|
@ -572,7 +572,7 @@ void triggerInfo(void) {
|
||||||
|
|
||||||
if (ts->needSecondTriggerInput) {
|
if (ts->needSecondTriggerInput) {
|
||||||
scheduleMsg(logger, "secondary trigger input: %s", hwPortname(CONFIGB(triggerInputPins)[1]));
|
scheduleMsg(logger, "secondary trigger input: %s", hwPortname(CONFIGB(triggerInputPins)[1]));
|
||||||
#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__)
|
#if EFI_EMULATE_POSITION_SENSORS
|
||||||
scheduleMsg(logger, "secondary trigger simulator: %s %s phase=%d",
|
scheduleMsg(logger, "secondary trigger simulator: %s %s phase=%d",
|
||||||
hwPortname(CONFIGB(triggerSimulatorPins)[1]),
|
hwPortname(CONFIGB(triggerSimulatorPins)[1]),
|
||||||
getPin_output_mode_e(CONFIGB(triggerSimulatorPinModes)[1]), triggerSignal.safe.phaseIndex);
|
getPin_output_mode_e(CONFIGB(triggerSimulatorPinModes)[1]), triggerSignal.safe.phaseIndex);
|
||||||
|
@ -603,7 +603,7 @@ void triggerInfo(void) {
|
||||||
engine->m.rpmCbTime,
|
engine->m.rpmCbTime,
|
||||||
engine->m.mainTriggerCallbackTime);
|
engine->m.mainTriggerCallbackTime);
|
||||||
|
|
||||||
#if EFI_CLOCK_LOCKS || defined(__DOXYGEN__)
|
#if EFI_CLOCK_LOCKS
|
||||||
scheduleMsg(logger, "maxLockedDuration=%d / maxTriggerReentraint=%d", maxLockedDuration, maxTriggerReentraint);
|
scheduleMsg(logger, "maxLockedDuration=%d / maxTriggerReentraint=%d", maxLockedDuration, maxTriggerReentraint);
|
||||||
|
|
||||||
scheduleMsg(logger, "perSecondIrqDuration=%d ticks / perSecondIrqCounter=%d", perSecondIrqDuration, perSecondIrqCounter);
|
scheduleMsg(logger, "perSecondIrqDuration=%d ticks / perSecondIrqCounter=%d", perSecondIrqDuration, perSecondIrqCounter);
|
||||||
|
@ -613,7 +613,7 @@ void triggerInfo(void) {
|
||||||
|
|
||||||
scheduleMsg(logger, "maxEventCallbackDuration=%d", maxEventCallbackDuration);
|
scheduleMsg(logger, "maxEventCallbackDuration=%d", maxEventCallbackDuration);
|
||||||
|
|
||||||
#if EFI_HIP_9011 || defined(__DOXYGEN__)
|
#if EFI_HIP_9011
|
||||||
scheduleMsg(logger, "hipLastExecutionCount=%d", hipLastExecutionCount);
|
scheduleMsg(logger, "hipLastExecutionCount=%d", hipLastExecutionCount);
|
||||||
#endif /* EFI_HIP_9011 */
|
#endif /* EFI_HIP_9011 */
|
||||||
scheduleMsg(logger, "hwSetTimerDuration=%d", hwSetTimerDuration);
|
scheduleMsg(logger, "hwSetTimerDuration=%d", hwSetTimerDuration);
|
||||||
|
@ -626,7 +626,7 @@ void triggerInfo(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resetRunningTriggerCounters() {
|
static void resetRunningTriggerCounters() {
|
||||||
#if !EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if !EFI_UNIT_TEST
|
||||||
engine->triggerCentral.resetCounters();
|
engine->triggerCentral.resetCounters();
|
||||||
triggerInfo();
|
triggerInfo();
|
||||||
#endif
|
#endif
|
||||||
|
@ -655,7 +655,7 @@ void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfig
|
||||||
if (changed) {
|
if (changed) {
|
||||||
assertEngineReference();
|
assertEngineReference();
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL
|
||||||
ENGINE(initializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX));
|
ENGINE(initializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX));
|
||||||
engine->triggerCentral.resetAccumSignalData();
|
engine->triggerCentral.resetAccumSignalData();
|
||||||
#endif
|
#endif
|
||||||
|
@ -685,17 +685,17 @@ void initTriggerCentral(Logging *sharedLogger) {
|
||||||
logger = sharedLogger;
|
logger = sharedLogger;
|
||||||
strcpy((char*) shaft_signal_msg_index, "x_");
|
strcpy((char*) shaft_signal_msg_index, "x_");
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER
|
||||||
initWaveChart(&waveChart);
|
initWaveChart(&waveChart);
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
|
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
addConsoleAction("triggerinfo", triggerInfo);
|
addConsoleAction("triggerinfo", triggerInfo);
|
||||||
addConsoleAction("trigger_shape_info", triggerShapeInfo);
|
addConsoleAction("trigger_shape_info", triggerShapeInfo);
|
||||||
addConsoleAction("reset_trigger", resetRunningTriggerCounters);
|
addConsoleAction("reset_trigger", resetRunningTriggerCounters);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
#if EFI_HISTOGRAMS
|
||||||
initHistogram(&triggerCallbackHistogram, "all callbacks");
|
initHistogram(&triggerCallbackHistogram, "all callbacks");
|
||||||
#endif /* EFI_HISTOGRAMS */
|
#endif /* EFI_HISTOGRAMS */
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "trigger_simulator.h"
|
#include "trigger_simulator.h"
|
||||||
#include "rfiutil.h"
|
#include "rfiutil.h"
|
||||||
|
|
||||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
#if EFI_SENSOR_CHART
|
||||||
#include "sensor_chart.h"
|
#include "sensor_chart.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ TriggerStateWithRunningStatistics::TriggerStateWithRunningStatistics() :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
|
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
|
@ -87,12 +87,12 @@ EXTERN_ENGINE
|
||||||
// only TriggerStateWithRunningStatistics would have the field?
|
// only TriggerStateWithRunningStatistics would have the field?
|
||||||
static cyclic_buffer<int> errorDetection;
|
static cyclic_buffer<int> errorDetection;
|
||||||
|
|
||||||
#if ! EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if ! EFI_PROD_CODE
|
||||||
bool printTriggerDebug = false;
|
bool printTriggerDebug = false;
|
||||||
float actualSynchGap;
|
float actualSynchGap;
|
||||||
#endif /* ! EFI_PROD_CODE */
|
#endif /* ! EFI_PROD_CODE */
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ bool isTriggerDecoderError(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
efiAssertVoid(CUSTOM_ERR_6642, getCurrentRemainingStack() > 256, "calc s");
|
efiAssertVoid(CUSTOM_ERR_6642, getCurrentRemainingStack() > 256, "calc s");
|
||||||
#endif
|
#endif
|
||||||
trigger_config_s const*triggerConfig = &engineConfiguration->trigger;
|
trigger_config_s const*triggerConfig = &engineConfiguration->trigger;
|
||||||
|
@ -237,7 +237,7 @@ void TriggerStateWithRunningStatistics::runtimeStatistics(efitime_t nowNt DECLAR
|
||||||
int prevIndex;
|
int prevIndex;
|
||||||
instantRpm = calculateInstantRpm(&prevIndex, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
instantRpm = calculateInstantRpm(&prevIndex, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
#if EFI_SENSOR_CHART
|
||||||
angle_t currentAngle = TRIGGER_SHAPE(eventAngles[currentCycle.current_index]);
|
angle_t currentAngle = TRIGGER_SHAPE(eventAngles[currentCycle.current_index]);
|
||||||
if (CONFIGB(sensorChartMode) == SC_DETAILED_RPM) {
|
if (CONFIGB(sensorChartMode) == SC_DETAILED_RPM) {
|
||||||
scAddData(currentAngle, instantRpm);
|
scAddData(currentAngle, instantRpm);
|
||||||
|
@ -258,7 +258,7 @@ static trigger_value_e eventType[6] = { TV_FALL, TV_RISE, TV_FALL, TV_RISE, TV_F
|
||||||
#define getCurrentGapDuration(nowNt) \
|
#define getCurrentGapDuration(nowNt) \
|
||||||
(isFirstEvent ? 0 : (nowNt) - toothed_previous_time)
|
(isFirstEvent ? 0 : (nowNt) - toothed_previous_time)
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
#define PRINT_INC_INDEX if (printTriggerDebug) {\
|
#define PRINT_INC_INDEX if (printTriggerDebug) {\
|
||||||
printf("nextTriggerEvent index=%d\r\n", currentCycle.current_index); \
|
printf("nextTriggerEvent index=%d\r\n", currentCycle.current_index); \
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ bool TriggerState::validateEventCounters(DECLARE_ENGINE_PARAMETER_SIGNATURE) con
|
||||||
|
|
||||||
void TriggerState::handleTriggerError(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void TriggerState::handleTriggerError(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
if (engineConfiguration->debugMode == DBG_TRIGGER_SYNC) {
|
if (engineConfiguration->debugMode == DBG_TRIGGER_SYNC) {
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels.debugIntField1 = currentCycle.eventCount[0];
|
tsOutputChannels.debugIntField1 = currentCycle.eventCount[0];
|
||||||
tsOutputChannels.debugIntField2 = currentCycle.eventCount[1];
|
tsOutputChannels.debugIntField2 = currentCycle.eventCount[1];
|
||||||
tsOutputChannels.debugIntField3 = currentCycle.eventCount[2];
|
tsOutputChannels.debugIntField3 = currentCycle.eventCount[2];
|
||||||
|
@ -345,7 +345,7 @@ void TriggerState::handleTriggerError(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
|
|
||||||
totalTriggerErrorCounter++;
|
totalTriggerErrorCounter++;
|
||||||
if (CONFIG(isPrintTriggerSynchDetails) || someSortOfTriggerError) {
|
if (CONFIG(isPrintTriggerSynchDetails) || someSortOfTriggerError) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
scheduleMsg(logger, "error: synchronizationPoint @ index %d expected %d/%d/%d got %d/%d/%d",
|
scheduleMsg(logger, "error: synchronizationPoint @ index %d expected %d/%d/%d got %d/%d/%d",
|
||||||
currentCycle.current_index, TRIGGER_SHAPE(expectedEventCount[0]),
|
currentCycle.current_index, TRIGGER_SHAPE(expectedEventCount[0]),
|
||||||
TRIGGER_SHAPE(expectedEventCount[1]), TRIGGER_SHAPE(expectedEventCount[2]),
|
TRIGGER_SHAPE(expectedEventCount[1]), TRIGGER_SHAPE(expectedEventCount[2]),
|
||||||
|
@ -369,7 +369,7 @@ void TriggerState::onShaftSynchronization(efitime_t nowNt, trigger_wheel_e trigg
|
||||||
incrementTotalEventCounter();
|
incrementTotalEventCounter();
|
||||||
totalEventCountBase += getTriggerSize();
|
totalEventCountBase += getTriggerSize();
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
printf("index=%d %d\r\n",
|
printf("index=%d %d\r\n",
|
||||||
currentCycle.current_index,
|
currentCycle.current_index,
|
||||||
|
@ -418,7 +418,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
bool isPrimary = triggerWheel == T_PRIMARY;
|
bool isPrimary = triggerWheel == T_PRIMARY;
|
||||||
|
|
||||||
if (isLessImportant(type)) {
|
if (isLessImportant(type)) {
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
printf("%s isLessImportant %s now=%lld index=%d\r\n",
|
printf("%s isLessImportant %s now=%lld index=%d\r\n",
|
||||||
getTrigger_type_e(engineConfiguration->trigger.type),
|
getTrigger_type_e(engineConfiguration->trigger.type),
|
||||||
|
@ -435,7 +435,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
;
|
;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
printf("%s event %s %d\r\n",
|
printf("%s event %s %d\r\n",
|
||||||
getTrigger_type_e(engineConfiguration->trigger.type),
|
getTrigger_type_e(engineConfiguration->trigger.type),
|
||||||
|
@ -447,7 +447,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
isFirstEvent = false;
|
isFirstEvent = false;
|
||||||
// todo: skip a number of signal from the beginning
|
// todo: skip a number of signal from the beginning
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
// scheduleMsg(&logger, "from %.2f to %.2f %d %d", triggerConfig->syncRatioFrom, triggerConfig->syncRatioTo, toothDurations[0], shaftPositionState->toothDurations[1]);
|
// scheduleMsg(&logger, "from %.2f to %.2f %d %d", triggerConfig->syncRatioFrom, triggerConfig->syncRatioTo, toothDurations[0], shaftPositionState->toothDurations[1]);
|
||||||
// scheduleMsg(&logger, "ratio %.2f", 1.0 * toothDurations[0]/ shaftPositionState->toothDurations[1]);
|
// scheduleMsg(&logger, "ratio %.2f", 1.0 * toothDurations[0]/ shaftPositionState->toothDurations[1]);
|
||||||
#else
|
#else
|
||||||
|
@ -464,7 +464,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
|
|
||||||
if (CONFIG(debugMode) == DBG_TRIGGER_SYNC) {
|
if (CONFIG(debugMode) == DBG_TRIGGER_SYNC) {
|
||||||
float currentGap = 1.0 * toothDurations[0] / toothDurations[1];
|
float currentGap = 1.0 * toothDurations[0] / toothDurations[1];
|
||||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
#if EFI_TUNER_STUDIO
|
||||||
tsOutputChannels.debugFloatField1 = currentGap;
|
tsOutputChannels.debugFloatField1 = currentGap;
|
||||||
tsOutputChannels.debugFloatField2 = currentCycle.current_index;
|
tsOutputChannels.debugFloatField2 = currentCycle.current_index;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
@ -484,13 +484,13 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
isSynchronizationPoint = isSync;
|
isSynchronizationPoint = isSync;
|
||||||
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
if (CONFIG(isPrintTriggerSynchDetails) || (someSortOfTriggerError && !CONFIG(silentTriggerError))) {
|
if (CONFIG(isPrintTriggerSynchDetails) || (someSortOfTriggerError && !CONFIG(silentTriggerError))) {
|
||||||
#else
|
#else
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
|
|
||||||
for (int i = 0;i<GAP_TRACKING_LENGTH;i++) {
|
for (int i = 0;i<GAP_TRACKING_LENGTH;i++) {
|
||||||
float gap = 1.0 * toothDurations[i] / toothDurations[i + 1];
|
float gap = 1.0 * toothDurations[i] / toothDurations[i + 1];
|
||||||
|
@ -528,7 +528,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
* in case of noise the counter could be above the expected number of events, that's why 'more or equals' and not just 'equals'
|
* in case of noise the counter could be above the expected number of events, that's why 'more or equals' and not just 'equals'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
printf("sync=%d index=%d size=%d\r\n",
|
printf("sync=%d index=%d size=%d\r\n",
|
||||||
shaft_is_synchronized,
|
shaft_is_synchronized,
|
||||||
|
@ -541,7 +541,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
|
|
||||||
isSynchronizationPoint = !shaft_is_synchronized || (currentCycle.current_index >= endOfCycleIndex);
|
isSynchronizationPoint = !shaft_is_synchronized || (currentCycle.current_index >= endOfCycleIndex);
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
printf("isSynchronizationPoint=%d index=%d size=%d\r\n",
|
printf("isSynchronizationPoint=%d index=%d size=%d\r\n",
|
||||||
isSynchronizationPoint,
|
isSynchronizationPoint,
|
||||||
|
@ -552,7 +552,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
printf("%s isSynchronizationPoint=%d index=%d %s\r\n",
|
printf("%s isSynchronizationPoint=%d index=%d %s\r\n",
|
||||||
getTrigger_type_e(engineConfiguration->trigger.type),
|
getTrigger_type_e(engineConfiguration->trigger.type),
|
||||||
|
@ -633,7 +633,7 @@ static void onFindIndexCallback(TriggerState *state) {
|
||||||
uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape,
|
uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape,
|
||||||
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
UNUSED(triggerConfig);
|
UNUSED(triggerConfig);
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > 128, "findPos", -1);
|
efiAssert(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > 128, "findPos", -1);
|
||||||
#endif
|
#endif
|
||||||
errorDetection.clear();
|
errorDetection.clear();
|
||||||
|
@ -657,7 +657,7 @@ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape,
|
||||||
}
|
}
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, state->getTotalRevolutionCounter() == 1, "findZero_revCounter", EFI_ERROR_CODE);
|
efiAssert(CUSTOM_ERR_ASSERT, state->getTotalRevolutionCounter() == 1, "findZero_revCounter", EFI_ERROR_CODE);
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
printf("findTriggerZeroEventIndex: syncIndex located %d!\r\n", syncIndex);
|
printf("findTriggerZeroEventIndex: syncIndex located %d!\r\n", syncIndex);
|
||||||
}
|
}
|
||||||
|
@ -691,7 +691,7 @@ void TriggerState::runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SU
|
||||||
}
|
}
|
||||||
|
|
||||||
void initTriggerDecoder(void) {
|
void initTriggerDecoder(void) {
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE
|
||||||
enginePins.triggerDecoderErrorPin.initPin("trg_err", CONFIGB(triggerErrorPin),
|
enginePins.triggerDecoderErrorPin.initPin("trg_err", CONFIGB(triggerErrorPin),
|
||||||
&CONFIGB(triggerErrorPinMode));
|
&CONFIGB(triggerErrorPinMode));
|
||||||
#endif /* EFI_GPIO_HARDWARE */
|
#endif /* EFI_GPIO_HARDWARE */
|
||||||
|
|
|
@ -100,7 +100,7 @@ public:
|
||||||
|
|
||||||
void resetTriggerState();
|
void resetTriggerState();
|
||||||
|
|
||||||
#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||||
virtual void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
virtual void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public:
|
||||||
float prevInstantRpmValue = 0;
|
float prevInstantRpmValue = 0;
|
||||||
void movePreSynchTimestamps(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void movePreSynchTimestamps(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
float calculateInstantRpm(int *prevIndex, efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
float calculateInstantRpm(int *prevIndex, efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||||
virtual void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
virtual void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,7 +27,7 @@ bool needEvent(const int currentIndex, const int size, MultiWave *multiWave, int
|
||||||
return previousValue != currentValue;
|
return previousValue != currentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__)
|
#if EFI_EMULATE_POSITION_SENSORS
|
||||||
|
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "trigger_emulator_algo.h"
|
#include "trigger_emulator_algo.h"
|
||||||
|
@ -140,7 +140,7 @@ static void emulatorApplyPinState(int stateIndex, PwmConfig *state) /* pwm_gen_c
|
||||||
if (!isEmulating) {
|
if (!isEmulating) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE
|
||||||
applyPinState(stateIndex, state);
|
applyPinState(stateIndex, state);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
if (engineConfiguration->directSelfStimulation) {
|
if (engineConfiguration->directSelfStimulation) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ bool isUsefulSignal(trigger_event_e signal, engine_configuration_s *engineConfig
|
||||||
return !engineConfiguration->useOnlyRisingEdgeForTrigger || isRisingEdge[(int) signal];
|
return !engineConfiguration->useOnlyRisingEdgeForTrigger || isRisingEdge[(int) signal];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
extern bool printTriggerDebug;
|
extern bool printTriggerDebug;
|
||||||
#endif /* ! EFI_UNIT_TEST */
|
#endif /* ! EFI_UNIT_TEST */
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ void TriggerStimulatorHelper::feedSimulatedEvent(TriggerState *state, TriggerSha
|
||||||
pin_state_t thirdWheelState = multiWave->getChannelState(2, prevIndex);
|
pin_state_t thirdWheelState = multiWave->getChannelState(2, prevIndex);
|
||||||
pin_state_t new3rdWheelState = multiWave->getChannelState(2, stateIndex);
|
pin_state_t new3rdWheelState = multiWave->getChannelState(2, stateIndex);
|
||||||
|
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST
|
||||||
if (printTriggerDebug) {
|
if (printTriggerDebug) {
|
||||||
printf("feedSimulatedEvent: %d>%d primary %d>%d secondary %d>%d\r\n", prevIndex, stateIndex, primaryWheelState, newPrimaryWheelState,
|
printf("feedSimulatedEvent: %d>%d primary %d>%d secondary %d>%d\r\n", prevIndex, stateIndex, primaryWheelState, newPrimaryWheelState,
|
||||||
secondaryWheelState, newSecondaryWheelState );
|
secondaryWheelState, newSecondaryWheelState );
|
||||||
|
|
Loading…
Reference in New Issue