rusefi/firmware/controllers/algo/ec2.h

74 lines
1.9 KiB
C
Raw Normal View History

2014-08-29 07:52:33 -07:00
/**
* @file ec2.h
*
* this is a mess because some code is still in C and some is
* already in C++. trigger structure is C++
* TODO: rename? merge? Do something with this file
*
* @date Apr 26, 2014
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#ifndef EC2_H_
#define EC2_H_
2014-11-12 13:05:43 -08:00
#include "global.h"
2014-08-29 07:52:33 -07:00
#include "engine_configuration.h"
#include "event_registry.h"
#include "trigger_structure.h"
2014-11-24 10:04:56 -08:00
#include "table_helper.h"
2014-08-29 07:52:33 -07:00
2014-11-07 06:03:03 -08:00
class FuelSchedule {
public:
2014-11-07 22:05:46 -08:00
FuelSchedule();
void clear();
2014-11-07 06:03:03 -08:00
ActuatorEventList events;
2014-11-07 09:03:10 -08:00
2014-11-25 10:03:01 -08:00
void addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_S);
2014-11-25 09:05:03 -08:00
void registerInjectionEvent(
2014-11-12 13:05:43 -08:00
io_pin_e pin, float angle, bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S);
2014-11-07 09:03:10 -08:00
2014-11-07 22:05:46 -08:00
uint8_t hasEvents[PWM_PHASE_MAX_COUNT];
2014-11-07 06:03:03 -08:00
};
2014-08-29 07:52:33 -07:00
/**
* this part of the structure is separate just because so far
* these fields are not integrated with Tuner Studio. Step by step :)
*/
class engine_configuration2_s {
// todo: move these fields into Engine class, eliminate this class
public:
engine_configuration2_s();
2014-10-31 12:03:00 -07:00
// todo: this should go, too
2014-10-31 11:05:18 -07:00
engine_configuration_s *engineConfiguration;
2014-11-07 06:03:03 -08:00
FuelSchedule crankingInjectionEvents;
FuelSchedule injectionEvents;
2014-12-04 19:03:19 -08:00
float fsioLastValue[LE_COMMAND_COUNT];
2014-11-24 10:04:56 -08:00
float sparkAtable[DWELL_CURVE_SIZE];
float sparkBtable[DWELL_CURVE_SIZE];
Table2D sparkTable;
void precalc();
2014-11-07 06:03:03 -08:00
/**
* We are alternating two event lists in order to avoid a potential issue around revolution boundary
* when an event is scheduled within the next revolution.
*/
IgnitionEventList ignitionEvents[2];
2014-11-28 20:03:26 -08:00
2014-12-04 12:03:27 -08:00
uint64_t stopEngineRequestTimeNt;
2014-08-29 07:52:33 -07:00
};
2014-11-07 21:07:22 -08:00
void initializeIgnitionActions(float advance, float dwellAngle,
2014-11-24 13:03:32 -08:00
IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S);
2014-08-29 07:52:33 -07:00
void setDefaultNonPersistentConfiguration(engine_configuration2_s *engineConfiguration2);
void printConfiguration(engine_configuration_s *engineConfiguration, engine_configuration2_s *engineConfiguration2);
#endif /* EC2_H_ */