rusefi-1/firmware/controllers/algo/engine.h

52 lines
967 B
C
Raw Normal View History

2014-08-29 07:52:33 -07:00
/**
* @file engine.h
*
* @date May 21, 2014
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#ifndef ENGINE_H_
#define ENGINE_H_
#include "main.h"
#include "engine_configuration.h"
2014-09-26 11:06:01 -07:00
#include "ec2.h"
2014-08-29 07:52:33 -07:00
class EngineState {
public:
/**
* Access to these two fields is not synchronized in any way - that should work since float read/write are atomic.
*/
float iat;
float clt;
2014-09-26 11:06:01 -07:00
2014-08-29 07:52:33 -07:00
};
class RpmCalculator;
class Engine {
public:
2014-09-26 13:03:02 -07:00
void init();
2014-08-29 07:52:33 -07:00
RpmCalculator *rpmCalculator;
engine_configuration_s *engineConfiguration;
2014-09-26 11:06:01 -07:00
engine_configuration2_s *engineConfiguration2;
2014-08-29 07:52:33 -07:00
2014-09-26 13:03:02 -07:00
void onTriggerEvent(uint64_t nowUs);
2014-08-29 07:52:33 -07:00
EngineState engineState;
2014-09-26 13:03:02 -07:00
uint64_t lastTriggerEventTimeUs;
2014-08-29 07:52:33 -07:00
void updateSlowSensors();
2014-09-26 13:03:02 -07:00
void watchdog();
private:
/**
* By the way:
* 'cranking' means engine is not stopped and the rpm are below crankingRpm
* 'running' means RPM are above crankingRpm
* 'spinning' means the engine is not stopped
*/
bool isSpinning;
2014-08-29 07:52:33 -07:00
};
#endif /* ENGINE_H_ */