fome-fw/firmware/controllers/algo/idle_controller.h

45 lines
897 B
C
Raw Normal View History

2014-08-29 07:52:33 -07:00
/**
* @file idle_controller.h
*
* @date May 22, 2013
2015-01-12 15:04:10 -08:00
* @author Andrey Belomutskiy, (c) 2012-2015
2014-08-29 07:52:33 -07:00
*/
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_
2015-01-01 11:03:23 -08:00
// 60% duty cycle by default
#define DEFAULT_IDLE_DUTY 60
2014-08-29 07:52:33 -07:00
2014-12-31 21:04:10 -08:00
#define IDLE_PERIOD 1000
2014-08-29 07:52:33 -07:00
2015-01-01 11:03:23 -08:00
// Percent values
#define MIN_IDLE 10.0f
#define MAX_IDLE 90.0f
#define IDLE_INCREASE_STEP 0.5f
#define IDLE_DECREASE_STEP 0.5f
#define IDLE_INCREASE_SMALL_STEP 0.1F
#define IDLE_DECREASE_SMALL_STEP 0.1F
2014-08-29 07:52:33 -07:00
2014-10-22 14:03:06 -07:00
class IdleValveState {
public:
2015-01-01 11:03:23 -08:00
IdleValveState();
void init(DECLARE_ENGINE_PARAMETER_F);
percent_t getIdle(int currentRpm, efitimems_t now DECLARE_ENGINE_PARAMETER_S);
2014-08-29 07:52:33 -07:00
int time;
int targetRpmRangeLeft, targetRpmRangeRight;
2015-01-01 11:03:23 -08:00
percent_t value;
2014-12-31 21:04:10 -08:00
efitimems_t timeOfLastIdleChange;
2014-10-22 14:03:06 -07:00
};
void setIdleRpm(IdleValveState *idle, int targetRpm);
2015-01-01 11:03:23 -08:00
void idleDebug(const char *msg, percent_t value);
2014-08-29 07:52:33 -07:00
#endif /* IDLE_CONTROLLER_H_ */