improving API?

This commit is contained in:
rusefi 2019-11-24 00:15:44 -05:00
parent 1cb2f92142
commit 6f50cae286
4 changed files with 10 additions and 3 deletions

View File

@ -213,7 +213,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(angle), "findAngle#3", false);
assertAngleRange(angle, "findAngle#a33", CUSTOM_ERR_6544);
TRIGGER_SHAPE(findTriggerPosition(&ev->injectionStart, angle PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
ev->injectionStart.setAngle(angle PASS_ENGINE_PARAMETER_SUFFIX);
#if EFI_UNIT_TEST
printf("registerInjectionEvent angle=%.2f trgIndex=%d inj %d\r\n", angle, ev->injectionStart.triggerEventIndex, injectorIndex);
#endif

View File

@ -44,6 +44,11 @@
#include "engine_configuration.h"
extern persistent_config_container_s persistentState;
EXTERN_ENGINE;
void event_trigger_position_s::setAngle(angle_t angle DECLARE_ENGINE_PARAMETER_SUFFIX) {
TRIGGER_SHAPE(findTriggerPosition(this, angle PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
}
trigger_shape_helper::trigger_shape_helper() {
memset(&pinStates, 0, sizeof(pinStates));

View File

@ -49,6 +49,8 @@ public:
uint32_t triggerEventIndex = 0;
angle_t angleOffsetFromTriggerEvent = 0;
void setAngle(angle_t angle DECLARE_ENGINE_PARAMETER_SUFFIX);
};
#define TRIGGER_CHANNEL_COUNT 3

View File

@ -113,7 +113,7 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_
angle_t dwellStartAngle = sparkAngle - dwellAngleDuration;
efiAssertVoid(CUSTOM_ERR_6590, !cisnan(dwellStartAngle), "findAngle#5");
assertAngleRange(dwellStartAngle, "findAngle#a6", CUSTOM_ERR_6550);
TRIGGER_SHAPE(findTriggerPosition(&event->dwellPosition, dwellStartAngle PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
event->dwellPosition.setAngle(dwellStartAngle PASS_ENGINE_PARAMETER_SUFFIX);
#if FUEL_MATH_EXTREME_LOGGING
printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.triggerEventIndex);
@ -225,7 +225,7 @@ static bool assertNotInIgnitionList(AngleBasedEvent *head, AngleBasedEvent *elem
* false if event was put into queue for scheduling at a later tooth
*/
static bool scheduleOrQueue(AngleBasedEvent *event, uint32_t trgEventIndex, angle_t angle, schfunc_t callback, void *param DECLARE_ENGINE_PARAMETER_SUFFIX) {
TRIGGER_SHAPE(findTriggerPosition(&event->position, angle PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset)));
event->position.setAngle(angle PASS_ENGINE_PARAMETER_SUFFIX);
/**
* todo: extract a "scheduleForAngle" method with best implementation into a separate utility method