auto-sync

This commit is contained in:
rusEfi 2014-11-25 08:03:01 -06:00
parent 217333941d
commit df006b2a02
7 changed files with 22 additions and 6 deletions

View File

@ -42,6 +42,7 @@ void Engine::onTriggerEvent(uint64_t nowNt) {
Engine::Engine() {
lastTriggerEventTimeNt = 0;
isCylinderCleanupMode = false;
engineCycleEventCount = 0;
}
void Engine::init() {

View File

@ -54,9 +54,23 @@ public:
*/
bool isCylinderCleanupMode;
/**
* pre-calculating this value is a performance optimization
*/
int engineCycleEventCount;
uint32_t beforeIgnitionMath;
uint32_t ignitionMathTime;
uint32_t time2;
uint32_t time3;
uint32_t time4;
uint32_t before2;
uint32_t before3;
uint32_t before4;
void updateSlowSensors();
void watchdog();

View File

@ -590,10 +590,11 @@ void applyNonPersistentConfiguration(Logging * logger, Engine *engine) {
firmwareError("triggerShape size is zero");
return;
}
if (engine->triggerShape.shaftPositionEventCount == 0) {
if (engine->triggerShape.getSize() == 0) {
firmwareError("shaftPositionEventCount is zero");
return;
}
engine->engineCycleEventCount = engine->triggerShape.getLength();
}
void prepareShapes(Engine *engine) {

View File

@ -162,7 +162,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, Engine *engine, e
}
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());
} else {

View File

@ -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
*/
return shaftPositionState->getCurrentIndex() >= triggerShape->shaftPositionEventCount - 1;
return shaftPositionState->getCurrentIndex() >= triggerShape->getSize() - 1;
}
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
nextTriggerEvent(triggerWheel, nowNt);
nextRevolution(triggerShape->shaftPositionEventCount, nowNt);
nextRevolution(triggerShape->getSize(), nowNt);
} else {
nextTriggerEvent(triggerWheel, nowNt);
}

View File

@ -177,7 +177,7 @@ void TriggerState::clear() {
}
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 {

View File

@ -265,5 +265,5 @@ int getRusEfiVersion(void) {
return 1; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE == 0)
return 1; // this is here to make the compiler happy about the unused array
return 20141124;
return 20141125;
}