making new scheduling API avalable

This commit is contained in:
rusefi 2019-12-02 22:28:32 -05:00
parent 82fab0282c
commit d007a7f902
2 changed files with 14 additions and 6 deletions

View File

@ -5,7 +5,7 @@
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#include "global.h"
#include "spark_logic.h"
#include "os_access.h"
#include "engine_math.h"
@ -224,7 +224,11 @@ static bool assertNotInIgnitionList(AngleBasedEvent *head, AngleBasedEvent *elem
* @return true if event corresponds to current tooth and was time-based scheduler
* 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) {
bool scheduleOrQueue(AngleBasedEvent *event,
uint32_t trgEventIndex,
angle_t angle,
schfunc_t callback,
void *param DECLARE_ENGINE_PARAMETER_SUFFIX) {
event->position.setAngle(angle PASS_ENGINE_PARAMETER_SUFFIX);
/**
@ -240,7 +244,7 @@ static bool scheduleOrQueue(AngleBasedEvent *event, uint32_t trgEventIndex, angl
* time-based schedule. This case we would be firing events with best possible angle precision.
*
*/
if (event->position.triggerEventIndex == trgEventIndex) {
if (trgEventIndex != TRIGGER_EVENT_UNDEFINED && event->position.triggerEventIndex == trgEventIndex) {
/**
* Spark should be fired before the next trigger event - time-based delay is best precision possible
*/

View File

@ -5,8 +5,7 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef CONTROLLERS_TRIGGER_SPARK_LOGIC_H_
#define CONTROLLERS_TRIGGER_SPARK_LOGIC_H_
#pragma once
#include "engine.h"
@ -19,4 +18,9 @@ int getNumberOfSparks(ignition_mode_e mode DECLARE_ENGINE_PARAMETER_SUFFIX);
percent_t getCoilDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
void initializeIgnitionActions(DECLARE_ENGINE_PARAMETER_SIGNATURE);
#endif /* CONTROLLERS_TRIGGER_SPARK_LOGIC_H_ */
#define TRIGGER_EVENT_UNDEFINED -1
bool scheduleOrQueue(AngleBasedEvent *event,
uint32_t trgEventIndex,
angle_t angle,
schfunc_t callback,
void *param DECLARE_ENGINE_PARAMETER_SUFFIX);