refactoring - magic constant bad
This commit is contained in:
parent
fd28e82f73
commit
5ddd516860
|
@ -629,7 +629,8 @@ static void updateFuelInfo() {
|
||||||
|
|
||||||
static void updateIgnition(int rpm) {
|
static void updateIgnition(int rpm) {
|
||||||
float timing = engine->engineState.timingAdvance;
|
float timing = engine->engineState.timingAdvance;
|
||||||
tsOutputChannels.ignitionAdvance = timing > 360 ? timing - 720 : timing;
|
// that's weird logic. also seems broken for two stroke?
|
||||||
|
tsOutputChannels.ignitionAdvance = timing > FOUR_STROKE_CYCLE_DURATION / 2 ? timing - FOUR_STROKE_CYCLE_DURATION : timing;
|
||||||
// 60
|
// 60
|
||||||
tsOutputChannels.sparkDwell = ENGINE(engineState.sparkDwell);
|
tsOutputChannels.sparkDwell = ENGINE(engineState.sparkDwell);
|
||||||
|
|
||||||
|
|
|
@ -424,8 +424,8 @@ ignition_mode_e getCurrentIgnitionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
ENGINE(engineCycle) = getEngineCycle(engine->getOperationMode(PASS_ENGINE_PARAMETER_SIGNATURE));
|
ENGINE(engineCycle) = getEngineCycle(engine->getOperationMode(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||||
|
|
||||||
angle_t maxTimingCorrMap = -720.0f;
|
angle_t maxTimingCorrMap = -FOUR_STROKE_CYCLE_DURATION;
|
||||||
angle_t maxTimingMap = -720.0f;
|
angle_t maxTimingMap = -FOUR_STROKE_CYCLE_DURATION;
|
||||||
for (int rpmIndex = 0;rpmIndex<IGN_RPM_COUNT;rpmIndex++) {
|
for (int rpmIndex = 0;rpmIndex<IGN_RPM_COUNT;rpmIndex++) {
|
||||||
for (int l = 0;l<IGN_LOAD_COUNT;l++) {
|
for (int l = 0;l<IGN_LOAD_COUNT;l++) {
|
||||||
maxTimingCorrMap = maxF(maxTimingCorrMap, config->ignitionIatCorrTable[l][rpmIndex]);
|
maxTimingCorrMap = maxF(maxTimingCorrMap, config->ignitionIatCorrTable[l][rpmIndex]);
|
||||||
|
|
|
@ -341,7 +341,7 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECL
|
||||||
|
|
||||||
if (index != 0) {
|
if (index != 0) {
|
||||||
// todo: only assign initial position of not first cam once cam was synchronized
|
// todo: only assign initial position of not first cam once cam was synchronized
|
||||||
tc->vvtPosition[bankIndex][camIndex] = wrapVvt(vvtPosition, 720);
|
tc->vvtPosition[bankIndex][camIndex] = wrapVvt(vvtPosition, FOUR_STROKE_CYCLE_DURATION);
|
||||||
// at the moment we use only primary VVT to sync crank phase
|
// at the moment we use only primary VVT to sync crank phase
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECL
|
||||||
// vvtPosition was calculated against wrong crank zero position. Now that we have adjusted crank position we
|
// vvtPosition was calculated against wrong crank zero position. Now that we have adjusted crank position we
|
||||||
// shall adjust vvt position as well
|
// shall adjust vvt position as well
|
||||||
vvtPosition -= crankOffset;
|
vvtPosition -= crankOffset;
|
||||||
vvtPosition = wrapVvt(vvtPosition, 720);
|
vvtPosition = wrapVvt(vvtPosition, FOUR_STROKE_CYCLE_DURATION);
|
||||||
|
|
||||||
// this could be just an 'if' but let's have it expandable for future use :)
|
// this could be just an 'if' but let's have it expandable for future use :)
|
||||||
switch(engineConfiguration->vvtMode[camIndex]) {
|
switch(engineConfiguration->vvtMode[camIndex]) {
|
||||||
|
|
Loading…
Reference in New Issue