auto-sync
This commit is contained in:
parent
f91f28723c
commit
f7712aec07
|
@ -376,7 +376,7 @@ static void handleFuelScheduleOverlap(InjectionEventList *injectionEvents DECLAR
|
|||
|
||||
static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIndex, int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#3");
|
||||
efiAssertVoid(trgEventIndex < ENGINE(triggerShape.getLength()), "handleFuel/event index");
|
||||
efiAssertVoid(trgEventIndex < engine->engineCycleEventCount, "handleFuel/event index");
|
||||
|
||||
if (!isInjectionEnabled(engineConfiguration) || limitedFuel) {
|
||||
return;
|
||||
|
@ -469,7 +469,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D
|
|||
}
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#2");
|
||||
|
||||
if (trgEventIndex >= ENGINE(triggerShape.getLength())) {
|
||||
if (trgEventIndex >= engine->engineCycleEventCount) {
|
||||
/**
|
||||
* this could happen in case of a trigger error, just exit silently since the trigger error is supposed to be handled already
|
||||
* todo: should this check be somewhere higher so that no trigger listeners are invoked with noise?
|
||||
|
|
|
@ -225,20 +225,33 @@ void TriggerState::resetCurrentCycleState() {
|
|||
currentCycle.current_index = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* physical primary trigger duration
|
||||
*/
|
||||
angle_t TriggerShape::getCycleDuration() const {
|
||||
switch (operationMode) {
|
||||
case FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR:
|
||||
return 180;
|
||||
case FOUR_STROKE_CRANK_SENSOR:
|
||||
case TWO_STROKE:
|
||||
return 360;
|
||||
default:
|
||||
return 720;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger event count equals engine cycle event count if we have a cam sensor.
|
||||
* 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 {
|
||||
// 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();
|
||||
}
|
||||
/**
|
||||
* 4 for FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR
|
||||
* 2 for FOUR_STROKE_CRANK_SENSOR
|
||||
* 1 otherwise
|
||||
*/
|
||||
int multiplier = getEngineCycle(operationMode) / getCycleDuration();
|
||||
return multiplier * getSize();
|
||||
}
|
||||
|
||||
angle_t TriggerShape::getAngle(int index) const {
|
||||
|
@ -366,18 +379,6 @@ void TriggerShape::addEvent2(angle_t angle, trigger_wheel_e const waveIndex, tri
|
|||
wave.waves[waveIndex].pinStates[index] = state;
|
||||
}
|
||||
|
||||
angle_t TriggerShape::getCycleDuration() const {
|
||||
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 {
|
||||
return getCycleDuration() * wave.getSwitchTime(index);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue