auto-sync

This commit is contained in:
rusEfi 2014-11-03 13:03:05 -06:00
parent a95756b068
commit 026881a972
4 changed files with 17 additions and 7 deletions

View File

@ -13,13 +13,11 @@ void configureNeon2003TriggerShape(trigger_shape_s *s) {
// voodoo magic - we always need 720 at the end
int base = 10;
s->useRiseEdge = true;
s->invertOnAdd = true;
s->gapBothDirections = true;
/**
* Theoretical gap is 4, but in reality it's
*/
setTriggerSynchronizationGap2(s, 2.7, 5);
setTriggerSynchronizationGap(s, 2.91);
s->addEvent(base + 26, T_PRIMARY, TV_HIGH);
s->addEvent(base + 62, T_PRIMARY, TV_LOW);

View File

@ -35,6 +35,8 @@ trigger_shape_s::trigger_shape_s() :
wave.waves = h.waves;
useRiseEdge = false;
gapBothDirections = false;
isSynchronizationNeeded = false;
invertOnAdd = false;
}
void trigger_shape_s::assignSize() {
@ -194,8 +196,16 @@ float trigger_shape_s::getAngle(int index) const {
}
}
void trigger_shape_s::addEvent(float angle, trigger_wheel_e const waveIndex, trigger_value_e const state) {
void trigger_shape_s::addEvent(float angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam) {
efiAssertVoid(operationMode != OM_NONE, "operationMode not set");
trigger_value_e state;
if (invertOnAdd) {
state = (stateParam == TV_LOW) ? TV_HIGH : TV_LOW;
} else {
state = stateParam;
}
/**
* While '720' value works perfectly it has not much sense for crank sensor-only scenario.
* todo: accept angle as a value in the 0..1 range?

View File

@ -29,7 +29,9 @@ public:
class trigger_shape_s {
public:
trigger_shape_s();
int isSynchronizationNeeded;
bool_t isSynchronizationNeeded;
bool_t invertOnAdd;
int totalToothCount;
int skippedToothCount;

View File

@ -531,7 +531,7 @@ void testTriggerDecoder(void) {
testTriggerDecoder2("citroen", CITROEN_TU3JP, 0, 0.4833, 0.0);
printGapRatio = true;
testTriggerDecoder2("neon NGC", DODGE_NEON_2003, 12, 0.5139, 0.0);
testTriggerDecoder2("neon NGC", DODGE_NEON_2003, 5, 0.4861, 0.0);
printGapRatio = false;
testMazda323();