2014-08-29 07:52:33 -07:00
|
|
|
/*
|
2014-12-31 22:03:31 -08:00
|
|
|
* @file test_idle_controller.cpp
|
2014-08-29 07:52:33 -07:00
|
|
|
*
|
2014-12-31 22:03:31 -08:00
|
|
|
* @date Oct 17, 2013
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2014
|
2014-08-29 07:52:33 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2015-01-01 11:03:23 -08:00
|
|
|
#include "idle_controller.h"
|
|
|
|
#include "efitime.h"
|
|
|
|
#include "engine_test_helper.h"
|
2014-08-29 07:52:33 -07:00
|
|
|
|
2015-01-01 11:03:23 -08:00
|
|
|
void idleDebug(const char *msg, percent_t value) {
|
2014-08-29 07:52:33 -07:00
|
|
|
printf("%s\r\n", msg);
|
|
|
|
}
|
2015-01-01 11:03:23 -08:00
|
|
|
|
|
|
|
static IdleValveState is;
|
|
|
|
|
|
|
|
void testIdleController(void) {
|
|
|
|
EngineTestHelper eth(FORD_INLINE_6_1995);
|
|
|
|
Engine *engine = ð.engine;
|
|
|
|
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
|
|
|
|
|
|
|
engineConfiguration->targetIdleRpm = 1200;
|
|
|
|
|
|
|
|
is.init(PASS_ENGINE_PARAMETER_F);
|
|
|
|
|
|
|
|
efitimems_t time = 0;
|
|
|
|
|
|
|
|
assertEquals(60, is.getIdle(900, time PASS_ENGINE_PARAMETER));
|
|
|
|
|
|
|
|
time += 2000;
|
|
|
|
assertEquals(60.5, is.getIdle(900, time PASS_ENGINE_PARAMETER));
|
|
|
|
|
|
|
|
time += 2000;
|
|
|
|
assertEquals(60.6, is.getIdle(1050, time PASS_ENGINE_PARAMETER));
|
|
|
|
}
|