zero dwell warning at zero RPM #3153
This commit is contained in:
parent
4a8a35ccc8
commit
6d3b2c5b00
|
@ -612,6 +612,80 @@ void commonInitEngineController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
initTachometer(PASS_ENGINE_PARAMETER_SIGNATURE);
|
initTachometer(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns false if there's an obvious problem with the loaded configuration
|
||||||
|
bool validateConfig(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
|
if (CONFIG(specs.cylindersCount) > MAX_CYLINDER_COUNT) {
|
||||||
|
firmwareError(OBD_PCM_Processor_Fault, "Invalid cylinder count: %d", CONFIG(specs.cylindersCount));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fueling
|
||||||
|
{
|
||||||
|
ensureArrayIsAscending("VE load", config->veLoadBins);
|
||||||
|
ensureArrayIsAscending("VE RPM", config->veRpmBins);
|
||||||
|
|
||||||
|
ensureArrayIsAscending("Lambda/AFR load", config->lambdaLoadBins);
|
||||||
|
ensureArrayIsAscending("Lambda/AFR RPM", config->lambdaRpmBins);
|
||||||
|
|
||||||
|
ensureArrayIsAscending("Fuel CLT mult", config->cltFuelCorrBins);
|
||||||
|
ensureArrayIsAscending("Fuel IAT mult", config->iatFuelCorrBins);
|
||||||
|
|
||||||
|
ensureArrayIsAscending("Injection phase load", config->injPhaseLoadBins);
|
||||||
|
ensureArrayIsAscending("Injection phase RPM", config->injPhaseRpmBins);
|
||||||
|
|
||||||
|
ensureArrayIsAscending("TPS/TPS AE from", config->tpsTpsAccelFromRpmBins);
|
||||||
|
ensureArrayIsAscending("TPS/TPS AE to", config->tpsTpsAccelToRpmBins);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignition
|
||||||
|
{
|
||||||
|
ensureArrayIsAscending("Dwell RPM", engineConfiguration->sparkDwellRpmBins);
|
||||||
|
|
||||||
|
ensureArrayIsAscending("Ignition load", config->ignitionLoadBins);
|
||||||
|
ensureArrayIsAscending("Ignition RPM", config->ignitionRpmBins);
|
||||||
|
|
||||||
|
ensureArrayIsAscending("Ignition CLT corr", engineConfiguration->cltTimingBins);
|
||||||
|
|
||||||
|
ensureArrayIsAscending("Ignition IAT corr IAT", config->ignitionIatCorrLoadBins);
|
||||||
|
ensureArrayIsAscending("Ignition IAT corr RPM", config->ignitionIatCorrRpmBins);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config->mapEstimateTpsBins[1] != 0) { // only validate map if not all zeroes default
|
||||||
|
ensureArrayIsAscending("Map estimate TPS", config->mapEstimateTpsBins);
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureArrayIsAscending("Map estimate RPM", config->mapEstimateRpmBins);
|
||||||
|
ensureArrayIsAscending("Ignition load", config->mafDecodingBins);
|
||||||
|
|
||||||
|
// Cranking tables
|
||||||
|
ensureArrayIsAscending("Cranking fuel mult", config->crankingFuelBins);
|
||||||
|
ensureArrayIsAscending("Cranking duration", config->crankingCycleBins);
|
||||||
|
ensureArrayIsAscending("Cranking TPS", engineConfiguration->crankingTpsBins);
|
||||||
|
|
||||||
|
// Idle tables
|
||||||
|
ensureArrayIsAscending("Idle target RPM", engineConfiguration->cltIdleRpmBins);
|
||||||
|
ensureArrayIsAscending("Idle warmup mult", config->cltIdleCorrBins);
|
||||||
|
ensureArrayIsAscending("Idle coasting position", engineConfiguration->iacCoastingBins);
|
||||||
|
ensureArrayIsAscending("Idle VE", config->idleVeBins);
|
||||||
|
ensureArrayIsAscending("Idle timing", config->idleAdvanceBins);
|
||||||
|
|
||||||
|
// Boost
|
||||||
|
ensureArrayIsAscending("Boost control TPS", config->boostTpsBins);
|
||||||
|
ensureArrayIsAscending("Boost control RPM", config->boostRpmBins);
|
||||||
|
|
||||||
|
// ETB
|
||||||
|
ensureArrayIsAscending("Pedal map pedal", config->pedalToTpsPedalBins);
|
||||||
|
ensureArrayIsAscending("Pedal map RPM", config->pedalToTpsRpmBins);
|
||||||
|
|
||||||
|
// VVT
|
||||||
|
ensureArrayIsAscending("VVT intake load", config->vvtTable1LoadBins);
|
||||||
|
ensureArrayIsAscending("VVT intake RPM", config->vvtTable1RpmBins);
|
||||||
|
ensureArrayIsAscending("VVT exhaust load", config->vvtTable2LoadBins);
|
||||||
|
ensureArrayIsAscending("VVT exhaust RPM", config->vvtTable2RpmBins);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
|
|
||||||
void initEngineContoller(DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void initEngineContoller(DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
bool validateConfig(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||||
char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer);
|
char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer);
|
||||||
void initPeriodicEvents(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void initPeriodicEvents(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
void initEngineContoller(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void initEngineContoller(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
|
@ -152,77 +152,6 @@ static void scheduleReboot(void) {
|
||||||
chVTSetI(&resetTimer, TIME_MS2I(3000), (vtfunc_t) rebootNow, NULL);
|
chVTSetI(&resetTimer, TIME_MS2I(3000), (vtfunc_t) rebootNow, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns false if there's an obvious problem with the loaded configuration
|
|
||||||
static bool validateConfig() {
|
|
||||||
if (CONFIG(specs.cylindersCount) > MAX_CYLINDER_COUNT) {
|
|
||||||
firmwareError(OBD_PCM_Processor_Fault, "Invalid cylinder count: %d", CONFIG(specs.cylindersCount));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fueling
|
|
||||||
{
|
|
||||||
ensureArrayIsAscending("VE load", config->veLoadBins);
|
|
||||||
ensureArrayIsAscending("VE RPM", config->veRpmBins);
|
|
||||||
|
|
||||||
ensureArrayIsAscending("Lambda/AFR load", config->lambdaLoadBins);
|
|
||||||
ensureArrayIsAscending("Lambda/AFR RPM", config->lambdaRpmBins);
|
|
||||||
|
|
||||||
ensureArrayIsAscending("Fuel CLT mult", config->cltFuelCorrBins);
|
|
||||||
ensureArrayIsAscending("Fuel IAT mult", config->iatFuelCorrBins);
|
|
||||||
|
|
||||||
ensureArrayIsAscending("Injection phase load", config->injPhaseLoadBins);
|
|
||||||
ensureArrayIsAscending("Injection phase RPM", config->injPhaseRpmBins);
|
|
||||||
|
|
||||||
ensureArrayIsAscending("TPS/TPS AE from", config->tpsTpsAccelFromRpmBins);
|
|
||||||
ensureArrayIsAscending("TPS/TPS AE to", config->tpsTpsAccelToRpmBins);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ignition
|
|
||||||
{
|
|
||||||
ensureArrayIsAscending("Dwell RPM", engineConfiguration->sparkDwellRpmBins);
|
|
||||||
|
|
||||||
ensureArrayIsAscending("Ignition load", config->ignitionLoadBins);
|
|
||||||
ensureArrayIsAscending("Ignition RPM", config->ignitionRpmBins);
|
|
||||||
|
|
||||||
ensureArrayIsAscending("Ignition CLT corr", engineConfiguration->cltTimingBins);
|
|
||||||
|
|
||||||
ensureArrayIsAscending("Ignition IAT corr IAT", config->ignitionIatCorrLoadBins);
|
|
||||||
ensureArrayIsAscending("Ignition IAT corr RPM", config->ignitionIatCorrRpmBins);
|
|
||||||
}
|
|
||||||
|
|
||||||
ensureArrayIsAscending("Map estimate TPS", config->mapEstimateTpsBins);
|
|
||||||
ensureArrayIsAscending("Map estimate RPM", config->mapEstimateRpmBins);
|
|
||||||
ensureArrayIsAscending("Ignition load", config->mafDecodingBins);
|
|
||||||
|
|
||||||
// Cranking tables
|
|
||||||
ensureArrayIsAscending("Cranking fuel mult", config->crankingFuelBins);
|
|
||||||
ensureArrayIsAscending("Cranking duration", config->crankingCycleBins);
|
|
||||||
ensureArrayIsAscending("Cranking TPS", engineConfiguration->crankingTpsBins);
|
|
||||||
|
|
||||||
// Idle tables
|
|
||||||
ensureArrayIsAscending("Idle target RPM", engineConfiguration->cltIdleRpmBins);
|
|
||||||
ensureArrayIsAscending("Idle warmup mult", config->cltIdleCorrBins);
|
|
||||||
ensureArrayIsAscending("Idle coasting position", engineConfiguration->iacCoastingBins);
|
|
||||||
ensureArrayIsAscending("Idle VE", config->idleVeBins);
|
|
||||||
ensureArrayIsAscending("Idle timing", config->idleAdvanceBins);
|
|
||||||
|
|
||||||
// Boost
|
|
||||||
ensureArrayIsAscending("Boost control TPS", config->boostTpsBins);
|
|
||||||
ensureArrayIsAscending("Boost control RPM", config->boostRpmBins);
|
|
||||||
|
|
||||||
// ETB
|
|
||||||
ensureArrayIsAscending("Pedal map pedal", config->pedalToTpsPedalBins);
|
|
||||||
ensureArrayIsAscending("Pedal map RPM", config->pedalToTpsRpmBins);
|
|
||||||
|
|
||||||
// VVT
|
|
||||||
ensureArrayIsAscending("VVT intake load", config->vvtTable1LoadBins);
|
|
||||||
ensureArrayIsAscending("VVT intake RPM", config->vvtTable1RpmBins);
|
|
||||||
ensureArrayIsAscending("VVT exhaust load", config->vvtTable2LoadBins);
|
|
||||||
ensureArrayIsAscending("VVT exhaust RPM", config->vvtTable2RpmBins);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static jmp_buf jmpEnv;
|
static jmp_buf jmpEnv;
|
||||||
void onAssertionFailure() {
|
void onAssertionFailure() {
|
||||||
// There's been an assertion failure: instead of hanging, jump back to where we check
|
// There's been an assertion failure: instead of hanging, jump back to where we check
|
||||||
|
@ -322,7 +251,7 @@ void runRusEfiWithConfig() {
|
||||||
#endif // EFI_LUA
|
#endif // EFI_LUA
|
||||||
|
|
||||||
// Config could be completely bogus - don't start anything else!
|
// Config could be completely bogus - don't start anything else!
|
||||||
if (validateConfig()) {
|
if (validateConfig(PASS_CONFIG_PARAMETER_SIGNATURE)) {
|
||||||
initStatusLoop();
|
initStatusLoop();
|
||||||
/**
|
/**
|
||||||
* Now let's initialize actual engine control logic
|
* Now let's initialize actual engine control logic
|
||||||
|
|
Loading…
Reference in New Issue