rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
harley_acr.cpp
Go to the documentation of this file.
1// Controller for Harley Davidson Automatic Compression Release
2//
3// To make the starter's job easier, these bike engines have a solenoid
4// that dumps cylinder pressure to atmosphere until the engine is spinning
5// fast enough to actually have a chance at starting.
6// We open the valve the instant the engine starts moving, then close it
7// once the specified number of revolutions have occurred, plus some engine phase.
8// This allows the valve to close at just the right moment that you don't get a
9// weird half-charge if it closed mid way up on a compression stroke.
10
11#include "pch.h"
12
13#if EFI_HD_ACR
14
15static bool getAcrState() {
16 bool engineMovedRecently = getTriggerCentral()->engineMovedRecently();
17 engine->engineState.acrEngineMovedRecently = engineMovedRecently;
19 if (!currentPhase) {
20 return engineMovedRecently;
21 }
22
23 // Turn off the valve if the engine isn't moving - no sense wasting power on a stopped engine
24 if (!engineMovedRecently) {
25 return false;
26 }
27
29 if (revCount > engineConfiguration->acrRevolutions) {
30 // Enough revs have elapsed that we're done with ACR
31 return false;
32 } else if (revCount == engineConfiguration->acrRevolutions) {
33 float wrappedPhase = currentPhase.Value > 360 ? currentPhase.Value - 360 : currentPhase.Value;
34
35 // We're on the rev where ACR should be disabled part way through
36 if (wrappedPhase > engineConfiguration->acrDisablePhase) {
37 return false;
38 } else {
39 // Not enough phase elapsed, ACR still active
40 return true;
41 }
42 } else {
43 // ACR active - not enough revs completed
44 return true;
45 }
46}
47
49 // skip if no pin
51 m_active = false;
52 return;
53 }
54
55 bool acrState = getAcrState();
56 engine->engineState.acrActive = acrState;
59 m_active = acrState;
60}
61
65
66bool HarleyAcr::isActive() const {
67 return m_active;
68}
69
70#endif // EFI_HD_ACR
EngineState engineState
Definition engine.h:344
RegisteredOutputPin harleyAcr2
Definition efi_gpio.h:96
RegisteredNamedOutputPin harleyAcr
Definition efi_gpio.h:95
void onSlowCallback() override
bool m_active
Definition harley_acr.h:11
void updateAcr()
bool isActive() const
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition efi_gpio.cpp:604
PrimaryTriggerDecoder triggerState
bool engineMovedRecently(efitick_t nowNt) const
expected< float > getCurrentEnginePhase(efitick_t nowNt) const
int getSynchronizationCounter() const
EnginePins enginePins
Definition efi_gpio.cpp:24
efitick_t getTimeNowNt()
Definition efitime.cpp:19
TriggerCentral * getTriggerCentral()
Definition engine.cpp:590
static EngineAccessor engine
Definition engine.h:413
static constexpr engine_configuration_s * engineConfiguration
static bool getAcrState()
bool isBrainPinValid(brain_pin_e brainPin)