do not control VVT during cranking fix #3443

This commit is contained in:
rusefillc 2022-04-10 19:22:39 -04:00
parent a90ca2b200
commit b776003989
6 changed files with 10 additions and 7 deletions

View File

@ -33,6 +33,7 @@ All notable user-facing or behavior-altering changes will be documented in this
- Mitsubishi 3A92 VVT trigger
- Toyota 4-1 VVT trigger
- use extra RAM for lua if your microRusEFI unit has stm32f42x microcontroller
- VVT activation delay #3443
## March 2022 Release - "Day 22"

View File

@ -90,10 +90,11 @@ expected<percent_t> VvtController::getClosedLoop(angle_t target, angle_t observa
void VvtController::setOutput(expected<percent_t> outputValue) {
float rpm = Sensor::getOrZero(SensorType::Rpm);
// todo: make this configurable?
bool enabledAtCurrentRpm = rpm > engineConfiguration->cranking.rpm;
bool enabled = rpm > engineConfiguration->cranking.rpm /* todo: make this configurable? */
&& engine->rpmCalculator.getSecondsSinceEngineStart(getTimeNowNt()) > engineConfiguration->vvtActivationDelayMs / MS_PER_SECOND
;
if (outputValue && enabledAtCurrentRpm) {
if (outputValue && enabled) {
m_pwm.setSimplePwmDutyCycle(PERCENT_TO_DUTY(outputValue.Value));
} else {
m_pwm.setSimplePwmDutyCycle(0);

View File

@ -300,7 +300,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
}
}
float RpmCalculator::getTimeSinceEngineStart(efitick_t nowNt) const {
float RpmCalculator::getSecondsSinceEngineStart(efitick_t nowNt) const {
return engineStartTimer.getElapsedSeconds(nowNt);
}

View File

@ -103,8 +103,8 @@ public:
*/
float getRpmAcceleration() const;
// Get elapsed time (seconds) since the engine transitioned to the running state.
float getTimeSinceEngineStart(efitick_t nowNt) const;
// Get elapsed time since the engine transitioned to the running state.
float getSecondsSinceEngineStart(efitick_t nowNt) const;
/**
* this is RPM on previous engine cycle.

View File

@ -40,7 +40,7 @@ void LimpManager::updateState(int rpm, efitick_t nowNt) {
// Only check if the setting is enabled
if (minOilPressure > 0) {
// Has it been long enough we should have pressure?
bool isTimedOut = engine->rpmCalculator.getTimeSinceEngineStart(nowNt) > 5.0f;
bool isTimedOut = engine->rpmCalculator.getSecondsSinceEngineStart(nowNt) > 5.0f;
// Only check before timed out
if (!isTimedOut) {

View File

@ -12,6 +12,7 @@
#include "efifeatures.h"
#include "rusefi_types.h"
#define MS_PER_SECOND 1000
#define US_PER_SECOND 1000000
#define US_PER_SECOND_F 1000000.0
#define US_PER_SECOND_LL 1000000LL