This commit is contained in:
Andrey 2022-09-28 22:19:23 -04:00
commit 1a765ac629
42 changed files with 128 additions and 107 deletions

View File

@ -14,10 +14,11 @@ Release template (copy/paste this for new release):
-
### Added
-
- VVT minimum RPM setting #4545
### Fixed
- Enforce board configuration overrides more strictly #4614
- Enforce board configuration overrides more strictly #4614
- Fuel Priming reset fix #4627
-->

View File

@ -227,7 +227,7 @@ void onConfigurationChangeBoostCallback(engine_configuration_s *previousConfigur
void initBoostCtrl() {
// todo: why do we have 'isBoostControlEnabled' setting exactly?
// 'initAuxPid' is an example of a subsystem without explicit enable
// 'initVvtActuators' is an example of a subsystem without explicit enable
if (!engineConfiguration->isBoostControlEnabled) {
return;
}

View File

@ -105,7 +105,7 @@ expected<percent_t> VvtController::getClosedLoop(angle_t target, angle_t observa
void VvtController::setOutput(expected<percent_t> outputValue) {
float rpm = Sensor::getOrZero(SensorType::Rpm);
#if EFI_SHAFT_POSITION_INPUT
bool enabled = rpm > engineConfiguration->cranking.rpm /* todo: make this configurable? */
bool enabled = rpm > engineConfiguration->vvtControlMinRpm
&& engine->rpmCalculator.getSecondsSinceEngineStart(getTimeNowNt()) > engineConfiguration->vvtActivationDelayMs / MS_PER_SECOND
;
@ -149,7 +149,10 @@ void stopVvtControlPins() {
}
}
void initAuxPid() {
void initVvtActuators() {
if (engineConfiguration->vvtControlMinRpm < engineConfiguration->cranking.rpm) {
engineConfiguration->vvtControlMinRpm = engineConfiguration->cranking.rpm;
}
vvtTable1.init(config->vvtTable1, config->vvtTable1LoadBins,
config->vvtTable1RpmBins);

View File

@ -14,7 +14,7 @@
class ValueProvider3D;
void initAuxPid();
void initVvtActuators();
void startVvtControlPins();
void stopVvtControlPins();

View File

@ -1,2 +1,2 @@
#pragma once
#define VCS_DATE 20220928
#define VCS_DATE 20220929

View File

@ -194,8 +194,6 @@ static void doPeriodicSlowCallback() {
if (engine->rpmCalculator.isStopped()) {
resetAccel();
} else {
updatePrimeInjectionPulseState();
}
if (engine->versionForConfigurationListeners.isOld(engine->getGlobalConfigurationVersion())) {
@ -690,7 +688,7 @@ void initEngineContoller() {
#endif /* EFI_ALTERNATOR_CONTROL */
#if EFI_AUX_PID
initAuxPid();
initVvtActuators();
#endif /* EFI_AUX_PID */
#if EFI_MALFUNCTION_INDICATOR

View File

@ -8,12 +8,6 @@
#include "sensor.h"
#include "backup_ram.h"
void PrimeController::onPrimeEnd() {
endSimultaneousInjectionOnlyTogglePins();
m_isPriming = false;
}
floatms_t PrimeController::getPrimeDuration() const {
auto clt = Sensor::get(SensorType::Clt);
@ -28,16 +22,18 @@ floatms_t PrimeController::getPrimeDuration() const {
return engine->module<InjectorModel>()->getInjectionDuration(primeMass);
}
// Check if the engine is not stopped or cylinder cleanup is activated
static bool isPrimeInjectionPulseSkipped() {
if (!getEngineRotationState()->isStopped())
// Skip if the engine is already spinning
if (!getEngineRotationState()->isStopped()) {
return true;
}
// Skip if cylinder cleanup is active
return engineConfiguration->isCylinderCleanupEnabled && (Sensor::getOrZero(SensorType::Tps1) > CLEANUP_MODE_TPS);
}
/**
* Prime injection pulse
*/
void PrimeController::onIgnitionStateChanged(bool ignitionOn) {
if (!ignitionOn) {
// don't prime on ignition-off
@ -46,34 +42,49 @@ void PrimeController::onIgnitionStateChanged(bool ignitionOn) {
// 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
#if EFI_PROD_CODE
uint32_t ignSwitchCounter = backupRamLoad(BACKUP_IGNITION_SWITCH_COUNTER);
#else /* EFI_PROD_CODE */
uint32_t ignSwitchCounter = 0;
#endif /* EFI_PROD_CODE */
uint32_t ignSwitchCounter = getKeyCycleCounter();
// if we're just toying with the ignition switch, give it another chance eventually...
if (ignSwitchCounter > 10)
if (ignSwitchCounter > 10) {
ignSwitchCounter = 0;
}
// If we're going to skip this pulse, then save the counter as 0.
// That's because we'll definitely need the prime pulse next time (either due to the cylinder cleanup or the engine spinning)
if (isPrimeInjectionPulseSkipped())
if (isPrimeInjectionPulseSkipped()) {
ignSwitchCounter = -1;
}
// start prime injection if this is a 'fresh start'
if (ignSwitchCounter == 0) {
auto primeDelayMs = engineConfiguration->primingDelay * 1000;
auto startTime = getTimeNowNt() + MS2NT(primeDelayMs);
getExecutorInterface()->scheduleByTimestampNt("prime", &m_start, startTime, { PrimeController::onPrimeStartAdapter, this});
getExecutorInterface()->scheduleByTimestampNt("prime", &m_start, startTime, { PrimeController::onPrimeStartAdapter, this });
} else {
efiPrintf("Skipped priming pulse since ignSwitchCounter = %d", ignSwitchCounter);
}
#if EFI_PROD_CODE
// we'll reset it later when the engine starts
backupRamSave(BACKUP_IGNITION_SWITCH_COUNTER, ignSwitchCounter + 1);
#endif /* EFI_PROD_CODE */
setKeyCycleCounter(ignSwitchCounter + 1);
}
#if EFI_PROD_CODE
uint32_t PrimeController::getKeyCycleCounter() const {
return backupRamLoad(BACKUP_IGNITION_SWITCH_COUNTER);
}
void PrimeController::setKeyCycleCounter(uint32_t count) {
backupRamSave(BACKUP_IGNITION_SWITCH_COUNTER, count);
}
#else // not EFI_PROD_CODE
uint32_t PrimeController::getKeyCycleCounter() const {
return 0;
}
void PrimeController::setKeyCycleCounter(uint32_t) { }
#endif
void PrimeController::onPrimeStart() {
auto durationMs = getPrimeDuration();
@ -93,16 +104,16 @@ void PrimeController::onPrimeStart() {
getExecutorInterface()->scheduleByTimestampNt("prime", &m_end, endTime, { onPrimeEndAdapter, this });
}
void updatePrimeInjectionPulseState() {
static bool counterWasReset = false;
if (counterWasReset)
return;
void PrimeController::onPrimeEnd() {
endSimultaneousInjectionOnlyTogglePins();
m_isPriming = false;
}
void PrimeController::onSlowCallback() {
if (!getEngineRotationState()->isStopped()) {
#if EFI_PROD_CODE
backupRamSave(BACKUP_IGNITION_SWITCH_COUNTER, 0);
#endif /* EFI_PROD_CODE */
counterWasReset = true;
}
}

View File

@ -12,6 +12,7 @@
class PrimeController : public EngineModule {
public:
void onIgnitionStateChanged(bool ignitionOn) override;
void onSlowCallback() override;
floatms_t getPrimeDuration() const;
@ -35,7 +36,7 @@ private:
static void onPrimeEndAdapter(PrimeController* instance) {
instance->onPrimeEnd();
}
};
// reset injection switch counter if the engine started spinning
void updatePrimeInjectionPulseState();
uint32_t getKeyCycleCounter() const;
void setKeyCycleCounter(uint32_t count);
};

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 337094397
#define TS_SIGNATURE "rusEFI 2022.09.28.48way.337094397"
#define SIGNATURE_HASH 3377530801
#define TS_SIGNATURE "rusEFI 2022.09.28.48way.3377530801"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 53522098
#define TS_SIGNATURE "rusEFI 2022.09.28.all.53522098"
#define SIGNATURE_HASH 3732279294
#define TS_SIGNATURE "rusEFI 2022.09.28.all.3732279294"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 824325086
#define TS_SIGNATURE "rusEFI 2022.09.28.alphax-2chan.824325086"
#define SIGNATURE_HASH 3966014098
#define TS_SIGNATURE "rusEFI 2022.09.28.alphax-2chan.3966014098"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 2284612925
#define TS_SIGNATURE "rusEFI 2022.09.28.alphax-4chan.2284612925"
#define SIGNATURE_HASH 1433062513
#define TS_SIGNATURE "rusEFI 2022.09.28.alphax-4chan.1433062513"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 536501141
#define TS_SIGNATURE "rusEFI 2022.09.28.atlas.536501141"
#define SIGNATURE_HASH 3267164889
#define TS_SIGNATURE "rusEFI 2022.09.28.atlas.3267164889"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 4124901195
#define TS_SIGNATURE "rusEFI 2022.09.28.core8.4124901195"
#define SIGNATURE_HASH 681205255
#define TS_SIGNATURE "rusEFI 2022.09.28.core8.681205255"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat null
//
#define SIGNATURE_HASH 53522098
#define TS_SIGNATURE "rusEFI 2022.09.28.cypress.53522098"
#define SIGNATURE_HASH 3732279294
#define TS_SIGNATURE "rusEFI 2022.09.28.cypress.3732279294"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 53522098
#define TS_SIGNATURE "rusEFI 2022.09.28.f407-discovery.53522098"
#define SIGNATURE_HASH 3732279294
#define TS_SIGNATURE "rusEFI 2022.09.28.f407-discovery.3732279294"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 53522098
#define TS_SIGNATURE "rusEFI 2022.09.28.f429-discovery.53522098"
#define SIGNATURE_HASH 3732279294
#define TS_SIGNATURE "rusEFI 2022.09.28.f429-discovery.3732279294"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 1096569462
#define TS_SIGNATURE "rusEFI 2022.09.28.frankenso_na6.1096569462"
#define SIGNATURE_HASH 2619011898
#define TS_SIGNATURE "rusEFI 2022.09.28.frankenso_na6.2619011898"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 4090342301
#define TS_SIGNATURE "rusEFI 2022.09.28.harley81.4090342301"
#define SIGNATURE_HASH 780864209
#define TS_SIGNATURE "rusEFI 2022.09.28.harley81.780864209"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 3075943172
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen-gm-e67.3075943172"
#define SIGNATURE_HASH 1779534408
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen-gm-e67.1779534408"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 3669729150
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen-nb1.3669729150"
#define SIGNATURE_HASH 134037042
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen-nb1.134037042"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 2347636312
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen121nissan.2347636312"
#define SIGNATURE_HASH 1453897492
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen121nissan.1453897492"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 1930522056
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen121vag.1930522056"
#define SIGNATURE_HASH 2924989572
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen121vag.2924989572"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 4258173836
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen128.4258173836"
#define SIGNATURE_HASH 545796800
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen128.545796800"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 2891176512
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen154hyundai.2891176512"
#define SIGNATURE_HASH 1897233164
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen154hyundai.1897233164"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 4044326838
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen72.4044326838"
#define SIGNATURE_HASH 742991610
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen72.742991610"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 562394808
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen81.562394808"
#define SIGNATURE_HASH 4240693236
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen81.4240693236"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 382057854
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen88bmw.382057854"
#define SIGNATURE_HASH 3414367282
#define TS_SIGNATURE "rusEFI 2022.09.28.hellen88bmw.3414367282"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 1568415621
#define TS_SIGNATURE "rusEFI 2022.09.28.hellenNA6.1568415621"
#define SIGNATURE_HASH 2151333577
#define TS_SIGNATURE "rusEFI 2022.09.28.hellenNA6.2151333577"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 2738429786
#define TS_SIGNATURE "rusEFI 2022.09.28.hellenNA8_96.2738429786"
#define SIGNATURE_HASH 2122300950
#define TS_SIGNATURE "rusEFI 2022.09.28.hellenNA8_96.2122300950"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on kinetis_gen_config.bat null
//
#define SIGNATURE_HASH 1810304126
#define TS_SIGNATURE "rusEFI 2022.09.28.kin.1810304126"
#define SIGNATURE_HASH 3064048946
#define TS_SIGNATURE "rusEFI 2022.09.28.kin.3064048946"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 1549942973
#define TS_SIGNATURE "rusEFI 2022.09.28.mre_f4.1549942973"
#define SIGNATURE_HASH 2166678001
#define TS_SIGNATURE "rusEFI 2022.09.28.mre_f4.2166678001"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 1549942973
#define TS_SIGNATURE "rusEFI 2022.09.28.mre_f7.1549942973"
#define SIGNATURE_HASH 2166678001
#define TS_SIGNATURE "rusEFI 2022.09.28.mre_f7.2166678001"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 1406826324
#define TS_SIGNATURE "rusEFI 2022.09.28.prometheus_405.1406826324"
#define SIGNATURE_HASH 2392643096
#define TS_SIGNATURE "rusEFI 2022.09.28.prometheus_405.2392643096"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 1406826324
#define TS_SIGNATURE "rusEFI 2022.09.28.prometheus_469.1406826324"
#define SIGNATURE_HASH 2392643096
#define TS_SIGNATURE "rusEFI 2022.09.28.prometheus_469.2392643096"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 2801625540
#define TS_SIGNATURE "rusEFI 2022.09.28.proteus_f4.2801625540"
#define SIGNATURE_HASH 2075904136
#define TS_SIGNATURE "rusEFI 2022.09.28.proteus_f4.2075904136"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 2801625540
#define TS_SIGNATURE "rusEFI 2022.09.28.proteus_f7.2801625540"
#define SIGNATURE_HASH 2075904136
#define TS_SIGNATURE "rusEFI 2022.09.28.proteus_f7.2075904136"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 2801625540
#define TS_SIGNATURE "rusEFI 2022.09.28.proteus_h7.2801625540"
#define SIGNATURE_HASH 2075904136
#define TS_SIGNATURE "rusEFI 2022.09.28.proteus_h7.2075904136"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_subaru_config.sh null
//
#define SIGNATURE_HASH 2049865576
#define TS_SIGNATURE "rusEFI 2022.09.28.subaru_eg33_f7.2049865576"
#define SIGNATURE_HASH 2808665636
#define TS_SIGNATURE "rusEFI 2022.09.28.subaru_eg33_f7.2808665636"

View File

@ -2,5 +2,5 @@
// was generated automatically by rusEFI tool ConfigDefinition.jar based on gen_config.sh null
//
#define SIGNATURE_HASH 2839044326
#define TS_SIGNATURE "rusEFI 2022.09.28.tdg-pdm8.2839044326"
#define SIGNATURE_HASH 1954464170
#define TS_SIGNATURE "rusEFI 2022.09.28.tdg-pdm8.1954464170"

View File

@ -770,6 +770,8 @@ float getConfigValueByName(const char *name) {
return engineConfiguration->fan2OnTemperature;
if (strEqualCaseInsensitive(name, "fan2OffTemperature"))
return engineConfiguration->fan2OffTemperature;
if (strEqualCaseInsensitive(name, "vvtControlMinRpm"))
return engineConfiguration->vvtControlMinRpm;
if (strEqualCaseInsensitive(name, "coastingFuelCutRpmHigh"))
return engineConfiguration->coastingFuelCutRpmHigh;
if (strEqualCaseInsensitive(name, "coastingFuelCutRpmLow"))
@ -2391,6 +2393,11 @@ void setConfigValueByName(const char *name, float value) {
engineConfiguration->fan2OffTemperature = (int)value;
return;
}
if (strEqualCaseInsensitive(name, "vvtControlMinRpm"))
{
engineConfiguration->vvtControlMinRpm = (int)value;
return;
}
if (strEqualCaseInsensitive(name, "coastingFuelCutRpmHigh"))
{
engineConfiguration->coastingFuelCutRpmHigh = (int)value;

View File

@ -1,12 +1,12 @@
// This file was generated by Version2Header
// Wed Sep 28 00:32:30 UTC 2022
// Thu Sep 29 00:34:06 UTC 2022
#ifndef GIT_HASH
#define GIT_HASH "50b9a6fd3a74b3e06c222259d3769a7280a50e8b"
#define GIT_HASH "ba3498885ee85cdab5836a7aae18dce51d673eb4"
#endif
#ifndef VCS_VERSION
#define VCS_VERSION "47185"
#define VCS_VERSION "48109"
#endif