mirror of https://github.com/FOME-Tech/fome-fw.git
hoist dwell check out of loop
This commit is contained in:
parent
7593cd61d4
commit
3fc42222cc
|
@ -312,11 +312,6 @@ static void scheduleSparkEvent(bool limitedSpark, IgnitionEvent *event,
|
|||
int rpm, efitick_t edgeTimestamp, float currentPhase, float nextPhase) {
|
||||
|
||||
angle_t sparkAngle = event->sparkAngle;
|
||||
const floatms_t dwellMs = engine->ignitionState.sparkDwell;
|
||||
if (std::isnan(dwellMs) || dwellMs <= 0) {
|
||||
warning(ObdCode::CUSTOM_DWELL, "invalid dwell to handle: %.2f at %d", dwellMs, rpm);
|
||||
return;
|
||||
}
|
||||
if (std::isnan(sparkAngle)) {
|
||||
warning(ObdCode::CUSTOM_ADVANCE_SPARK, "NaN advance");
|
||||
return;
|
||||
|
@ -457,6 +452,12 @@ void onTriggerEventSparkLogic(int rpm, efitick_t edgeTimestamp, float currentPha
|
|||
engine->outputChannels.sparkCutReason = (int8_t)limitedSparkState.reason;
|
||||
bool limitedSpark = !limitedSparkState.value;
|
||||
|
||||
const floatms_t dwellMs = engine->ignitionState.sparkDwell;
|
||||
if (std::isnan(dwellMs) || dwellMs <= 0) {
|
||||
warning(ObdCode::CUSTOM_DWELL, "invalid dwell to handle: %.2f at %d", dwellMs, rpm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!engine->ignitionEvents.isReady) {
|
||||
prepareIgnitionSchedule();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue