2014-08-29 07:52:33 -07:00
|
|
|
|
/**
|
|
|
|
|
* @file idle_controller.h
|
|
|
|
|
*
|
|
|
|
|
* @date May 22, 2013
|
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2014
|
|
|
|
|
*/
|
|
|
|
|
|
2014-11-22 13:03:22 -08:00
|
|
|
|
#include "engine.h"
|
|
|
|
|
|
2014-08-29 07:52:33 -07:00
|
|
|
|
#ifndef IDLE_CONTROLLER_H_
|
|
|
|
|
#define IDLE_CONTROLLER_H_
|
|
|
|
|
|
2014-11-22 13:03:22 -08:00
|
|
|
|
// 600<30> duty cycle by default
|
2014-08-29 07:52:33 -07:00
|
|
|
|
#define DEFAULT_IDLE_DUTY 600
|
|
|
|
|
|
2014-12-31 21:04:10 -08:00
|
|
|
|
#define IDLE_PERIOD 1000
|
2014-08-29 07:52:33 -07:00
|
|
|
|
|
|
|
|
|
// Per mil (1/1000) values
|
|
|
|
|
#define MIN_IDLE 100
|
|
|
|
|
#define MAX_IDLE 900
|
|
|
|
|
#define IDLE_INCREASE_STEP 5
|
|
|
|
|
#define IDLE_DECREASE_STEP 5
|
|
|
|
|
|
2014-10-22 14:03:06 -07:00
|
|
|
|
class IdleValveState {
|
|
|
|
|
public:
|
2014-08-29 07:52:33 -07:00
|
|
|
|
int time;
|
|
|
|
|
|
|
|
|
|
int targetRpmRangeLeft, targetRpmRangeRight;
|
|
|
|
|
|
|
|
|
|
int value;
|
2014-12-31 21:04:10 -08:00
|
|
|
|
efitimems_t timeOfLastIdleChange;
|
2014-10-22 14:03:06 -07:00
|
|
|
|
};
|
|
|
|
|
|
2014-11-22 13:03:22 -08:00
|
|
|
|
void idleInit(IdleValveState *idle DECLARE_ENGINE_PARAMETER_S);
|
2014-12-31 21:04:10 -08:00
|
|
|
|
int getIdle(IdleValveState *idle, int currentRpm, efitimems_t now DECLARE_ENGINE_PARAMETER_S);
|
2014-10-22 14:03:06 -07:00
|
|
|
|
void setIdleRpm(IdleValveState *idle, int targetRpm);
|
|
|
|
|
|
|
|
|
|
void idleDebug(const char *msg, int value);
|
2014-08-29 07:52:33 -07:00
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
|
|
#endif /* IDLE_CONTROLLER_H_ */
|