only:int rpm -> float rpm
This commit is contained in:
parent
1bbc84aba8
commit
b8af7df4be
|
@ -590,7 +590,7 @@ static void updateFuelInfo() {
|
|||
#endif // EFI_ENGINE_CONTROL
|
||||
}
|
||||
|
||||
static void updateIgnition(int rpm) {
|
||||
static void updateIgnition(float rpm) {
|
||||
#if EFI_ENGINE_CONTROL
|
||||
engine->outputChannels.coilDutyCycle = getCoilDutyCycle(rpm);
|
||||
#endif // EFI_ENGINE_CONTROL
|
||||
|
@ -653,7 +653,7 @@ void updateTunerStudioState() {
|
|||
engine->outputChannels.isUsbConnected = is_usb_serial_ready();
|
||||
#endif // EFI_USB_SERIAL
|
||||
|
||||
int rpm = Sensor::get(SensorType::Rpm).value_or(0);
|
||||
float rpm = Sensor::get(SensorType::Rpm).value_or(0);
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
executorStatistics();
|
||||
|
|
|
@ -36,7 +36,7 @@ int IdleController::getTargetRpm(float clt) {
|
|||
return target;
|
||||
}
|
||||
|
||||
IIdleController::Phase IdleController::determinePhase(int rpm, int targetRpm, SensorResult tps, float vss, float crankingTaperFraction) {
|
||||
IIdleController::Phase IdleController::determinePhase(float rpm, float targetRpm, SensorResult tps, float vss, float crankingTaperFraction) {
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
if (!engine->rpmCalculator.isRunning()) {
|
||||
return Phase::Cranking;
|
||||
|
@ -55,7 +55,7 @@ IIdleController::Phase IdleController::determinePhase(int rpm, int targetRpm, Se
|
|||
|
||||
// If rpm too high (but throttle not pressed), we're coasting
|
||||
// ALSO, if still in the cranking taper, disable coasting
|
||||
int maximumIdleRpm = targetRpm + engineConfiguration->idlePidRpmUpperLimit;
|
||||
float maximumIdleRpm = targetRpm + engineConfiguration->idlePidRpmUpperLimit;
|
||||
looksLikeCoasting = rpm > maximumIdleRpm;
|
||||
looksLikeCrankToIdle = crankingTaperFraction < 1;
|
||||
if (looksLikeCoasting && !looksLikeCrankToIdle) {
|
||||
|
@ -179,11 +179,11 @@ percent_t IdleController::getOpenLoop(Phase phase, float rpm, float clt, SensorR
|
|||
return interpolateClamped(0, crankingValvePosition, 1, running, crankingTaperFraction);
|
||||
}
|
||||
|
||||
float IdleController::getIdleTimingAdjustment(int rpm) {
|
||||
float IdleController::getIdleTimingAdjustment(float rpm) {
|
||||
return getIdleTimingAdjustment(rpm, m_lastTargetRpm, m_lastPhase);
|
||||
}
|
||||
|
||||
float IdleController::getIdleTimingAdjustment(int rpm, int targetRpm, Phase phase) {
|
||||
float IdleController::getIdleTimingAdjustment(float rpm, float targetRpm, Phase phase) {
|
||||
// if not enabled, do nothing
|
||||
if (!engineConfiguration->useIdleTimingPidControl) {
|
||||
return 0;
|
||||
|
@ -218,7 +218,7 @@ static void undoIdleBlipIfNeeded() {
|
|||
/**
|
||||
* @return idle valve position percentage for automatic closed loop mode
|
||||
*/
|
||||
float IdleController::getClosedLoop(IIdleController::Phase phase, float tpsPos, int rpm, int targetRpm) {
|
||||
float IdleController::getClosedLoop(IIdleController::Phase phase, float tpsPos, float rpm, float targetRpm) {
|
||||
auto idlePid = getIdlePid();
|
||||
|
||||
if (shouldResetPid) {
|
||||
|
@ -256,7 +256,7 @@ float IdleController::getClosedLoop(IIdleController::Phase phase, float tpsPos,
|
|||
|
||||
bool acToggleJustTouched = engine->module<AcController>().unmock().timeSinceStateChange.getElapsedSeconds() < 0.5f /*second*/;
|
||||
// check if within the dead zone
|
||||
isInDeadZone = !acToggleJustTouched && absI(rpm - targetRpm) <= engineConfiguration->idlePidRpmDeadZone;
|
||||
isInDeadZone = !acToggleJustTouched && std::abs(rpm - targetRpm) <= engineConfiguration->idlePidRpmDeadZone;
|
||||
if (isInDeadZone) {
|
||||
idleState = RPM_DEAD_ZONE;
|
||||
// current RPM is close enough, no need to change anything
|
||||
|
|
|
@ -23,15 +23,15 @@ struct IIdleController {
|
|||
Running, // On throttle
|
||||
};
|
||||
|
||||
virtual Phase determinePhase(int rpm, int targetRpm, SensorResult tps, float vss, float crankingTaperFraction) = 0;
|
||||
virtual Phase determinePhase(float rpm, float targetRpm, SensorResult tps, float vss, float crankingTaperFraction) = 0;
|
||||
virtual int getTargetRpm(float clt) = 0;
|
||||
virtual float getCrankingOpenLoop(float clt) const = 0;
|
||||
virtual float getRunningOpenLoop(IIdleController::Phase phase, float rpm, float clt, SensorResult tps) = 0;
|
||||
virtual float getOpenLoop(Phase phase, float rpm, float clt, SensorResult tps, float crankingTaperFraction) = 0;
|
||||
virtual float getClosedLoop(Phase phase, float tps, int rpm, int target) = 0;
|
||||
virtual float getClosedLoop(Phase phase, float tps, float rpm, float target) = 0;
|
||||
virtual float getCrankingTaperFraction() const = 0;
|
||||
virtual bool isIdlingOrTaper() const = 0;
|
||||
virtual float getIdleTimingAdjustment(int rpm) = 0;
|
||||
virtual float getIdleTimingAdjustment(float rpm) = 0;
|
||||
};
|
||||
|
||||
class IdleController : public IIdleController, public EngineModule, public idle_state_s {
|
||||
|
@ -47,7 +47,7 @@ public:
|
|||
int getTargetRpm(float clt) override;
|
||||
|
||||
// PHASE DETERMINATION: what is the driver trying to do right now?
|
||||
Phase determinePhase(int rpm, int targetRpm, SensorResult tps, float vss, float crankingTaperFraction) override;
|
||||
Phase determinePhase(float rpm, float targetRpm, SensorResult tps, float vss, float crankingTaperFraction) override;
|
||||
float getCrankingTaperFraction() const override;
|
||||
|
||||
// OPEN LOOP CORRECTIONS
|
||||
|
@ -55,11 +55,11 @@ public:
|
|||
percent_t getRunningOpenLoop(IIdleController::Phase phase, float rpm, float clt, SensorResult tps) override;
|
||||
percent_t getOpenLoop(Phase phase, float rpm, float clt, SensorResult tps, float crankingTaperFraction) override;
|
||||
|
||||
float getIdleTimingAdjustment(int rpm) override;
|
||||
float getIdleTimingAdjustment(int rpm, int targetRpm, Phase phase);
|
||||
float getIdleTimingAdjustment(float rpm) override;
|
||||
float getIdleTimingAdjustment(float rpm, float targetRpm, Phase phase);
|
||||
|
||||
// CLOSED LOOP CORRECTION
|
||||
float getClosedLoop(IIdleController::Phase phase, float tpsPos, int rpm, int targetRpm) override;
|
||||
float getClosedLoop(IIdleController::Phase phase, float tpsPos, float rpm, float targetRpm) override;
|
||||
|
||||
void onConfigurationChange(engine_configuration_s const * previousConfig) final;
|
||||
void onSlowCallback() final;
|
||||
|
|
|
@ -56,7 +56,7 @@ void LimpManager::updateRevLimit(int rpm) {
|
|||
m_fuelCorrection = 1.0f + fuelAdded / 100;
|
||||
}
|
||||
|
||||
void LimpManager::updateState(int rpm, efitick_t nowNt) {
|
||||
void LimpManager::updateState(float rpm, efitick_t nowNt) {
|
||||
Clearable allowFuel = engineConfiguration->isInjectionEnabled;
|
||||
Clearable allowSpark = engineConfiguration->isIgnitionEnabled;
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
ShutdownController shutdownController;
|
||||
|
||||
// This is called from periodicFastCallback to update internal state
|
||||
void updateState(int rpm, efitick_t nowNt);
|
||||
void updateState(float rpm, efitick_t nowNt);
|
||||
|
||||
void onFastCallback() override;
|
||||
void onIgnitionStateChanged(bool ignitionOn) override;
|
||||
|
|
|
@ -127,15 +127,15 @@ public:
|
|||
MockIdleController();
|
||||
virtual ~MockIdleController();
|
||||
|
||||
MOCK_METHOD(IIdleController::Phase, determinePhase, (int rpm, int targetRpm, SensorResult tps, float vss, float crankingTaperFraction), (override));
|
||||
MOCK_METHOD(IIdleController::Phase, determinePhase, (float rpm, float targetRpm, SensorResult tps, float vss, float crankingTaperFraction), (override));
|
||||
MOCK_METHOD(int, getTargetRpm, (float clt), (override));
|
||||
MOCK_METHOD(float, getCrankingOpenLoop, (float clt), (const, override));
|
||||
MOCK_METHOD(float, getRunningOpenLoop, (IIdleController::Phase phase, float rpm, float clt, SensorResult tps), (override));
|
||||
MOCK_METHOD(float, getOpenLoop, (IIdleController::Phase phase, float rpm, float clt, SensorResult tps, float crankingTaperFraction), (override));
|
||||
MOCK_METHOD(float, getClosedLoop, (IIdleController::Phase phase, float tps, int rpm, int target), (override));
|
||||
MOCK_METHOD(float, getClosedLoop, (IIdleController::Phase phase, float tps, float rpm, float target), (override));
|
||||
MOCK_METHOD(float, getCrankingTaperFraction, (), (const, override));
|
||||
MOCK_METHOD(bool, isIdlingOrTaper, (), (const, override));
|
||||
MOCK_METHOD(float, getIdleTimingAdjustment, (int rpm), (override));
|
||||
MOCK_METHOD(float, getIdleTimingAdjustment, (float rpm), (override));
|
||||
};
|
||||
|
||||
class MockIgnitionController : public IgnitionController {
|
||||
|
|
|
@ -388,9 +388,9 @@ TEST(idle_v2, closedLoopDeadzone) {
|
|||
|
||||
struct IntegrationIdleMock : public IdleController {
|
||||
MOCK_METHOD(int, getTargetRpm, (float clt), (override));
|
||||
MOCK_METHOD(ICP, determinePhase, (int rpm, int targetRpm, SensorResult tps, float vss, float crankingTaperFraction), (override));
|
||||
MOCK_METHOD(ICP, determinePhase, (float rpm, float targetRpm, SensorResult tps, float vss, float crankingTaperFraction), (override));
|
||||
MOCK_METHOD(float, getOpenLoop, (ICP phase, float rpm, float clt, SensorResult tps, float crankingTaperFraction), (override));
|
||||
MOCK_METHOD(float, getClosedLoop, (ICP phase, float tps, int rpm, int target), (override));
|
||||
MOCK_METHOD(float, getClosedLoop, (ICP phase, float tps, float rpm, float target), (override));
|
||||
MOCK_METHOD(float, getCrankingTaperFraction, (), (const, override));
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue