rusefi/unit_tests/tests/test_trigger_decoder.cpp

1277 lines
48 KiB
C++
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file test_trigger_decoder.cpp
*
* @date Dec 24, 2013
2018-01-20 17:42:19 -08:00
* @author Andrey Belomutskiy, (c) 2012-2018
2015-07-10 06:01:56 -07:00
*/
2018-09-16 19:39:46 -07:00
#include "global.h"
#include "engine_test_helper.h"
2015-07-10 06:01:56 -07:00
#include "trigger_decoder.h"
#include "engine_math.h"
2016-08-26 16:02:56 -07:00
#include "allsensors.h"
2015-07-10 06:01:56 -07:00
#include "ford_aspire.h"
#include "dodge_neon.h"
#include "ford_1995_inline_6.h"
#include "mazda_323.h"
#include "rpm_calculator.h"
#include "event_queue.h"
#include "algo.h"
#include "trigger_mazda.h"
#include "trigger_chrysler.h"
2016-01-31 18:02:03 -08:00
#include "tps.h"
2015-07-10 06:01:56 -07:00
#include "trigger_central.h"
#include "main_trigger_callback.h"
#include "engine.h"
#include "advance_map.h"
#include "speed_density.h"
2016-08-26 16:02:56 -07:00
#include "fuel_math.h"
2016-09-21 20:03:22 -07:00
#include "spark_logic.h"
2017-01-03 14:01:42 -08:00
#include "trigger_universal.h"
2015-07-10 06:01:56 -07:00
2019-01-10 22:18:35 -08:00
extern float mockMapValue;
2016-08-26 16:02:56 -07:00
extern float testMafValue;
extern WarningCodeState unitTestWarningCodeState;
2015-07-10 06:01:56 -07:00
extern bool printTriggerDebug;
extern float actualSynchGap;
extern "C" {
void sendOutConfirmation(char *value, int i);
}
void sendOutConfirmation(char *value, int i) {
// test implementation
}
2017-03-01 19:25:00 -08:00
static int getTriggerZeroEventIndex(engine_type_e engineType) {
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(engineType);
2015-07-10 06:01:56 -07:00
2017-05-15 20:28:49 -07:00
initDataStructures(PASS_ENGINE_PARAMETER_SIGNATURE);
2015-07-10 06:01:56 -07:00
2017-03-01 19:18:25 -08:00
TriggerShape * shape = &eth.engine.triggerCentral.triggerShape;
2017-05-15 20:28:49 -07:00
return findTriggerZeroEventIndex(&eth.engine.triggerCentral.triggerState, shape, &engineConfiguration->trigger PASS_ENGINE_PARAMETER_SUFFIX);
2015-07-10 06:01:56 -07:00
}
static void testDodgeNeonDecoder(void) {
2017-03-04 17:52:24 -08:00
printf("*************************************************** testDodgeNeonDecoder95\r\n");
2015-07-10 06:01:56 -07:00
initTriggerDecoder();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 8, getTriggerZeroEventIndex(DODGE_NEON_1995)) << "DODGE_NEON_1995: trigger zero index";
2015-07-10 06:01:56 -07:00
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(DODGE_NEON_1995);
2015-07-10 06:01:56 -07:00
2017-03-01 19:18:25 -08:00
TriggerShape * shape = &eth.engine.triggerCentral.triggerShape;
2019-01-14 12:45:35 -08:00
ASSERT_EQ(8, shape->getTriggerShapeSynchPointIndex());
2015-07-10 06:01:56 -07:00
TriggerState state;
2019-01-14 16:02:36 -08:00
ASSERT_FALSE(state.shaft_is_synchronized) << "1 shaft_is_synchronized";
2015-07-10 06:01:56 -07:00
// int r = 0;
2016-02-27 20:03:34 -08:00
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 60);
2019-01-14 16:02:36 -08:00
// ASSERT_FALSE(state.shaft_is_synchronized) << "2 shaft_is_synchronized"; // still no synchronization
2015-07-10 06:01:56 -07:00
2016-02-27 20:03:34 -08:00
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 210);
2019-01-14 16:02:36 -08:00
// ASSERT_FALSE(state.shaft_is_synchronized) << "3 shaft_is_synchronized"; // still no synchronization
2015-07-10 06:01:56 -07:00
//
2016-02-27 20:03:34 -08:00
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 420);
2019-01-14 16:02:36 -08:00
// ASSERT_FALSE(state.shaft_is_synchronized) << "4 shaft_is_synchronized"; // still no synchronization
2015-07-10 06:01:56 -07:00
//
2016-02-27 20:03:34 -08:00
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 630);
2019-01-14 12:37:05 -08:00
// ASSERT_FALSE(state.shaft_is_synchronized); // still no synchronization
2015-07-10 06:01:56 -07:00
//
// printf("2nd camshaft revolution\r\n");
// r = 720;
2016-02-27 20:03:34 -08:00
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 60);
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 210);
2019-01-14 12:37:05 -08:00
// ASSERT_TRUE(state.shaft_is_synchronized);
2019-01-14 12:45:35 -08:00
// ASSERT_EQ(0, state.current_index);
2016-02-27 20:03:34 -08:00
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 420);
2019-01-14 12:45:35 -08:00
// ASSERT_EQ(1, state.current_index);
2016-02-27 20:03:34 -08:00
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 630);
2019-01-14 12:45:35 -08:00
// ASSERT_EQ(2, state.current_index);
2015-07-10 06:01:56 -07:00
//
// printf("3rd camshaft revolution\r\n");
// r = 2 * 720;
2016-02-27 20:03:34 -08:00
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 60);
2019-01-14 15:38:20 -08:00
// ASSERT_EQ( 3, state.current_index) << "current index";
2016-02-27 20:03:34 -08:00
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 210);
2019-01-14 12:37:05 -08:00
// ASSERT_TRUE(state.shaft_is_synchronized);
2019-01-14 15:38:20 -08:00
// ASSERT_EQ( 0, state.current_index) << "current index";
2016-02-27 20:03:34 -08:00
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 420);
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 630);
2015-07-10 06:01:56 -07:00
}
static void assertTriggerPosition(event_trigger_position_s *position, int eventIndex, float angleOffset) {
assertEqualsM("eventIndex", eventIndex, position->eventIndex);
assertEqualsM("angleOffset", angleOffset, position->angleOffset);
}
2019-01-14 12:31:56 -08:00
TEST(misc, testSomethingWeird) {
2018-07-29 07:27:23 -07:00
printf("*************************************************** testSomethingWeird\r\n");
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
2018-07-29 07:27:23 -07:00
TriggerState state_;
TriggerState *sta = &state_;
2019-01-14 16:02:36 -08:00
ASSERT_FALSE(sta->shaft_is_synchronized) << "shaft_is_synchronized";
2018-07-29 07:27:23 -07:00
int r = 10;
sta->decodeTriggerEvent(SHAFT_PRIMARY_FALLING, r PASS_ENGINE_PARAMETER_SUFFIX);
2019-01-14 16:02:36 -08:00
ASSERT_FALSE(sta->shaft_is_synchronized) << "shaft_is_synchronized"; // still no synchronization
2018-07-29 07:27:23 -07:00
sta->decodeTriggerEvent(SHAFT_PRIMARY_RISING, ++r PASS_ENGINE_PARAMETER_SUFFIX);
2019-01-14 12:37:05 -08:00
ASSERT_TRUE(sta->shaft_is_synchronized); // first signal rise synchronize
2019-01-14 12:45:35 -08:00
ASSERT_EQ(0, sta->getCurrentIndex());
2018-07-29 07:27:23 -07:00
sta->decodeTriggerEvent(SHAFT_PRIMARY_FALLING, r++ PASS_ENGINE_PARAMETER_SUFFIX);
2019-01-14 12:45:35 -08:00
ASSERT_EQ(1, sta->getCurrentIndex());
2018-07-29 07:27:23 -07:00
for (int i = 2; i < 10;) {
sta->decodeTriggerEvent(SHAFT_PRIMARY_RISING, r++ PASS_ENGINE_PARAMETER_SUFFIX);
assertEqualsM("even", i++, sta->getCurrentIndex());
sta->decodeTriggerEvent(SHAFT_PRIMARY_FALLING, r++ PASS_ENGINE_PARAMETER_SUFFIX);
assertEqualsM("odd", i++, sta->getCurrentIndex());
}
sta->decodeTriggerEvent(SHAFT_PRIMARY_RISING, r++ PASS_ENGINE_PARAMETER_SUFFIX);
2019-01-14 12:45:35 -08:00
ASSERT_EQ(10, sta->getCurrentIndex());
2018-07-29 07:27:23 -07:00
sta->decodeTriggerEvent(SHAFT_PRIMARY_FALLING, r++ PASS_ENGINE_PARAMETER_SUFFIX);
2019-01-14 12:45:35 -08:00
ASSERT_EQ(11, sta->getCurrentIndex());
2018-07-29 07:27:23 -07:00
sta->decodeTriggerEvent(SHAFT_PRIMARY_RISING, r++ PASS_ENGINE_PARAMETER_SUFFIX);
2019-01-14 12:45:35 -08:00
ASSERT_EQ(0, sta->getCurrentIndex()); // new revolution
2018-07-29 07:27:23 -07:00
}
2019-01-14 12:31:56 -08:00
TEST(misc, test1995FordInline6TriggerDecoder) {
2018-07-29 07:27:23 -07:00
2015-07-10 06:01:56 -07:00
printf("*************************************************** test1995FordInline6TriggerDecoder\r\n");
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, getTriggerZeroEventIndex(FORD_INLINE_6_1995)) << "triggerIndex ";
2015-07-10 06:01:56 -07:00
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
2015-07-10 06:01:56 -07:00
2018-07-29 07:27:23 -07:00
TriggerShape * shape = &engine->triggerCentral.triggerShape;
2015-07-10 06:01:56 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, shape->getTriggerShapeSynchPointIndex()) << "triggerShapeSynchPointIndex";
2015-07-10 06:01:56 -07:00
event_trigger_position_s position;
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, engineConfiguration->globalTriggerAngleOffset) << "globalTriggerAngleOffset";
TRIGGER_SHAPE(findTriggerPosition(&position, 0, engineConfiguration->globalTriggerAngleOffset));
2015-07-10 06:01:56 -07:00
assertTriggerPosition(&position, 0, 0);
TRIGGER_SHAPE(findTriggerPosition(&position, 200, engineConfiguration->globalTriggerAngleOffset));
2015-07-10 06:01:56 -07:00
assertTriggerPosition(&position, 3, 20);
TRIGGER_SHAPE(findTriggerPosition(&position, 360, engineConfiguration->globalTriggerAngleOffset));
2015-07-10 06:01:56 -07:00
assertTriggerPosition(&position, 6, 0);
2016-08-26 17:03:06 -07:00
eth.applyTriggerShape();
2016-01-26 19:03:19 -08:00
2018-07-29 07:27:23 -07:00
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2016-01-26 20:01:44 -08:00
eth.fireTriggerEvents(48);
2018-07-29 07:27:23 -07:00
assertRpm("rpm", 2000 PASS_ENGINE_PARAMETER_SUFFIX);
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2016-01-26 20:01:44 -08:00
eth.fireTriggerEvents(48);
2015-07-10 06:01:56 -07:00
2018-07-29 07:27:23 -07:00
IgnitionEventList *ecl = &engine->ignitionEvents;
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, ecl->isReady) << "ford inline ignition events size";
ASSERT_EQ( 0, ecl->elements[0].dwellPosition.eventIndex) << "event index";
assertEqualsM("angle offset#1", 7.8621, ecl->elements[0].dwellPosition.angleOffset);
2015-07-10 06:01:56 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 10, ecl->elements[5].dwellPosition.eventIndex) << "event index";
assertEqualsM("angle offset#2", 7.8621, ecl->elements[5].dwellPosition.angleOffset);
2015-07-10 06:01:56 -07:00
2017-05-15 20:28:49 -07:00
assertEqualsM("running dwell", 0.5, getSparkDwell(2000 PASS_ENGINE_PARAMETER_SUFFIX));
2015-07-10 06:01:56 -07:00
}
2019-01-14 12:31:56 -08:00
TEST(misc, testFordAspire) {
2015-07-10 06:01:56 -07:00
printf("*************************************************** testFordAspire\r\n");
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, getTriggerZeroEventIndex(FORD_ASPIRE_1996)) << "getTriggerZeroEventIndex";
2015-07-10 06:01:56 -07:00
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
2015-07-10 06:01:56 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, TRIGGER_SHAPE(getTriggerShapeSynchPointIndex())) << "getTriggerShapeSynchPointIndex";
2015-07-10 06:01:56 -07:00
2019-01-14 12:45:35 -08:00
ASSERT_EQ(800, config->fuelRpmBins[0]);
ASSERT_EQ(7000, config->fuelRpmBins[15]);
2015-07-10 06:01:56 -07:00
engineConfiguration->crankingChargeAngle = 65;
engineConfiguration->crankingTimingAngle = 31;
2017-07-07 16:37:13 -07:00
engine->rpmCalculator.setRpmValue(200 PASS_ENGINE_PARAMETER_SUFFIX);
2017-05-15 20:28:49 -07:00
assertEqualsM("cranking dwell", 54.166670, getSparkDwell(200 PASS_ENGINE_PARAMETER_SUFFIX));
2017-07-07 16:37:13 -07:00
engine->rpmCalculator.setRpmValue(2000 PASS_ENGINE_PARAMETER_SUFFIX);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, getSparkDwell(2000 PASS_ENGINE_PARAMETER_SUFFIX)) << "running dwell";
2015-07-10 06:01:56 -07:00
2017-07-07 16:37:13 -07:00
engine->rpmCalculator.setRpmValue(6000 PASS_ENGINE_PARAMETER_SUFFIX);
2017-05-15 20:28:49 -07:00
assertEqualsM("higher rpm dwell", 3.25, getSparkDwell(6000 PASS_ENGINE_PARAMETER_SUFFIX));
2015-07-10 06:01:56 -07:00
}
static void testTriggerDecoder2(const char *msg, engine_type_e type, int synchPointIndex, float channel1duty, float channel2duty) {
2018-12-25 16:13:28 -08:00
printf("====================================================================================== testTriggerDecoder2 msg=%s\r\n", msg);
2015-07-10 06:01:56 -07:00
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(type);
2015-07-10 06:01:56 -07:00
2018-10-28 14:15:12 -07:00
TriggerShape *t = &ENGINE(triggerCentral.triggerShape);
2015-07-10 06:01:56 -07:00
2019-01-14 16:02:36 -08:00
ASSERT_FALSE(t->shapeDefinitionError) << "isError";
2017-03-01 19:37:10 -08:00
2015-07-10 06:01:56 -07:00
assertEqualsM("synchPointIndex", synchPointIndex, t->getTriggerShapeSynchPointIndex());
2018-02-05 14:24:45 -08:00
assertEqualsM5(msg, " channel1duty", channel1duty, t->expectedDutyCycle[0], 0.0001);
assertEqualsM5(msg, " channel2duty", channel2duty, t->expectedDutyCycle[1], 0.0001);
2015-07-10 06:01:56 -07:00
}
static void testTriggerDecoder3(const char *msg, engine_type_e type, int synchPointIndex, float channel1duty, float channel2duty, float expectedGap) {
printTriggerDebug = true;
testTriggerDecoder2(msg, type, synchPointIndex, channel1duty, channel2duty);
assertEqualsM2("actual gap ratio", expectedGap, actualSynchGap, 0.001);
printTriggerDebug = false;
}
2019-01-14 12:31:56 -08:00
TEST(misc, testStartupFuelPumping) {
2015-07-10 06:01:56 -07:00
printf("*************************************************** testStartupFuelPumping\r\n");
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
2015-07-10 06:01:56 -07:00
StartupFuelPumping sf;
engine->rpmCalculator.mockRpm = 0;
engineConfiguration->tpsMin = 0;
engineConfiguration->tpsMax = 10;
2015-07-10 06:01:56 -07:00
2017-11-16 07:29:40 -08:00
setMockTpsPosition(6);
2017-05-15 20:28:49 -07:00
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, sf.pumpsCounter) << "pc#1";
2015-07-10 06:01:56 -07:00
2017-11-16 07:29:40 -08:00
setMockTpsPosition(3);
2017-05-15 20:28:49 -07:00
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, sf.pumpsCounter) << "pumpsCounter#2";
2015-07-10 06:01:56 -07:00
2017-05-15 20:28:49 -07:00
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, sf.pumpsCounter) << "pc#3";
2015-07-10 06:01:56 -07:00
engine->rpmCalculator.mockRpm = 10;
2017-05-15 20:28:49 -07:00
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, sf.pumpsCounter) << "pc#4";
2015-07-10 06:01:56 -07:00
2017-11-16 07:29:40 -08:00
setMockTpsPosition(7);
2015-07-10 06:01:56 -07:00
engine->rpmCalculator.mockRpm = 0;
2017-05-15 20:28:49 -07:00
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, sf.pumpsCounter) << "pc#5";
2015-07-10 06:01:56 -07:00
2017-11-16 07:29:40 -08:00
setMockTpsPosition(3);
2017-05-15 20:28:49 -07:00
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, sf.pumpsCounter) << "pc#6";
2015-07-10 06:01:56 -07:00
2017-11-16 07:29:40 -08:00
setMockTpsPosition(7);
2017-05-15 20:28:49 -07:00
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 2, sf.pumpsCounter) << "pc#7";
2015-07-10 06:01:56 -07:00
}
static void assertREquals(void *expected, void *actual) {
2019-01-14 12:45:35 -08:00
ASSERT_EQ((float)(uint64_t)expected, (float)(uint64_t)actual);
2015-07-10 06:01:56 -07:00
}
2016-07-23 19:02:52 -07:00
static void assertREqualsM(const char *msg, void *expected, void *actual) {
assertEqualsM(msg, (float)(uint64_t)expected, (float)(uint64_t)actual);
}
2015-07-10 06:01:56 -07:00
extern bool_t debugSignalExecutor;
2016-11-03 20:02:58 -07:00
extern EnginePins enginePins;
2015-07-10 06:01:56 -07:00
2019-01-14 12:31:56 -08:00
TEST(misc, testRpmCalculator) {
2015-07-10 06:01:56 -07:00
printf("*************************************************** testRpmCalculator\r\n");
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
2018-07-28 11:33:32 -07:00
IgnitionEventList *ilist = &engine->ignitionEvents;
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, ilist->isReady) << "size #1";
2015-07-10 06:01:56 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 720, engine->engineCycle) << "engineCycle";
2015-07-10 06:01:56 -07:00
2018-09-10 19:23:16 -07:00
efiAssertVoid(CUSTOM_ERR_6670, engineConfiguration!=NULL, "null config in engine");
2015-07-10 06:01:56 -07:00
engineConfiguration->trigger.customTotalToothCount = 8;
engineConfiguration->globalFuelCorrection = 3;
2016-08-26 17:03:06 -07:00
eth.applyTriggerShape();
2015-07-10 06:01:56 -07:00
setFlatInjectorLag(0 PASS_CONFIG_PARAMETER_SUFFIX);
2015-07-10 06:01:56 -07:00
2017-05-15 20:28:49 -07:00
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
engine->sensors.clt = 70; // 'testCltValue' does not give us exact number so we have to hack here. todo: migrate test
engine->sensors.iat = 30; // 'testIatValue' does not give us exact number so we have to hack here. todo: migrate test
2019-01-10 20:24:36 -08:00
2019-01-14 12:45:35 -08:00
ASSERT_EQ(0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
2015-07-10 06:01:56 -07:00
// triggerIndexByAngle update is now fixed! prepareOutputSignals() wasn't reliably called
2019-01-14 12:45:35 -08:00
ASSERT_EQ(5, TRIGGER_SHAPE(triggerIndexByAngle[240]));
ASSERT_EQ(5, TRIGGER_SHAPE(triggerIndexByAngle[241]));
2016-01-30 19:03:36 -08:00
2019-01-10 20:33:50 -08:00
eth.fireTriggerEvents(/* count */ 48);
2016-01-24 22:02:55 -08:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1500, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM";
ASSERT_EQ( 15, engine->triggerCentral.triggerState.getCurrentIndex()) << "index #1";
2015-07-10 06:01:56 -07:00
2018-03-04 13:38:01 -08:00
eth.clearQueue();
2015-07-10 06:01:56 -07:00
debugSignalExecutor = true;
2019-01-14 12:45:35 -08:00
ASSERT_EQ(engine->triggerCentral.triggerState.shaft_is_synchronized, 1);
2016-01-24 22:02:55 -08:00
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(MS2US(5)); // 5ms
2015-07-10 06:01:56 -07:00
2019-01-10 18:50:13 -08:00
int start = eth.getTimeNowUs();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 485000, start) << "start value";
2016-01-24 22:02:55 -08:00
2017-05-15 20:28:49 -07:00
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2015-07-10 06:01:56 -07:00
2018-07-28 11:33:32 -07:00
assertEqualsM("fuel #1", 4.5450, engine->injectionDuration);
InjectionEvent *ie0 = &engine->injectionEvents.elements[0];
2016-07-23 19:02:52 -07:00
assertEqualsM("injection angle", 31.365, ie0->injectionStart.angleOffset);
2016-01-26 18:01:37 -08:00
2018-07-28 17:02:01 -07:00
eth.firePrimaryTriggerRise();
2019-01-14 12:45:35 -08:00
ASSERT_EQ(1500, eth.engine.rpmCalculator.rpmValue);
2015-07-10 06:01:56 -07:00
2018-07-28 11:33:32 -07:00
assertEqualsM("dwell", 4.5, engine->engineState.dwellAngle);
assertEqualsM("fuel #2", 4.5450, engine->injectionDuration);
assertEqualsM("one degree", 111.1111, engine->rpmCalculator.oneDegreeUs);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, ilist->isReady) << "size #2";
ASSERT_EQ( 0, ilist->elements[0].dwellPosition.eventAngle) << "dwell angle";
2016-01-26 21:01:34 -08:00
assertEqualsM("dwell offset", 8.5, ilist->elements[0].dwellPosition.angleOffset);
2015-07-10 06:01:56 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, eth.engine.triggerCentral.triggerState.getCurrentIndex()) << "index #2";
ASSERT_EQ( 2, engine->executor.size()) << "queue size/2";
2016-01-30 19:03:36 -08:00
{
scheduling_s *ev0 = engine->executor.getForUnitTest(0);
2015-07-10 06:01:56 -07:00
2016-07-23 19:02:52 -07:00
assertREqualsM("Call@0", (void*)ev0->callback, (void*)turnSparkPinHigh);
2018-12-08 15:35:05 -08:00
assertEqualsM("ev 0", start + 944, ev0->momentX);
2016-11-26 21:01:22 -08:00
assertEqualsLM("coil 0", (long)&enginePins.coils[0], (long)((IgnitionEvent*)ev0->param)->outputs[0]);
2016-01-25 20:01:36 -08:00
scheduling_s *ev1 = engine->executor.getForUnitTest(1);
2016-07-23 19:02:52 -07:00
assertREqualsM("Call@1", (void*)ev1->callback, (void*)turnSparkPinLow);
2018-12-08 15:35:05 -08:00
assertEqualsM("ev 1", start + 1444, ev1->momentX);
2016-11-26 21:01:22 -08:00
assertEqualsLM("coil 1", (long)&enginePins.coils[0], (long)((IgnitionEvent*)ev1->param)->outputs[0]);
2016-01-25 20:01:36 -08:00
2016-01-30 19:03:36 -08:00
}
2016-01-25 20:01:36 -08:00
engine->executor.clear();
2015-07-10 06:01:56 -07:00
2018-07-28 17:02:01 -07:00
eth.fireFall(5);
eth.fireRise(5);
eth.fireFall(5);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 3, eth.engine.triggerCentral.triggerState.getCurrentIndex()) << "index #3";
ASSERT_EQ( 4, engine->executor.size()) << "queue size 3";
assertEqualsM("ev 3", start + 13333 - 1515, engine->executor.getForUnitTest(0)->momentX);
assertEqualsM2("ev 5", start + 14277, engine->executor.getForUnitTest(1)->momentX, 2);
assertEqualsM("3/3", start + 14777, engine->executor.getForUnitTest(2)->momentX);
engine->executor.clear();
2015-07-10 06:01:56 -07:00
2019-01-14 12:45:35 -08:00
ASSERT_EQ(5, TRIGGER_SHAPE(triggerIndexByAngle[240]));
ASSERT_EQ(5, TRIGGER_SHAPE(triggerIndexByAngle[241]));
2016-01-30 19:03:36 -08:00
2018-07-28 17:02:01 -07:00
eth.fireFall(5);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, engine->executor.size()) << "queue size 4.1";
2016-01-30 19:03:36 -08:00
2018-07-28 17:06:55 -07:00
eth.fireRise(5);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "queue size 4.2";
2016-01-30 19:03:36 -08:00
2018-07-28 17:06:55 -07:00
eth.fireRise(5);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "queue size 4.3";
2016-01-30 19:03:36 -08:00
assertEqualsM("dwell", 4.5, eth.engine.engineState.dwellAngle);
2017-11-06 19:29:39 -08:00
assertEqualsM("fuel #3", 4.5450, eth.engine.injectionDuration);
2019-01-14 12:45:35 -08:00
ASSERT_EQ(1500, eth.engine.rpmCalculator.rpmValue);
2016-01-30 19:03:36 -08:00
2019-01-10 18:50:13 -08:00
eth.assertInjectorUpEvent("ev 0/2", 0, -4849, 2);
2016-11-30 17:02:41 -08:00
2016-01-30 19:03:36 -08:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 6, eth.engine.triggerCentral.triggerState.getCurrentIndex()) << "index #4";
ASSERT_EQ( 4, engine->executor.size()) << "queue size 4";
engine->executor.clear();
2015-07-10 06:01:56 -07:00
2018-07-28 17:02:01 -07:00
eth.fireFall(5);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 2, engine->executor.size()) << "queue size 5";
2016-07-23 19:02:52 -07:00
// todo: assert queue elements
engine->executor.clear();
2015-07-10 06:01:56 -07:00
2018-07-28 17:06:55 -07:00
eth.fireRise(5);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 2, engine->executor.size()) << "queue size 6";
assertEqualsM("6/0", start + 40944, engine->executor.getForUnitTest(0)->momentX);
assertEqualsM("6/1", start + 41444, engine->executor.getForUnitTest(1)->momentX);
engine->executor.clear();
2015-07-10 06:01:56 -07:00
2018-07-28 17:02:01 -07:00
eth.fireFall(5);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, engine->executor.size()) << "queue size 7";
engine->executor.clear();
2015-07-10 06:01:56 -07:00
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(5000); // 5ms
2018-07-28 17:02:01 -07:00
eth.firePrimaryTriggerRise();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "queue size 8";
2016-07-23 19:02:52 -07:00
// todo: assert queue elements completely
assertEqualsM("8/0", start + 53333 - 1515, engine->executor.getForUnitTest(0)->momentX);
assertEqualsM2("8/1", start + 54277, engine->executor.getForUnitTest(1)->momentX, 0);
assertEqualsM2("8/2", start + 54777, engine->executor.getForUnitTest(2)->momentX, 0);
engine->executor.clear();
2015-07-10 06:01:56 -07:00
2018-07-28 17:06:55 -07:00
eth.fireFall(5);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, engine->executor.size()) << "queue size 9";
engine->executor.clear();
2015-07-10 06:01:56 -07:00
2018-07-28 17:06:55 -07:00
eth.fireRise(5);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, engine->executor.size()) << "queue size 10";
engine->executor.clear();
2015-07-10 06:01:56 -07:00
}
2019-01-14 12:31:56 -08:00
TEST(misc, testTriggerDecoder) {
2018-12-25 14:26:36 -08:00
printf("====================================================================================== testTriggerDecoder\r\n");
2015-07-10 06:01:56 -07:00
2016-10-31 19:02:12 -07:00
persistent_config_s c;
Engine e(&c);
2017-03-01 19:18:25 -08:00
TriggerShape * s = &e.triggerCentral.triggerShape;
2015-07-10 06:01:56 -07:00
2016-10-31 19:02:12 -07:00
persistent_config_s *config = &c;
Engine *engine = &e;
engine_configuration_s *engineConfiguration = &c.engineConfiguration;
board_configuration_s *boardConfiguration = &c.engineConfiguration.bc;
2018-12-25 17:09:35 -08:00
initializeSkippedToothTriggerShapeExt(s, 2, 0, FOUR_STROKE_CAM_SENSOR);
2015-07-10 06:01:56 -07:00
assertEqualsM("shape size", s->getSize(), 4);
2019-01-14 12:45:35 -08:00
ASSERT_EQ(s->wave.switchTimes[0], 0.25);
ASSERT_EQ(s->wave.switchTimes[1], 0.5);
ASSERT_EQ(s->wave.switchTimes[2], 0.75);
ASSERT_EQ(s->wave.switchTimes[3], 1);
2015-07-10 06:01:56 -07:00
2018-12-25 14:26:36 -08:00
printf("====================================================================================== testTriggerDecoder part 2\r\n");
2015-07-10 06:01:56 -07:00
testDodgeNeonDecoder();
2017-03-04 17:52:24 -08:00
testTriggerDecoder2("Dodge Neon 1995", DODGE_NEON_1995, 8, 0.4931, 0.2070);
2015-07-10 06:01:56 -07:00
2017-03-04 17:52:24 -08:00
testTriggerDecoder2("ford aspire", FORD_ASPIRE_1996, 4, 0.0000, 0.5);
2015-07-10 06:01:56 -07:00
testTriggerDecoder2("dodge ram", DODGE_RAM, 16, 0.5000, 0.06);
//testTriggerDecoder2("bmw", BMW_E34, 0, 0.9750, 0.5167);
2017-03-04 17:52:24 -08:00
testTriggerDecoder2("bmw", BMW_E34, 0, 0.4667, 0.0);
2015-07-10 06:01:56 -07:00
2017-05-12 19:43:49 -07:00
2016-11-03 16:02:46 -07:00
testTriggerDecoder2("Miata NB", MAZDA_MIATA_NB1, 12, 0.0833, 0.0444);
2017-05-12 19:43:49 -07:00
testTriggerDecoder2("Miata 2003", MAZDA_MIATA_2003, 3, 0.0444, 0.0);
2015-07-10 06:01:56 -07:00
2018-12-25 14:26:36 -08:00
printf("====================================================================================== testTriggerDecoder part 3\r\n");
2017-03-01 18:38:14 -08:00
testTriggerDecoder2("Civic 4/0 both", TEST_CIVIC_4_0_BOTH, 0, 0.5000, 0.0);
2017-03-04 17:52:24 -08:00
testTriggerDecoder2("Civic 4/0 rise", TEST_CIVIC_4_0_RISE, 0, 0.5000, 0.0);
2017-03-01 18:38:14 -08:00
2017-03-06 14:42:16 -08:00
testTriggerDecoder2("test 2/1 both", TEST_ISSUE_366_BOTH, 0, 0.2500, 0.0);
testTriggerDecoder2("test 2/1 rise", TEST_ISSUE_366_RISE, 0, 0.0000, 0.0);
2015-09-24 16:01:36 -07:00
testTriggerDecoder2("test engine", TEST_ENGINE, 0, 0.7500, 0.2500);
2015-07-10 06:01:56 -07:00
testTriggerDecoder2("testGY6_139QMB", GY6_139QMB, 0, 0.4375, 0.0);
testTriggerDecoder2("testSubary", SUBARU_2003_WRX, 0, 0.4000, 0.0);
testTriggerDecoder2("testFordEscortGt", FORD_ESCORT_GT, 0, 0.8096, 0.3844);
testTriggerDecoder2("testMiniCooper", MINI_COOPER_R50, 121, 0.5222, 0.4959);
testTriggerDecoder2("testRoverV8", ROVER_V8, 0, 0.4861, 0);
2017-03-12 19:55:41 -07:00
testTriggerDecoder2("SATURN_ION_2004", SATURN_ION_2004, 0, 0.9028, 0.0);
2015-07-10 06:01:56 -07:00
2018-01-01 20:04:31 -08:00
testTriggerDecoder2("NISSAN_PRIMERA", NISSAN_PRIMERA, 2, 0.9611, 0.0);
2017-03-18 17:59:52 -07:00
2015-07-10 06:01:56 -07:00
testTriggerDecoder2("test1+1", CUSTOM_ENGINE, 0, 0.7500, 0.2500);
testTriggerDecoder2("testCitroen", CITROEN_TU3JP, 0, 0.4833, 0);
testTriggerDecoder2("testAccordCd 3w", HONDA_ACCORD_CD, 12, 0.8146, 0.5000);
testTriggerDecoder2("testAccordCd 2w", HONDA_ACCORD_CD_TWO_WIRES, 2, 0.9167, 0.5);
testTriggerDecoder2("testAccordCdDip", HONDA_ACCORD_CD_DIP, 27, 0.5000, 0.5000);
2017-02-23 19:27:12 -08:00
testTriggerDecoder2("testMitsu", MITSU_4G93, 0, 0.3553, 0.3752);
2015-09-13 10:02:13 -07:00
{
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(MITSU_4G93);
2015-09-13 10:02:13 -07:00
2017-03-01 19:18:25 -08:00
// TriggerShape *t = &eth.engine.triggerShape;
2019-01-14 12:45:35 -08:00
// ASSERT_EQ(1, t->eventAngles[1]);
2019-01-14 15:38:20 -08:00
// ASSERT_EQ( 0, t->triggerIndexByAngle[56]) << "index at 0";
// ASSERT_EQ( 1, t->triggerIndexByAngle[57]) << "index at 1";
2017-02-23 19:27:12 -08:00
//
2019-01-14 12:45:35 -08:00
// ASSERT_EQ(270, t->eventAngles[5]);
2019-01-14 15:38:20 -08:00
// ASSERT_EQ( 4, t->triggerIndexByAngle[269]) << "index at 269";
// ASSERT_EQ( 5, t->triggerIndexByAngle[270]) << "index at 270";
// ASSERT_EQ( 5, t->triggerIndexByAngle[271]) << "index at 271";
2017-02-23 19:27:12 -08:00
//
2019-01-14 12:45:35 -08:00
// ASSERT_EQ(306, t->eventAngles[6]);
// ASSERT_EQ(5, t->triggerIndexByAngle[305]);
// ASSERT_EQ(6, t->triggerIndexByAngle[306]);
// ASSERT_EQ(6, t->triggerIndexByAngle[307]);
2017-02-23 19:27:12 -08:00
//
2019-01-14 12:45:35 -08:00
// ASSERT_EQ(666, t->eventAngles[11]);
2019-01-14 15:38:20 -08:00
// ASSERT_EQ( 10, t->triggerIndexByAngle[665]) << "index for 665";
// ASSERT_EQ( 11, t->triggerIndexByAngle[668]) << "index for 668";
2015-09-13 10:02:13 -07:00
2015-09-13 13:01:38 -07:00
2016-02-27 20:03:34 -08:00
eth.persistentConfig.engineConfiguration.useOnlyRisingEdgeForTrigger = false;
2015-09-13 15:01:23 -07:00
eth.persistentConfig.engineConfiguration.bc.sensorChartMode = SC_DETAILED_RPM;
2017-05-15 20:28:49 -07:00
applyNonPersistentConfiguration(NULL PASS_ENGINE_PARAMETER_SUFFIX);
2015-09-13 13:01:38 -07:00
2016-01-24 22:02:55 -08:00
// assertEqualsM2("rpm#1", 16666.9746, eth.engine.triggerCentral.triggerState.instantRpmValue[0], 0.5);
// assertEqualsM2("rpm#2", 16666.3750, eth.engine.triggerCentral.triggerState.instantRpmValue[1], 0.5);
2015-09-13 13:01:38 -07:00
2015-09-13 10:02:13 -07:00
}
2016-08-26 14:02:37 -07:00
testTriggerDecoder2("miata 1990", MIATA_1990, 11, 0.2985, 0.3890);
2015-07-10 06:01:56 -07:00
testTriggerDecoder3("miata 1994", MIATA_1994_DEVIATOR, 11, 0.2985, 0.3890, MIATA_NA_GAP);
testTriggerDecoder3("citroen", CITROEN_TU3JP, 0, 0.4833, 0.0, 2.9994);
2016-08-26 14:02:37 -07:00
testTriggerDecoder2("MAZDA_323", MAZDA_323, 0, 0.4833, 0);
2018-10-28 14:15:12 -07:00
testTriggerDecoder2("CAMARO_4", CAMARO_4, 34, 0.5, 0);
2016-08-26 14:02:37 -07:00
2016-09-21 09:03:07 -07:00
testTriggerDecoder3("neon NGC4", DODGE_NEON_2003_CAM, 6, 0.5000, 0.0, CHRYSLER_NGC4_GAP);
2015-09-24 16:01:36 -07:00
{
printTriggerDebug = true;
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(DODGE_NEON_2003_CAM);
2015-09-24 16:01:36 -07:00
2016-02-27 20:03:34 -08:00
printf("!!!!!!!!!!!!!!!!!! Now trying with only rising edges !!!!!!!!!!!!!!!!!\r\n");
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
2015-09-24 16:01:36 -07:00
2017-05-15 20:28:49 -07:00
applyNonPersistentConfiguration(NULL PASS_ENGINE_PARAMETER_SUFFIX);
prepareShapes(PASS_ENGINE_PARAMETER_SIGNATURE);
2015-09-24 16:01:36 -07:00
2015-09-24 17:01:25 -07:00
printTriggerDebug = false;
2015-09-24 16:01:36 -07:00
}
2015-07-10 06:01:56 -07:00
testTriggerDecoder2("sachs", SACHS, 0, 0.4800, 0.000);
2015-09-05 20:02:46 -07:00
printTriggerDebug = true;
2015-09-12 12:02:40 -07:00
testTriggerDecoder3("36+2+2+2", DAIHATSU, 28, 0.5000, 0.0, 0.5);
2015-09-06 11:01:29 -07:00
testTriggerDecoder3("stratus NGC6", DODGE_STRATUS, 0, 0.8833, 0.0, CHRYSLER_NGC6_GAP);
2015-09-05 20:02:46 -07:00
2015-07-10 06:01:56 -07:00
testTriggerDecoder2("vw ABA", VW_ABA, 114, 0.5000, 0.0);
}
2016-08-26 14:02:37 -07:00
2016-08-26 16:02:56 -07:00
extern fuel_Map3D_t fuelMap;
2016-09-03 10:02:55 -07:00
static void assertInjectionEvent(const char *msg, InjectionEvent *ev, int injectorIndex, int eventIndex, angle_t angleOffset, bool isOverlapping) {
2016-11-30 16:01:43 -08:00
assertEqualsM4(msg, "inj index", injectorIndex, ev->outputs[0]->injectorIndex);
2016-11-08 22:02:15 -08:00
assertEqualsM4(msg, " event index", eventIndex, ev->injectionStart.eventIndex);
assertEqualsM4(msg, " event offset", angleOffset, ev->injectionStart.angleOffset);
2016-09-01 20:02:44 -07:00
}
2016-11-07 20:01:47 -08:00
static void setTestBug299(EngineTestHelper *eth) {
2018-03-04 13:13:23 -08:00
setupSimpleTestEngineWithMafAndTT_ONE_trigger(eth);
2016-11-07 20:01:47 -08:00
Engine *engine = &eth->engine;
EXPAND_Engine
2018-07-28 16:29:13 -07:00
assertRpm("RPM=0", 0 PASS_ENGINE_PARAMETER_SUFFIX);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE)) << "setTestBug299 EL";
ASSERT_NEAR( 30, engine->sensors.iat, EPS4D) << "setTestBug299 IAT";
2018-07-28 16:37:10 -07:00
eth->fireTriggerEventsWithDuration(20);
2016-08-27 10:01:55 -07:00
// still no RPM since need to cycles measure cycle duration
2018-07-28 16:29:13 -07:00
assertRpm("setTestBug299: RPM#1", 0 PASS_ENGINE_PARAMETER_SUFFIX);
2018-07-28 16:37:10 -07:00
eth->fireTriggerEventsWithDuration(20);
2018-07-28 16:29:13 -07:00
assertRpm("setTestBug299: RPM#2", 3000 PASS_ENGINE_PARAMETER_SUFFIX);
2016-08-27 10:01:55 -07:00
2018-03-04 13:38:01 -08:00
eth->clearQueue();
2016-08-26 20:02:24 -07:00
2016-08-27 17:02:25 -07:00
/**
* Trigger up - scheduling fuel for full engine cycle
*/
2018-07-28 16:51:41 -07:00
eth->fireRise(20);
2016-08-27 17:02:25 -07:00
// fuel schedule - short pulses.
// time...|0.......|10......|20......|30......|40
// inj #0 |.......#|........|.......#|........|
// inj #1 |........|.......#|........|.......#|
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "qs#00";
ASSERT_EQ( 3, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#3";
2019-01-10 19:43:31 -08:00
eth->assertInjectorUpEvent("setTestBug299: 1@0", 0, MS2US(8.5), 0);
eth->assertInjectorDownEvent("@1", 1, MS2US(10), 0);
2019-01-10 18:50:13 -08:00
eth->assertInjectorUpEvent("1@2", 2, MS2US(18.5), 1);
2019-01-10 19:43:31 -08:00
eth->assertInjectorDownEvent("1@3", 3, MS2US(20), 1);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, eth->executeActions()) << "exec#0";
2016-08-26 17:03:06 -07:00
2016-12-18 09:03:48 -08:00
FuelSchedule * t = &ENGINE(injectionEvents);
2016-11-30 18:06:24 -08:00
2016-11-30 19:06:43 -08:00
assertInjectionEvent("#0", &t->elements[0], 0, 1, 153, false);
2016-12-01 17:01:57 -08:00
assertInjectionEvent("#1_i_@", &t->elements[1], 1, 1, 333, false);
2016-11-30 20:02:42 -08:00
assertInjectionEvent("#2@", &t->elements[2], 0, 0, 153, false);
assertInjectionEvent("inj#3@", &t->elements[3], 1, 0, 153 + 180, false);
2016-09-02 22:02:32 -07:00
2016-08-27 17:02:25 -07:00
/**
* Trigger down - no new events, executing some
*/
2018-07-28 17:02:01 -07:00
eth->fireFall(20);
2016-08-27 17:02:25 -07:00
// same exact picture
// time...|-20.....|-10.....|0.......|10......|20
2016-08-27 14:01:58 -07:00
// inj #0 |.......#|........|.......#|........|
// inj #1 |........|.......#|........|.......#|
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 8, engine->executor.size()) << "qs#0";
ASSERT_EQ( 3, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#3";
2019-01-10 19:43:31 -08:00
eth->assertInjectorUpEvent("02@0", 0, MS2US(-11.5), 0);
eth->assertInjectorDownEvent("@1", 1, MS2US(-10), 0);
eth->assertInjectorUpEvent("@2", 2, MS2US(-1.5), 1);
eth->assertInjectorDownEvent("02@3", 3, MS2US(0), 1);
eth->assertInjectorUpEvent("02@4", 4, MS2US(8.5), 0);
eth->assertInjectorDownEvent("@5", 5, MS2US(10), 0);
eth->assertInjectorUpEvent("02@6", 6, MS2US(18.5), 1);
eth->assertInjectorDownEvent("@7", 7, MS2US(20), 1);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, eth->executeActions()) << "exec#1";
2016-08-27 14:01:58 -07:00
2016-08-27 17:02:25 -07:00
/**
* Trigger up again
*/
2019-01-10 20:15:24 -08:00
eth->moveTimeForwardUs(MS2US(20));
2019-01-10 19:43:31 -08:00
eth->assertInjectorUpEvent("22@0", 0, MS2US(-11.5), 0);
eth->assertInjectorDownEvent("22@1", 1, MS2US(-10), 0);
eth->assertInjectorUpEvent("22@2", 2, MS2US(-1.5), 1);
eth->assertInjectorDownEvent("22@3", 3, MS2US(0), 1);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, eth->executeActions()) << "exec#20";
2016-09-04 21:02:31 -07:00
2016-09-03 10:02:55 -07:00
eth->firePrimaryTriggerRise();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "qs#0-2";
2016-08-27 14:01:58 -07:00
// fuel schedule - short pulses. and more realistic schedule this time
2016-08-27 17:02:25 -07:00
// time...|-20.....|-10.....|0.......|10......|20
2016-08-27 14:01:58 -07:00
// inj #0 |.......#|........|.......#|........|
// inj #1 |........|.......#|........|.......#|
2019-01-10 19:43:31 -08:00
eth->assertInjectorUpEvent("2@0", 0, MS2US(8.5), 0);
eth->assertInjectorDownEvent("@1", 1, MS2US(10), 0);
eth->assertInjectorUpEvent("@2", 2, MS2US(18.5), 1);
eth->assertInjectorDownEvent("2@3", 3, MS2US(20), 1);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, eth->executeActions()) << "exec#2";
2016-08-27 17:02:25 -07:00
2019-01-10 20:15:24 -08:00
eth->moveTimeForwardUs(MS2US(20));
2019-01-10 18:26:02 -08:00
eth->executeActions();
2016-09-03 10:02:55 -07:00
eth->firePrimaryTriggerFall();
2016-08-27 17:02:25 -07:00
// fuel schedule - short pulses. and more realistic schedule this time
// time...|-20.....|-10.....|0.......|10......|20
// inj #0 |.......#|........|........|........|
// inj #1 |........|.......#|........|........|
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "qs#0-2";
ASSERT_EQ( 4, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#4";
2019-01-10 19:43:31 -08:00
eth->assertInjectorUpEvent("0@0", 0, MS2US(8.5), 0);
eth->assertInjectorDownEvent("0@1", 1, MS2US(10), 0);
eth->assertInjectorUpEvent("0@2", 2, MS2US(18.5), 1);
eth->assertInjectorDownEvent("0@3", 3, MS2US(20), 1);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, eth->executeActions()) << "exec#3";
2016-08-27 14:01:58 -07:00
2016-08-26 16:02:56 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, engine->engineState.iatFuelCorrection) << "iatC";
ASSERT_EQ( 1, engine->engineState.cltFuelCorrection) << "cltC";
ASSERT_EQ( 0, engine->engineState.injectorLag) << "lag";
2016-08-26 16:02:56 -07:00
2018-07-28 16:29:13 -07:00
testMafValue = 0;
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, getMaf(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maf";
2018-07-28 16:29:13 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 3000, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "setTestBug299: RPM";
2016-08-26 16:02:56 -07:00
2017-11-06 19:29:39 -08:00
assertEqualsM("fuel#1", 1.5, engine->injectionDuration);
2017-05-15 20:28:49 -07:00
assertEqualsM("duty for maf=0", 7.5, getInjectorDutyCycle(engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX));
2016-08-26 16:02:56 -07:00
testMafValue = 3;
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 3, getMaf(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maf";
2016-09-03 10:02:55 -07:00
}
2016-09-04 20:02:10 -07:00
static void assertInjectors(const char *msg, int value0, int value1) {
assertEqualsM4(msg, "inj#0", value0, enginePins.injectors[0].currentLogicValue);
assertEqualsM4(msg, "inj#1", value1, enginePins.injectors[1].currentLogicValue);
}
TEST(big, testFuelSchedulerBug299smallAndMedium) {
2016-09-03 10:02:55 -07:00
printf("*************************************************** testFuelSchedulerBug299 small to medium\r\n");
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
2016-09-03 10:02:55 -07:00
setTestBug299(&eth);
FuelSchedule * t;
2016-08-26 16:02:56 -07:00
2016-12-01 17:01:57 -08:00
assertInjectors("#0_inj", 0, 0);
2016-09-04 20:02:10 -07:00
2016-08-26 16:02:56 -07:00
int engineLoadIndex = findIndex(config->fuelLoadBins, FUEL_LOAD_COUNT, testMafValue);
2019-01-14 12:45:35 -08:00
ASSERT_EQ(8, engineLoadIndex);
2016-09-02 23:03:32 -07:00
setArrayValues(fuelMap.pointers[engineLoadIndex], FUEL_RPM_COUNT, 25);
setArrayValues(fuelMap.pointers[engineLoadIndex + 1], FUEL_RPM_COUNT, 25);
2016-08-26 16:02:56 -07:00
2017-05-15 20:28:49 -07:00
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2017-11-06 19:29:39 -08:00
assertEqualsM("fuel#2", 12.5, engine->injectionDuration);
2017-05-15 20:28:49 -07:00
assertEqualsM("duty for maf=3", 62.5, getInjectorDutyCycle(eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX));
2016-08-26 15:02:39 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "qs#1";
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(MS2US(20));
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, eth.executeActions()) << "exec#2#0";
ASSERT_EQ( 0, engine->executor.size()) << "qs#1#2";
2016-09-04 22:03:25 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#4#0";
2016-08-27 17:02:25 -07:00
eth.firePrimaryTriggerRise();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 5, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#4#1";
2016-08-27 17:02:25 -07:00
// time...|0.......|10......|20......|30......|40......|50......|60......|
2016-09-02 23:03:32 -07:00
// inj #0 |########|##...###|########|.....###|########|........|........|
// inj #1 |.....###|########|....####|########|........|........|........|
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 6, engine->executor.size()) << "qs#4";
2016-11-30 20:02:42 -08:00
//todo assertInjectorUpEvent("04@0", 0, MS2US(0), 0);
// assertInjectorUpEvent("04@1", 1, MS2US(7.5), 1);
// assertInjectorDownEvent("04@2", 2, MS2US(12.5), 0);
// assertInjectorUpEvent("04@3", 3, MS2US(17.5), 0);
// assertInjectorDownEvent("04@4", 4, MS2US(20), 1);
// assertInjectorDownEvent("04@5", 5, MS2US(30), 0);
2016-11-08 22:02:15 -08:00
// assertInjectorDownEvent("04@6", 6, MS2US(30), 0);
// assertInjectorUpEvent("04@7", 7, MS2US(37.5), 0);
// assertInjectorDownEvent("04@8", 8, MS2US(40.0), 1);
// assertInjectorDownEvent("04@9", 9, MS2US(50.0), 0);
2016-08-27 13:02:12 -07:00
2016-11-08 22:02:15 -08:00
// {
// scheduling_s *ev = engine->executor.getForUnitTest(9);
2019-01-14 15:38:20 -08:00
// ASSERT_EQ( 5, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#4#2";
2019-01-14 15:56:32 -08:00
// ASSERT_TRUE(ev == &engineConfiguration->fuelActuators[2].signalPair[1].signalTimerDown) << "down 50";
2016-11-08 22:02:15 -08:00
// }
2016-09-04 22:03:25 -07:00
2016-08-27 14:01:58 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, eth.executeActions()) << "exec#4";
2016-08-27 14:01:58 -07:00
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 8, engine->executor.size()) << "qs#2#1";
ASSERT_EQ( 5, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#5";
2016-08-27 17:02:25 -07:00
// using old fuel schedule - but already wider pulses
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
2016-09-02 23:03:32 -07:00
// inj #0 |........|.....###|########|.....###|########|........|........|
// inj #1 |.....###|########|.....###|########|........|........|........|
2016-11-30 20:02:42 -08:00
// assertInjectorUpEvent("5@0", 0, MS2US(-12.5), 1);
// assertInjectorDownEvent("5@1", 1, MS2US(-7.5), 0);
// assertInjectorUpEvent("5@2", 2, MS2US(-2.5), 0);
// assertInjectorDownEvent("5@3", 3, MS2US(0), 1);
// assertInjectorUpEvent("5@4", 4, MS2US(7.5), 1);
//
// assertInjectorDownEvent("5@4", 5, MS2US(10), 0);
// assertInjectorUpEvent("5@6", 6, MS2US(17.5), 0);
// assertInjectorDownEvent("5@7", 7, MS2US(20.0), 1);
// assertInjectorDownEvent("5@8", 8, MS2US(30.0), 0);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 3, eth.executeActions()) << "exec#5";
2016-08-27 14:01:58 -07:00
/**
* one more revolution
*/
2017-05-15 20:28:49 -07:00
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2016-08-27 14:01:58 -07:00
2016-12-18 09:03:48 -08:00
t = &ENGINE(injectionEvents);
2016-11-30 18:06:24 -08:00
2016-11-30 19:06:43 -08:00
assertInjectionEvent("#0", &t->elements[0], 0, 0, 315, false);
2016-12-01 17:01:57 -08:00
assertInjectionEvent("#1__", &t->elements[1], 1, 1, 135, false);
2016-11-30 20:02:42 -08:00
assertInjectionEvent("inj#2", &t->elements[2], 0, 0, 153, false);
assertInjectionEvent("inj#3", &t->elements[3], 1, 0, 333, false);
2016-09-01 20:02:44 -07:00
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(MS2US(20));
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 5, engine->executor.size()) << "qs#02";
2016-11-30 20:02:42 -08:00
// assertInjectorUpEvent("6@0", 0, MS2US(-12.5), 1);
// assertInjectorDownEvent("6@1", 1, MS2US(-10.0), 0);
// assertInjectorUpEvent("6@2", 2, MS2US(-2.5), 0);
// assertInjectorDownEvent("6@3", 3, MS2US(0), 1);
// assertInjectorDownEvent("6@4", 4, MS2US(10.0), 0);
2016-09-04 20:02:10 -07:00
// so placing this 'executeAll' changes much?
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 5, eth.executeActions()) << "exec#07";
ASSERT_EQ( 0, engine->executor.size()) << "qs#07";
2016-11-30 20:02:42 -08:00
// assertInjectorDownEvent("26@0", 0, MS2US(10.0), 0);
2016-09-04 20:02:10 -07:00
2016-08-27 17:02:25 -07:00
eth.firePrimaryTriggerRise();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "qs#2#2";
ASSERT_EQ( 6, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt6";
2016-08-29 19:02:57 -07:00
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
2016-09-02 23:03:32 -07:00
// inj #0 |########|.....###|########|....####|........|........|........|
// inj #1 |.....###|########|.....###|########|........|........|........|
2016-11-08 22:02:15 -08:00
// assertInjectorDownEvent("06@5", 5, MS2US(30.0), 0);
// assertInjectorUpEvent("06@6", 6, MS2US(37.5), 0);
// assertInjectorDownEvent("06@7", 7, MS2US(40.0), 1);
2016-08-27 14:01:58 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, eth.executeActions()) << "exec#7";
2016-08-27 20:02:39 -07:00
2016-12-01 17:01:57 -08:00
assertInjectors("#1_ij_", 0, 0);
2016-08-27 20:02:39 -07:00
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(MS2US(20));
2016-08-27 13:02:12 -07:00
2016-08-29 19:02:57 -07:00
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
2016-09-04 20:02:10 -07:00
// inj #0 |########|.......#|........|........|........|........|........|
2016-09-02 23:03:32 -07:00
// inj #1 |....####|########|........|........|........|........|........|
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "qs#022";
2016-11-30 20:02:42 -08:00
// assertInjectorUpEvent("7@0", 0, MS2US(-12.5), 1);
// assertInjectorDownEvent("7@1", 1, MS2US(-10.0), 0);
// assertInjectorUpEvent("7@2", 2, MS2US(-2.5), 0);
// assertInjectorDownEvent("7@3", 3, MS2US(0), 1);
// assertInjectorDownEvent("7@4", 4, MS2US(10), 0);
//// assertInjectorDownEvent("i7@5", 5, MS2US(20.0), 0);
//// assertInjectorUpEvent("7@6", 6, MS2US(17.5), 0);
//// assertInjectorDownEvent("7@7", 7, MS2US(20), 1);
// // todo index 8
2016-09-04 20:02:10 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 3, eth.executeActions()) << "executed #06";
2016-09-04 20:02:10 -07:00
assertInjectors("#4", 1, 0);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, engine->executor.size()) << "qs#06";
2019-01-10 19:43:31 -08:00
eth.assertInjectorDownEvent("17@0", 0, MS2US(10), 0);
2016-11-08 22:02:15 -08:00
// assertInjectorDownEvent("17@1", 1, MS2US(10.0), 0);
// assertInjectorUpEvent("17@2", 2, MS2US(17.5), 0);
// assertInjectorDownEvent("17@3", 3, MS2US(20), 1);
2016-09-04 22:03:25 -07:00
// todo index 4
2016-09-04 20:02:10 -07:00
eth.firePrimaryTriggerFall();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 5, engine->executor.size()) << "qs#3";
ASSERT_EQ( 6, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt6";
ASSERT_EQ( 0, eth.executeActions()) << "executed #6";
2016-08-29 19:02:57 -07:00
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(MS2US(20));
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, eth.executeActions()) << "executed #06";
ASSERT_EQ( 1, engine->executor.size()) << "qs#06";
2016-12-17 08:01:40 -08:00
assertInjectors("inj#2", 1, 0);
2016-09-04 20:02:10 -07:00
2016-08-29 19:02:57 -07:00
eth.firePrimaryTriggerRise();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 5, engine->executor.size()) << "Queue.size#03";
2017-05-15 20:28:49 -07:00
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-01-10 19:43:31 -08:00
eth.assertInjectorUpEvent("07@0", 0, MS2US(7.5), 1);
eth.assertInjectorDownEvent("07@1", 1, MS2US(10), 0);
eth.assertInjectorUpEvent("07@2", 2, MS2US(17.5), 0);
eth.assertInjectorDownEvent("07@3", 3, MS2US(20), 1);
eth.assertInjectorDownEvent("07@4", 4, MS2US(30), 0);
2016-11-08 22:02:15 -08:00
// assertInjectorDownEvent("07@5", 5, MS2US(30), 0);
// assertInjectorUpEvent("07@6", 6, MS2US(37.5), 0);
// assertInjectorDownEvent("07@7", 7, MS2US(40), 1);
// assertInjectorDownEvent("07@8", 8, MS2US(50), 0);
2016-08-29 19:02:57 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, eth.executeActions()) << "executeAll#3";
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(MS2US(20));
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, eth.executeActions()) << "executeAll#4";
2016-09-04 20:02:10 -07:00
2016-12-18 09:03:48 -08:00
t = &ENGINE(injectionEvents);
2016-11-30 18:06:24 -08:00
2016-11-30 19:06:43 -08:00
assertInjectionEvent("#0#", &t->elements[0], 0, 0, 315, false);
assertInjectionEvent("#1#", &t->elements[1], 1, 1, 135, false);
assertInjectionEvent("#2#", &t->elements[2], 0, 1, 315, true);
assertInjectionEvent("#3#", &t->elements[3], 1, 0, 45 + 90, false);
2016-09-02 23:03:32 -07:00
setArrayValues(fuelMap.pointers[engineLoadIndex], FUEL_RPM_COUNT, 35);
setArrayValues(fuelMap.pointers[engineLoadIndex + 1], FUEL_RPM_COUNT, 35);
2017-05-15 20:28:49 -07:00
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2017-11-06 19:29:39 -08:00
assertEqualsM("fuel#3", 17.5, engine->injectionDuration);
2016-09-03 10:02:55 -07:00
// duty cycle above 75% is a special use-case because 'special' fuel event overlappes the next normal event in batch mode
2017-05-15 20:28:49 -07:00
assertEqualsM("duty for maf=3", 87.5, getInjectorDutyCycle(eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX));
2016-09-03 10:02:55 -07:00
2016-08-27 13:02:12 -07:00
2016-11-30 19:06:43 -08:00
assertInjectionEvent("#03", &t->elements[0], 0, 0, 315, false);
2016-09-03 10:02:55 -07:00
2017-05-15 20:28:49 -07:00
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2016-09-03 10:02:55 -07:00
2016-09-04 20:02:10 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, enginePins.injectors[0].currentLogicValue) << "inj#0";
2016-09-04 20:02:10 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, engine->executor.size()) << "Queue.size#04";
2019-01-10 19:43:31 -08:00
eth.assertInjectorDownEvent("08@0", 0, MS2US(10), 0);
2016-11-08 22:02:15 -08:00
// assertInjectorDownEvent("08@1", 1, MS2US(10), 0);
// assertInjectorUpEvent("08@2", 2, MS2US(17.5), 0);
// assertInjectorDownEvent("08@3", 3, MS2US(20), 1);
// assertInjectorDownEvent("08@4", 4, MS2US(30), 0);
2016-09-04 20:02:10 -07:00
2016-09-03 10:02:55 -07:00
eth.firePrimaryTriggerFall();
2016-09-04 20:02:10 -07:00
2019-01-10 18:26:02 -08:00
eth.executeActions();
2017-05-15 20:28:49 -07:00
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2016-09-03 10:02:55 -07:00
2018-07-28 16:51:41 -07:00
eth.fireRise(20);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 7, engine->executor.size()) << "Queue.size#05";
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-09-03 10:02:55 -07:00
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-09-03 10:02:55 -07:00
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(MS2US(20));
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-09-03 10:02:55 -07:00
eth.firePrimaryTriggerRise();
2017-05-15 20:28:49 -07:00
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2016-09-03 10:02:55 -07:00
2016-12-18 09:03:48 -08:00
t = &ENGINE(injectionEvents);
2016-11-30 18:06:24 -08:00
2016-11-30 19:06:43 -08:00
assertInjectionEvent("#00", &t->elements[0], 0, 0, 225, false); // 87.5 duty cycle
assertInjectionEvent("#10", &t->elements[1], 1, 1, 45, false);
assertInjectionEvent("#20", &t->elements[2], 0, 1, 225, true);
assertInjectionEvent("#30", &t->elements[3], 1, 0, 45, false);
2016-09-03 10:02:55 -07:00
// todo: what's what? a mix of new something and old something?
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "qs#5";
2016-11-30 20:02:42 -08:00
// assertInjectorDownEvent("8@0", 0, MS2US(5.0), 1);
// assertInjectorUpEvent("8@1", 1, MS2US(7.5), 1);
// assertInjectorDownEvent("8@2", 2, MS2US(15.0), 0);
// assertInjectorUpEvent("8@3", 3, MS2US(17.5), 0);
// assertInjectorDownEvent("8@4", 4, MS2US(25), 1);
// assertInjectorDownEvent("8@5", 5, MS2US(35), 0);
//// assertInjectorDownEvent("8@6", 6, MS2US(35), 0);
//// assertInjectorUpEvent("8@7", 7, MS2US(37.5), 0);
//// assertInjectorDownEvent("8@8", 8, MS2US(45), 1);
//// assertInjectorDownEvent("8@9", 9, MS2US(55), 0);
2016-09-03 10:02:55 -07:00
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-08-27 13:02:12 -07:00
2019-01-10 22:18:35 -08:00
mockMapValue = 0;
2016-08-26 16:02:56 -07:00
testMafValue = 0;
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 2, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testFuelSchedulerBug299smallAndMedium";
ASSERT_EQ(CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0));
ASSERT_EQ(CUSTOM_OBD_SKIPPED_FUEL, unitTestWarningCodeState.recentWarnings.get(1));
2016-08-26 14:02:37 -07:00
}
2016-09-03 10:02:55 -07:00
2017-11-06 19:46:18 -08:00
static void setInjectionMode(int value DECLARE_ENGINE_PARAMETER_SUFFIX) {
engineConfiguration->injectionMode = (injection_mode_e) value;
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
}
TEST(big, testDifferentInjectionModes) {
2017-11-06 19:33:06 -08:00
printf("*************************************************** testDifferentInjectionModes\r\n");
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
2017-11-06 19:33:06 -08:00
setTestBug299(&eth);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#0";
2017-11-06 19:33:06 -08:00
2017-11-06 19:37:27 -08:00
// set fuel map values - extract method?
int engineLoadIndex = findIndex(config->fuelLoadBins, FUEL_LOAD_COUNT, testMafValue);
2019-01-14 12:45:35 -08:00
ASSERT_EQ(8, engineLoadIndex);
2017-11-06 19:37:27 -08:00
setArrayValues(fuelMap.pointers[engineLoadIndex], FUEL_RPM_COUNT, 40);
setArrayValues(fuelMap.pointers[engineLoadIndex + 1], FUEL_RPM_COUNT, 40);
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
assertEqualsM("injectionMode IM_BATCH", (int)IM_BATCH, (int)engineConfiguration->injectionMode);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 20, engine->injectionDuration) << "injection while batch";
2017-11-06 19:46:18 -08:00
setInjectionMode((int)IM_SIMULTANEOUS PASS_ENGINE_PARAMETER_SUFFIX);
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 10, engine->injectionDuration) << "injection while simultaneous";
2017-11-06 19:46:18 -08:00
setInjectionMode((int)IM_SEQUENTIAL PASS_ENGINE_PARAMETER_SUFFIX);
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 40, engine->injectionDuration) << "injection while IM_SEQUENTIAL";
2017-11-06 19:46:18 -08:00
setInjectionMode((int)IM_SINGLE_POINT PASS_ENGINE_PARAMETER_SUFFIX);
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 40, engine->injectionDuration) << "injection while IM_SINGLE_POINT";
ASSERT_EQ( 1, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testDifferentInjectionModes";
2017-11-06 19:33:06 -08:00
}
TEST(big, testFuelSchedulerBug299smallAndLarge) {
2016-09-03 10:02:55 -07:00
printf("*************************************************** testFuelSchedulerBug299 small to large\r\n");
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
2016-09-03 11:01:47 -07:00
setTestBug299(&eth);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#0";
2016-09-03 10:02:55 -07:00
2017-11-06 19:37:27 -08:00
// set fuel map values - extract method?
2016-09-03 11:01:47 -07:00
int engineLoadIndex = findIndex(config->fuelLoadBins, FUEL_LOAD_COUNT, testMafValue);
2019-01-14 12:45:35 -08:00
ASSERT_EQ(8, engineLoadIndex);
2016-09-03 11:01:47 -07:00
setArrayValues(fuelMap.pointers[engineLoadIndex], FUEL_RPM_COUNT, 35);
setArrayValues(fuelMap.pointers[engineLoadIndex + 1], FUEL_RPM_COUNT, 35);
2017-05-15 20:28:49 -07:00
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2017-11-06 19:29:39 -08:00
assertEqualsM("Lfuel#2", 17.5, engine->injectionDuration);
2018-07-28 11:33:32 -07:00
assertEqualsM("Lduty for maf=3", 87.5, getInjectorDutyCycle(engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX));
2016-09-03 11:01:47 -07:00
2016-09-03 22:01:54 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#1";
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(MS2US(20));
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-09-03 22:01:54 -07:00
// injector #1 is low before the test
2019-01-14 16:02:36 -08:00
ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@0";
2016-09-03 22:01:54 -07:00
2016-09-03 11:01:47 -07:00
eth.firePrimaryTriggerRise();
2016-09-03 22:01:54 -07:00
2016-09-03 11:01:47 -07:00
// time...|0.......|10......|20......|30......|40......|50......|60......|
2016-09-03 22:01:54 -07:00
// inj #0 |########|########|########|.....###|########|........|........|
// inj #1 |..######|########|....####|########|........|........|........|
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 6, engine->executor.size()) << "Lqs#4";
2019-01-10 19:43:31 -08:00
eth.assertInjectorUpEvent("L04@0", 0, MS2US(8.5), 0);
eth.assertInjectorUpEvent("L04@1", 1, MS2US(12.5), 0);
2016-09-03 22:01:54 -07:00
// special overlapping injection is merged with one of the scheduled injections
2019-01-10 19:43:31 -08:00
eth.assertInjectorUpEvent("L04@2", 2, MS2US(18.5), 1);
2016-09-03 22:01:54 -07:00
2019-01-10 19:43:31 -08:00
eth.assertInjectorDownEvent("L04@3", 3, MS2US(26), 0);
eth.assertInjectorDownEvent("L04@4", 4, MS2US(30), 0);
2016-09-03 22:01:54 -07:00
2016-11-08 22:02:15 -08:00
// assertInjectorDownEvent("L04@5", 5, MS2US(30), 0);
// assertInjectorUpEvent("L04@6", 6, MS2US(32.5), 0);
// assertInjectorDownEvent("L04@7", 7, MS2US(40.0), 1);
// assertInjectorDownEvent("L04@8", 8, MS2US(50.0), 0);
2016-09-03 22:01:54 -07:00
2016-09-03 10:02:55 -07:00
engine->executor.executeAll(eth.getTimeNowUs() + 1);
2016-09-03 22:01:54 -07:00
// injector goes high...
2019-01-14 16:02:36 -08:00
ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@1";
2016-09-03 10:02:55 -07:00
engine->executor.executeAll(eth.getTimeNowUs() + MS2US(17.5) + 1);
2016-09-04 23:02:00 -07:00
// injector does not go low too soon, that's a feature :)
2019-01-14 15:56:32 -08:00
ASSERT_TRUE(enginePins.injectors[0].currentLogicValue) << "injector@2";
2016-09-03 10:02:55 -07:00
2018-07-28 17:08:48 -07:00
eth.fireFall(20);
2016-09-04 23:02:00 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 6, engine->executor.size()) << "Lqs#04";
2019-01-10 19:43:31 -08:00
eth.assertInjectorUpEvent("L015@0", 0, MS2US(-1.5), 1);
eth.assertInjectorUpEvent("L015@1", 1, MS2US(2.5), 1);
eth.assertInjectorDownEvent("L015@2", 2, MS2US(6), 0);
eth.assertInjectorDownEvent("L015@3", 3, MS2US(10), 0);
eth.assertInjectorDownEvent("L015@4", 4, MS2US(16), 1);
2016-11-30 20:02:42 -08:00
//todo assertInjectorDownEvent("L015@5", 5, MS2US(30), 0);
2016-09-04 23:02:00 -07:00
engine->executor.executeAll(eth.getTimeNowUs() + MS2US(10) + 1);
2016-09-03 22:01:54 -07:00
// end of combined injection
2019-01-14 16:02:36 -08:00
ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@3";
2016-09-04 23:02:00 -07:00
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(MS2US(20));
2019-01-10 18:26:02 -08:00
eth.executeActions();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, engine->executor.size()) << "Lqs#04";
2016-09-04 23:02:00 -07:00
setArrayValues(fuelMap.pointers[engineLoadIndex], FUEL_RPM_COUNT, 4);
setArrayValues(fuelMap.pointers[engineLoadIndex + 1], FUEL_RPM_COUNT, 4);
2017-05-15 20:28:49 -07:00
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 2, engine->injectionDuration) << "Lfuel#4";
ASSERT_EQ( 10, getInjectorDutyCycle(eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX)) << "Lduty for maf=3";
2016-09-04 23:02:00 -07:00
eth.firePrimaryTriggerRise();
2019-01-14 15:38:20 -08:00
//todoASSERT_EQ( 5, engine->executor.size()) << "Lqs#05";
2016-11-30 20:02:42 -08:00
//todo assertInjectorUpEvent("L016@0", 0, MS2US(8), 0);
//todo assertInjectorDownEvent("L016@1", 1, MS2US(10), 0);
//todo assertInjectorDownEvent("L016@2", 2, MS2US(10), 0);
2016-09-04 23:02:00 -07:00
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(MS2US(20));
2019-01-10 18:26:02 -08:00
eth.executeActions(); // issue here
2016-09-04 23:02:00 -07:00
eth.firePrimaryTriggerFall();
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(MS2US(20));
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-09-04 23:02:00 -07:00
eth.firePrimaryTriggerRise();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#5";
2019-01-10 19:43:31 -08:00
eth.assertInjectorUpEvent("L05@0", 0, MS2US(8), 0);
eth.assertInjectorDownEvent("L05@1", 1, MS2US(10), 0);
eth.assertInjectorUpEvent("L05@2", 2, MS2US(18), 1);
eth.assertInjectorDownEvent("L05@3", 3, MS2US(20), 1);
2016-09-04 23:02:00 -07:00
2019-01-10 18:19:46 -08:00
eth.moveTimeForwardUs(MS2US(20));
eth.executeActions();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 2, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testFuelSchedulerBug299smallAndLarge";
ASSERT_EQ(CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0));
ASSERT_EQ(CUSTOM_OBD_SKIPPED_FUEL, unitTestWarningCodeState.recentWarnings.get(1));
2016-09-03 10:02:55 -07:00
}
2016-10-31 17:02:09 -07:00
TEST(big, testSparkReverseOrderBug319) {
2016-10-31 17:02:09 -07:00
printf("*************************************************** testSparkReverseOrderBug319 small to medium\r\n");
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
2016-10-31 17:02:09 -07:00
2016-10-31 19:02:12 -07:00
engineConfiguration->useOnlyRisingEdgeForTrigger = false;
2016-10-31 17:02:09 -07:00
engineConfiguration->isInjectionEnabled = false;
engineConfiguration->specs.cylindersCount = 4;
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
2017-05-15 20:28:49 -07:00
setConstantDwell(45 PASS_ENGINE_PARAMETER_SUFFIX);
2016-10-31 19:02:12 -07:00
// this is needed to update injectorLag
2017-05-15 20:28:49 -07:00
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
2016-10-31 19:02:12 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT";
2016-10-31 19:02:12 -07:00
2016-10-31 17:02:09 -07:00
engineConfiguration->trigger.type = TT_ONE;
2017-05-15 20:28:49 -07:00
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
2016-10-31 19:02:12 -07:00
eth.applyTriggerShape();
2017-05-15 20:28:49 -07:00
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2016-10-31 17:02:09 -07:00
setWholeTimingTable(0);
2016-10-31 17:02:09 -07:00
2018-07-28 16:51:41 -07:00
eth.fireRise(20);
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2016-10-31 17:02:09 -07:00
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-10-31 17:02:09 -07:00
2018-07-28 16:51:41 -07:00
eth.fireRise(20);
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2016-10-31 17:02:09 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "testSparkReverseOrderBug319: RPM";
2016-10-31 19:02:12 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 7, engine->executor.size()) << "testSparkReverseOrderBug319: queue size";
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-10-31 19:02:12 -07:00
printf("***************************************************\r\n");
2018-07-28 16:51:41 -07:00
eth.fireRise(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-10-31 19:02:12 -07:00
2019-01-12 19:24:29 -08:00
/**
* here we throw scheduling logic off
*/
eth.fireFall(0.1); // executing new signal too early
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-10-31 17:02:09 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #1";
2016-10-31 19:02:12 -07:00
2019-01-10 20:15:24 -08:00
eth.moveTimeForwardUs(MS2US(200)); // moving time forward to execute all pending actions
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-10-31 17:02:09 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, enginePins.coils[3].outOfOrder) << "out-of-order #2";
2016-11-01 18:03:07 -07:00
printf("*************************************************** now let's have a good engine cycle and confirm things work\r\n");
2018-07-28 16:51:41 -07:00
eth.fireRise(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-11-01 18:03:07 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 545, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#2";
2016-11-01 18:03:07 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, enginePins.coils[3].outOfOrder) << "out-of-order #3";
2016-11-01 18:03:07 -07:00
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #4";
2016-11-01 18:03:07 -07:00
printf("*************************************************** (rpm is back) now let's have a good engine cycle and confirm things work\r\n");
2018-07-28 16:51:41 -07:00
eth.fireRise(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-11-01 18:03:07 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#3";
2016-11-01 18:03:07 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #5 on c4";
2016-11-01 18:03:07 -07:00
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #6 on c4";
2016-11-01 18:03:07 -07:00
printf("*************************************************** (rpm is back 2) now let's have a good engine cycle and confirm things work\r\n");
2018-07-28 16:51:41 -07:00
eth.fireRise(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-11-01 18:03:07 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#4";
2016-11-01 18:03:07 -07:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #7";
2016-11-01 18:03:07 -07:00
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, enginePins.coils[3].outOfOrder) << "out-of-order #8";
ASSERT_EQ( 3, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#SparkReverseOrderBug319";
ASSERT_EQ(CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0));
ASSERT_EQ(CUSTOM_DWELL_TOO_LONG, unitTestWarningCodeState.recentWarnings.get(1));
ASSERT_EQ(CUSTOM_OUT_OF_ORDER_COIL, unitTestWarningCodeState.recentWarnings.get(2));
2016-10-31 17:02:09 -07:00
}
2016-11-07 19:02:21 -08:00
2019-01-10 20:24:36 -08:00
TEST(big, testMissedSpark299) {
2016-11-07 19:02:21 -08:00
printf("*************************************************** testMissedSpark299\r\n");
2019-01-19 17:42:29 -08:00
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
2016-11-07 20:01:47 -08:00
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
2016-11-08 19:02:47 -08:00
engineConfiguration->useOnlyRisingEdgeForTrigger = false;
2018-03-04 13:13:23 -08:00
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth);
2016-11-07 19:02:21 -08:00
engineConfiguration->isIgnitionEnabled = true;
engineConfiguration->isInjectionEnabled = false;
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#0";
2016-11-07 19:02:21 -08:00
2018-07-28 17:02:01 -07:00
eth.fireRise(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, eth.engine.triggerCentral.triggerState.currentCycle.current_index) << "ci#0";
2016-11-08 21:02:01 -08:00
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, eth.engine.triggerCentral.triggerState.currentCycle.current_index) << "ci#1";
2016-11-07 19:02:21 -08:00
2018-07-28 17:02:01 -07:00
eth.fireRise(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 0, eth.engine.triggerCentral.triggerState.currentCycle.current_index) << "ci#2";
2016-11-08 21:02:01 -08:00
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, eth.engine.triggerCentral.triggerState.currentCycle.current_index) << "ci#3";
2016-11-07 20:01:47 -08:00
2018-07-28 16:51:41 -07:00
eth.fireRise(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-11-07 19:02:21 -08:00
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, eth.engine.triggerCentral.triggerState.currentCycle.current_index) << "ci#5";
2016-11-08 21:02:01 -08:00
2016-11-07 20:01:47 -08:00
printf("*************************************************** testMissedSpark299 start\r\n");
2019-01-14 12:45:35 -08:00
ASSERT_EQ(3000, eth.engine.rpmCalculator.rpmValue);
2016-11-07 19:02:21 -08:00
setWholeTimingTable(3);
2017-05-15 20:28:49 -07:00
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2016-11-07 19:02:21 -08:00
2016-11-07 20:01:47 -08:00
2018-07-28 17:02:01 -07:00
eth.fireRise(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-11-07 20:01:47 -08:00
2018-07-28 17:02:01 -07:00
eth.fireRise(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-11-07 19:02:21 -08:00
setWholeTimingTable(-5);
2017-05-15 20:28:49 -07:00
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
2016-11-07 20:01:47 -08:00
2018-07-28 16:51:41 -07:00
eth.fireRise(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-11-07 20:01:47 -08:00
2018-07-28 16:51:41 -07:00
eth.fireRise(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2018-07-28 17:06:55 -07:00
eth.fireFall(20);
2019-01-10 18:26:02 -08:00
eth.executeActions();
2016-11-07 20:01:47 -08:00
2019-01-14 15:38:20 -08:00
ASSERT_EQ( 1, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#1";
assertEqualsM("warningCounter code", CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0));
2016-11-07 19:02:21 -08:00
}