auto-sync
This commit is contained in:
parent
423b838d2b
commit
39fd428e0d
|
@ -11,23 +11,7 @@
|
|||
#include "global.h"
|
||||
#include "signal_executor.h"
|
||||
#include "fl_stack.h"
|
||||
|
||||
/**
|
||||
* This structure defines an angle position within the trigger
|
||||
*/
|
||||
class event_trigger_position_s {
|
||||
public:
|
||||
event_trigger_position_s();
|
||||
/**
|
||||
* That's trigger event index
|
||||
*/
|
||||
uint32_t eventIndex;
|
||||
angle_t eventAngle;
|
||||
/**
|
||||
* Angle offset from the trigger event
|
||||
*/
|
||||
angle_t angleOffset;
|
||||
};
|
||||
#include "trigger_structure.h"
|
||||
|
||||
class Engine;
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ void FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_S) {
|
|||
|
||||
efiAssertVoid(TRIGGER_SHAPE(getSize()) > 0, "uninitialized TriggerShape");
|
||||
|
||||
findTriggerPosition(&ev->injectionStart, angle PASS_ENGINE_PARAMETER);
|
||||
TRIGGER_SHAPE(findTriggerPosition(&ev->injectionStart, angle PASS_ENGINE_PARAMETER));
|
||||
#if EFI_UNIT_TEST
|
||||
printf("registerInjectionEvent angle=%f trgIndex=%d inj %d\r\n", angle, ev->injectionStart.eventIndex, index);
|
||||
#endif
|
||||
|
@ -255,13 +255,13 @@ static int findAngleIndex(float target DECLARE_ENGINE_PARAMETER_S) {
|
|||
|
||||
}
|
||||
|
||||
void findTriggerPosition(event_trigger_position_s *position, angle_t angleOffset DECLARE_ENGINE_PARAMETER_S) {
|
||||
void TriggerShape::findTriggerPosition(event_trigger_position_s *position, angle_t angleOffset DECLARE_ENGINE_PARAMETER_S) {
|
||||
// convert engine cycle angle into trigger cycle angle
|
||||
angleOffset += tdcPosition();
|
||||
fixAngle(angleOffset, "addFuel#2");
|
||||
|
||||
int index = TRIGGER_SHAPE(triggerIndexByAngle[(int)angleOffset]);
|
||||
angle_t eventAngle = TRIGGER_SHAPE(eventAngles[index]);
|
||||
int index = triggerIndexByAngle[(int)angleOffset];
|
||||
angle_t eventAngle = eventAngles[index];
|
||||
if (angleOffset < eventAngle) {
|
||||
warning(CUSTOM_OBD_ANGLE_CONSTRAINT_VIOLATION, "angle constraint violation in findTriggerPosition(): %f/%f", angleOffset, eventAngle);
|
||||
return;
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
void setAlgorithm(engine_load_mode_e algo DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
void findTriggerPosition(
|
||||
event_trigger_position_s *position, angle_t angleOffset DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
#if EFI_ENABLE_ASSERTS
|
||||
#define assertAngleRange(angle, msg) if(angle > 10000000 || angle < -10000000) { firmwareError(OBD_PCM_Processor_Fault, "angle range %s %f", msg, angle);angle = 0;}
|
||||
|
|
|
@ -174,7 +174,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
|||
* Spark event is often happening during a later trigger event timeframe
|
||||
* TODO: improve precision
|
||||
*/
|
||||
findTriggerPosition(&iEvent->sparkPosition, iEvent->advance PASS_ENGINE_PARAMETER);
|
||||
TRIGGER_SHAPE(findTriggerPosition(&iEvent->sparkPosition, iEvent->advance PASS_ENGINE_PARAMETER));
|
||||
|
||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||
printf("spark dwell@ %d/%d spark@ %d/%d id=%d\r\n", iEvent->dwellPosition.eventIndex, (int)iEvent->dwellPosition.angleOffset,
|
||||
|
@ -245,7 +245,7 @@ void prepareIgnitionSchedule(IgnitionEvent *event DECLARE_ENGINE_PARAMETER_S) {
|
|||
event->outputs[1] = secondOutput;
|
||||
event->advance = localAdvance;
|
||||
|
||||
findTriggerPosition(&event->dwellPosition, localAdvance - dwellAngle PASS_ENGINE_PARAMETER);
|
||||
TRIGGER_SHAPE(findTriggerPosition(&event->dwellPosition, localAdvance - dwellAngle PASS_ENGINE_PARAMETER));
|
||||
|
||||
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
|
||||
printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.eventIndex);
|
||||
|
|
|
@ -14,6 +14,23 @@
|
|||
#include "EfiWave.h"
|
||||
#include "engine_configuration.h"
|
||||
|
||||
/**
|
||||
* This structure defines an angle position within the trigger
|
||||
*/
|
||||
class event_trigger_position_s {
|
||||
public:
|
||||
event_trigger_position_s();
|
||||
/**
|
||||
* That's trigger event index
|
||||
*/
|
||||
uint32_t eventIndex;
|
||||
angle_t eventAngle;
|
||||
/**
|
||||
* Angle offset from the trigger event
|
||||
*/
|
||||
angle_t angleOffset;
|
||||
};
|
||||
|
||||
#define TRIGGER_CHANNEL_COUNT 3
|
||||
|
||||
class trigger_shape_helper {
|
||||
|
@ -35,6 +52,8 @@ class TriggerShape {
|
|||
public:
|
||||
TriggerShape();
|
||||
void initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_S);
|
||||
void findTriggerPosition(
|
||||
event_trigger_position_s *position, angle_t angleOffset DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
bool isSynchronizationNeeded;
|
||||
bool needSecondTriggerInput;
|
||||
|
|
Loading…
Reference in New Issue