auto-sync
This commit is contained in:
parent
dc0822b74a
commit
cebb1c13bb
|
@ -42,6 +42,7 @@ void Engine::onTriggerEvent(uint64_t nowNt) {
|
||||||
Engine::Engine() {
|
Engine::Engine() {
|
||||||
lastTriggerEventTimeNt = 0;
|
lastTriggerEventTimeNt = 0;
|
||||||
isCylinderCleanupMode = false;
|
isCylinderCleanupMode = false;
|
||||||
|
engineCycleEventCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::init() {
|
void Engine::init() {
|
||||||
|
|
|
@ -54,9 +54,23 @@ public:
|
||||||
*/
|
*/
|
||||||
bool isCylinderCleanupMode;
|
bool isCylinderCleanupMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pre-calculating this value is a performance optimization
|
||||||
|
*/
|
||||||
|
int engineCycleEventCount;
|
||||||
|
|
||||||
uint32_t beforeIgnitionMath;
|
uint32_t beforeIgnitionMath;
|
||||||
uint32_t ignitionMathTime;
|
uint32_t ignitionMathTime;
|
||||||
|
|
||||||
|
uint32_t time2;
|
||||||
|
uint32_t time3;
|
||||||
|
uint32_t time4;
|
||||||
|
|
||||||
|
uint32_t before2;
|
||||||
|
uint32_t before3;
|
||||||
|
uint32_t before4;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void updateSlowSensors();
|
void updateSlowSensors();
|
||||||
void watchdog();
|
void watchdog();
|
||||||
|
|
|
@ -590,10 +590,11 @@ void applyNonPersistentConfiguration(Logging * logger, Engine *engine) {
|
||||||
firmwareError("triggerShape size is zero");
|
firmwareError("triggerShape size is zero");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (engine->triggerShape.shaftPositionEventCount == 0) {
|
if (engine->triggerShape.getSize() == 0) {
|
||||||
firmwareError("shaftPositionEventCount is zero");
|
firmwareError("shaftPositionEventCount is zero");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
engine->engineCycleEventCount = engine->triggerShape.getLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepareShapes(Engine *engine) {
|
void prepareShapes(Engine *engine) {
|
||||||
|
|
|
@ -162,7 +162,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, Engine *engine, e
|
||||||
}
|
}
|
||||||
reportEventToWaveChart(signal, triggerIndexForListeners);
|
reportEventToWaveChart(signal, triggerIndexForListeners);
|
||||||
|
|
||||||
if (triggerState.getCurrentIndex() >= engine->triggerShape.shaftPositionEventCount) {
|
if (triggerState.getCurrentIndex() >= engine->triggerShape.getSize()) {
|
||||||
warning(OBD_PCM_Processor_Fault, "unexpected eventIndex=%d", triggerState.getCurrentIndex());
|
warning(OBD_PCM_Processor_Fault, "unexpected eventIndex=%d", triggerState.getCurrentIndex());
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ static ALWAYS_INLINE bool noSynchronizationResetNeeded(TriggerState *shaftPositi
|
||||||
/**
|
/**
|
||||||
* in case of noise the counter could be above the expected number of events
|
* in case of noise the counter could be above the expected number of events
|
||||||
*/
|
*/
|
||||||
return shaftPositionState->getCurrentIndex() >= triggerShape->shaftPositionEventCount - 1;
|
return shaftPositionState->getCurrentIndex() >= triggerShape->getSize() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
float TriggerState::getTriggerDutyCycle(int index) {
|
float TriggerState::getTriggerDutyCycle(int index) {
|
||||||
|
@ -178,7 +178,7 @@ void TriggerState::decodeTriggerEvent(trigger_shape_s const*triggerShape, trigge
|
||||||
// this call would update duty cycle values
|
// this call would update duty cycle values
|
||||||
nextTriggerEvent(triggerWheel, nowNt);
|
nextTriggerEvent(triggerWheel, nowNt);
|
||||||
|
|
||||||
nextRevolution(triggerShape->shaftPositionEventCount, nowNt);
|
nextRevolution(triggerShape->getSize(), nowNt);
|
||||||
} else {
|
} else {
|
||||||
nextTriggerEvent(triggerWheel, nowNt);
|
nextTriggerEvent(triggerWheel, nowNt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ void TriggerState::clear() {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t trigger_shape_s::getLength() const {
|
uint32_t trigger_shape_s::getLength() const {
|
||||||
return operationMode == FOUR_STROKE_CAM_SENSOR ? shaftPositionEventCount : 2 * shaftPositionEventCount;
|
return operationMode == FOUR_STROKE_CAM_SENSOR ? getSize() : 2 * getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
float trigger_shape_s::getAngle(int index) const {
|
float trigger_shape_s::getAngle(int index) const {
|
||||||
|
|
|
@ -265,5 +265,5 @@ int getRusEfiVersion(void) {
|
||||||
return 1; // this is here to make the compiler happy about the unused array
|
return 1; // this is here to make the compiler happy about the unused array
|
||||||
if (UNUSED_CCM_SIZE == 0)
|
if (UNUSED_CCM_SIZE == 0)
|
||||||
return 1; // this is here to make the compiler happy about the unused array
|
return 1; // this is here to make the compiler happy about the unused array
|
||||||
return 20141124;
|
return 20141125;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue