auto-sync

This commit is contained in:
rusEfi 2016-11-14 00:02:13 -05:00
parent 163f72b0fe
commit f91f28723c
3 changed files with 24 additions and 10 deletions

View File

@ -51,7 +51,7 @@ void initializeMazdaMiataNaShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) {
}
void initializeMazdaMiataNb2Crank(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) {
s->initialize(FOUR_STROKE_CRANK_SENSOR, false);
s->initialize(FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR, false);
float o = 160;

View File

@ -230,7 +230,15 @@ void TriggerState::resetCurrentCycleState() {
* Two trigger cycles make one engine cycle in case of a four stroke engine If we only have a cranksensor.
*/
uint32_t TriggerShape::getLength() const {
return operationMode == FOUR_STROKE_CAM_SENSOR ? getSize() : 2 * getSize();
// todo: reduce magic constants, reuse getCycleDuration method
switch (operationMode) {
case FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR:
return 4 * getSize();
case FOUR_STROKE_CRANK_SENSOR:
return 2 * getSize();
default:
return getSize();
}
}
angle_t TriggerShape::getAngle(int index) const {
@ -244,13 +252,11 @@ angle_t TriggerShape::getAngle(int index) const {
* See also trigger_central.cpp
* See also getEngineCycleEventCount()
*/
int triggerEventCounter = size;
if (index < triggerEventCounter) {
return getSwitchAngle(index);
} else {
return 360 + getSwitchAngle(index - triggerEventCounter);
}
int crankCycle = index / size;
int remainder = index % size;
return getCycleDuration() * crankCycle + getSwitchAngle(remainder);
}
void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, trigger_value_e const stateParam, float filterLeft, float filterRight DECLARE_ENGINE_PARAMETER_S) {
@ -361,7 +367,15 @@ void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, tri
}
angle_t TriggerShape::getCycleDuration() const {
return (operationMode == FOUR_STROKE_CAM_SENSOR) ? 720 : 360;
switch (operationMode) {
case FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR:
return 180;
case FOUR_STROKE_CRANK_SENSOR:
case TWO_STROKE:
return 360;
default:
return 720;
}
}
angle_t TriggerShape::getSwitchAngle(int index) const {

View File

@ -290,5 +290,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array
return 20161104;
return 20161113;
}