auto-sync
This commit is contained in:
parent
00237d083d
commit
b41b708d81
|
@ -17,6 +17,7 @@ void setSachs(engine_configuration_s *engineConfiguration) {
|
|||
engineConfiguration->specs.cylindersCount = 1;
|
||||
engineConfiguration->engineCycle = 360;
|
||||
|
||||
// setOperationMode(engineConfiguration, TWO_STROKE);
|
||||
engineConfiguration->specs.firingOrder = FO_ONE_CYLINDER;
|
||||
|
||||
/**
|
||||
|
|
|
@ -286,6 +286,8 @@ case FOUR_STROKE_CAM_SENSOR:
|
|||
return "FOUR_STROKE_CAM_SENSOR";
|
||||
case FOUR_STROKE_CRANK_SENSOR:
|
||||
return "FOUR_STROKE_CRANK_SENSOR";
|
||||
case TWO_STROKE:
|
||||
return "TWO_STROKE";
|
||||
case Force_4b_operation_mode_e:
|
||||
return "Force_4b_operation_mode_e";
|
||||
case OM_NONE:
|
||||
|
|
|
@ -279,6 +279,7 @@ typedef enum {
|
|||
OM_NONE = 0,
|
||||
FOUR_STROKE_CRANK_SENSOR = 1,
|
||||
FOUR_STROKE_CAM_SENSOR = 2,
|
||||
TWO_STROKE = 3,
|
||||
|
||||
Force_4b_operation_mode_e = ENUM_32_BITS,
|
||||
} operation_mode_e;
|
||||
|
|
|
@ -165,8 +165,8 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index DECL
|
|||
if (diffNt == 0) {
|
||||
rpmState->setRpmValue(NOISY_RPM);
|
||||
} else {
|
||||
// todo: interesting what is this *2 about? four stroke magic constant?
|
||||
int rpm = (int) (60 * US2NT(US_PER_SECOND_LL) * 2 / diffNt);
|
||||
int mult = engineConfiguration->engineCycle / 360;
|
||||
int rpm = (int) (60 * US2NT(US_PER_SECOND_LL) * mult / diffNt);
|
||||
rpmState->setRpmValue(rpm > UNREALISTIC_RPM ? NOISY_RPM : rpm);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,6 +227,11 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, uint64_t now
|
|||
toothed_previous_time = nowNt;
|
||||
}
|
||||
|
||||
float getEngineCycle(operation_mode_e operationMode) {
|
||||
return operationMode == TWO_STROKE ? 360 : 720;
|
||||
}
|
||||
|
||||
|
||||
void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount,
|
||||
operation_mode_e operationMode) {
|
||||
efiAssertVoid(totalTeethCount > 0, "totalTeethCount is zero");
|
||||
|
@ -242,6 +247,8 @@ void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount,
|
|||
|
||||
float toothWidth = 0.5;
|
||||
|
||||
float engineCycle = getEngineCycle(operationMode);
|
||||
|
||||
for (int i = 0; i < totalTeethCount - skippedCount - 1; i++) {
|
||||
float angleDown = 720.0 / totalTeethCount * (i + toothWidth);
|
||||
float angleUp = 720.0 / totalTeethCount * (i + 1);
|
||||
|
|
Loading…
Reference in New Issue