mirror of https://github.com/rusefi/rusefi.git
basic harley acr (#48)
* acr * cleanup * handle m_hasPinMode * output channel * ui * wrap phase * don't inject during ACR * skip extra calculation --------- Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
parent
36afbe7e9a
commit
02f4a09d56
|
@ -0,0 +1,59 @@
|
|||
// Controller for Harley Davidson Automatic Compression Release
|
||||
//
|
||||
// To make the starter's job easier, these bike engines have a solenoid
|
||||
// that dumps cylinder pressure to atmosphere until the engine is spinning
|
||||
// fast enough to actually have a chance at starting.
|
||||
// We open the valve the instant the engine starts moving, then close it
|
||||
// once the specified number of revolutions have occured, plus some engine phase.
|
||||
// This allows the valve to close at just the right moment that you don't get a
|
||||
// weird half-charge if it closed mid way up on a compression stroke.
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
static bool getAcrState() {
|
||||
auto currentPhase = getTriggerCentral()->getCurrentEnginePhase(getTimeNowNt());
|
||||
if (!currentPhase) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Turn off the valve if the engine isn't moving - no sense wasting power on a stopped engine
|
||||
if (!getTriggerCentral()->engineMovedRecently()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int revCount = getTriggerCentral()->triggerState.getCrankSynchronizationCounter();
|
||||
if (revCount > engineConfiguration->acrRevolutions) {
|
||||
// Enough revs have elapsed that we're done with ACR
|
||||
return false;
|
||||
} else if (revCount == engineConfiguration->acrRevolutions) {
|
||||
float wrappedPhase = currentPhase.Value > 360 ? currentPhase.Value - 360 : currentPhase.Value;
|
||||
|
||||
// We're on the rev where ACR should be disabled part way through
|
||||
if (wrappedPhase > engineConfiguration->acrDisablePhase) {
|
||||
return false;
|
||||
} else {
|
||||
// Not enough phase elapsed, ACR still active
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// ACR active - not enough revs completed
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void HarleyAcr::onSlowCallback() {
|
||||
// skip if no pin
|
||||
if (!isBrainPinValid(engineConfiguration->acrPin)) {
|
||||
m_active = false;
|
||||
return;
|
||||
}
|
||||
|
||||
bool acrState = getAcrState();
|
||||
engine->outputChannels.acrActive = acrState;
|
||||
enginePins.harleyAcr.setValue(acrState);
|
||||
m_active = acrState;
|
||||
}
|
||||
|
||||
bool HarleyAcr::isActive() const {
|
||||
return m_active;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
class HarleyAcr : public EngineModule {
|
||||
public:
|
||||
void onSlowCallback() override;
|
||||
|
||||
bool isActive() const;
|
||||
|
||||
private:
|
||||
bool m_active = false;
|
||||
};
|
|
@ -39,6 +39,7 @@
|
|||
#include "boost_control.h"
|
||||
#include "ignition_controller.h"
|
||||
#include "alternator_controller.h"
|
||||
#include "harley_acr.h"
|
||||
#include "dfco.h"
|
||||
#include "fuel_computer.h"
|
||||
#include "gear_detector.h"
|
||||
|
@ -152,6 +153,7 @@ public:
|
|||
FanControl2,
|
||||
PrimeController,
|
||||
DfcoController,
|
||||
HarleyAcr,
|
||||
Mockable<WallFuelController>,
|
||||
#if EFI_VEHICLE_SPEED
|
||||
GearDetector,
|
||||
|
|
|
@ -15,6 +15,7 @@ CONTROLLERS_SRC_CPP = \
|
|||
$(CONTROLLERS_DIR)/actuators/dc_motors.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/fan_control.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/fuel_pump.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/harley_acr.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/idle_thread_io.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/idle_hardware.cpp \
|
||||
$(CONTROLLERS_DIR)/actuators/idle_thread.cpp \
|
||||
|
|
|
@ -73,6 +73,11 @@ void LimpManager::updateState(int rpm, efitick_t nowNt) {
|
|||
allowSpark.clear(ClearReason::Lua);
|
||||
}
|
||||
|
||||
// Don't inject fuel during Harley compression release - it sprays fuel everywhere
|
||||
if (engine->module<HarleyAcr>()->isActive()) {
|
||||
allowFuel.clear(ClearReason::ACR);
|
||||
}
|
||||
|
||||
|
||||
updateRevLimit(rpm);
|
||||
if (m_revLimitHysteresis.test(rpm, m_revLimit, resumeRpm)) {
|
||||
|
|
|
@ -141,6 +141,7 @@ EnginePins::EnginePins() :
|
|||
fanRelay2("Fan Relay 2", CONFIG_PIN_OFFSETS(fan2)),
|
||||
acRelay("A/C Relay", CONFIG_PIN_OFFSETS(acRelay)),
|
||||
fuelPumpRelay("Fuel pump Relay", CONFIG_PIN_OFFSETS(fuelPump)),
|
||||
harleyAcr("Harley ACR", CONFIG_OFFSET(acrPin)),
|
||||
boostPin("Boost", CONFIG_PIN_OFFSETS(boostControl)),
|
||||
idleSolenoidPin("Idle Valve", CONFIG_OFFSET2(idle, solenoidPin), CONFIG_OFFSET2(idle, solenoidPinMode)),
|
||||
secondIdleSolenoidPin("Idle Valve#2", CONFIG_OFFSET(secondSolenoidPin), CONFIG_OFFSET2(idle, solenoidPinMode)),
|
||||
|
|
|
@ -81,6 +81,7 @@ public:
|
|||
// see acRelayPin
|
||||
RegisteredOutputPin acRelay;
|
||||
RegisteredOutputPin fuelPumpRelay;
|
||||
RegisteredOutputPin harleyAcr;
|
||||
OutputPin o2heater;
|
||||
OutputPin luaOutputPins[LUA_PWM_COUNT];
|
||||
|
||||
|
|
Loading…
Reference in New Issue