mirror of https://github.com/FOME-Tech/fome-fw.git
parent
318a817527
commit
b76c015581
|
@ -145,7 +145,7 @@ public:
|
|||
int lastErrorCode;
|
||||
efitimesec_t timeOfPreviousWarning;
|
||||
// todo: we need a way to post multiple recent warnings into TS
|
||||
cyclic_buffer<int, 8> recentWarning;
|
||||
cyclic_buffer<int, 8> recentWarnings;
|
||||
};
|
||||
|
||||
class EngineState {
|
||||
|
|
|
@ -44,14 +44,14 @@ void WarningCodeState::clear() {
|
|||
warningCounter = 0;
|
||||
lastErrorCode = 0;
|
||||
timeOfPreviousWarning = -10;
|
||||
recentWarning.clear();
|
||||
recentWarnings.clear();
|
||||
}
|
||||
|
||||
void WarningCodeState::addWarningCode(obd_code_e code) {
|
||||
warningCounter++;
|
||||
lastErrorCode = code;
|
||||
if (!recentWarning.contains(code)) {
|
||||
recentWarning.add((int)code);
|
||||
if (!recentWarnings.contains(code)) {
|
||||
recentWarnings.add((int)code);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,18 +61,11 @@ GTEST_API_ int main(int argc, char **argv) {
|
|||
// printTriggerDebug = true;
|
||||
|
||||
testMisc();
|
||||
testDifferentInjectionModes();
|
||||
/**
|
||||
* PID
|
||||
*/
|
||||
testPidAuto();
|
||||
|
||||
/**
|
||||
* Larger-scale engine control
|
||||
*/
|
||||
testSparkReverseOrderBug319();
|
||||
testFuelSchedulerBug299smallAndLarge();
|
||||
testFuelSchedulerBug299smallAndMedium();
|
||||
testLogicExpressions(); // fsio
|
||||
testPlainCrankingWithoutAdvancedFeatures();
|
||||
testStartOfCrankingPrimingPulse();
|
||||
|
|
|
@ -746,7 +746,7 @@ static void assertInjectors(const char *msg, int value0, int value1) {
|
|||
assertEqualsM4(msg, "inj#1", value1, enginePins.injectors[1].currentLogicValue);
|
||||
}
|
||||
|
||||
void testFuelSchedulerBug299smallAndMedium(void) {
|
||||
TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
||||
printf("*************************************************** testFuelSchedulerBug299 small to medium\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
|
@ -988,6 +988,9 @@ void testFuelSchedulerBug299smallAndMedium(void) {
|
|||
|
||||
mockMapValue = 0;
|
||||
testMafValue = 0;
|
||||
assertEqualsM("warningCounter#testFuelSchedulerBug299smallAndMedium", 2, unitTestWarningCodeState.recentWarnings.getCount());
|
||||
ASSERT_EQ(CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0));
|
||||
ASSERT_EQ(CUSTOM_OBD_SKIPPED_FUEL, unitTestWarningCodeState.recentWarnings.get(1));
|
||||
}
|
||||
|
||||
static void setInjectionMode(int value DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
|
@ -995,8 +998,7 @@ static void setInjectionMode(int value DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
|
||||
|
||||
void testDifferentInjectionModes(void) {
|
||||
TEST(big, testDifferentInjectionModes) {
|
||||
printf("*************************************************** testDifferentInjectionModes\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
|
@ -1025,9 +1027,10 @@ void testDifferentInjectionModes(void) {
|
|||
setInjectionMode((int)IM_SINGLE_POINT PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("injection while IM_SINGLE_POINT", 40, engine->injectionDuration);
|
||||
assertEqualsM("warningCounter#testDifferentInjectionModes", 1, unitTestWarningCodeState.recentWarnings.getCount());
|
||||
}
|
||||
|
||||
void testFuelSchedulerBug299smallAndLarge(void) {
|
||||
TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
||||
printf("*************************************************** testFuelSchedulerBug299 small to large\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
|
@ -1135,9 +1138,12 @@ void testFuelSchedulerBug299smallAndLarge(void) {
|
|||
|
||||
eth.moveTimeForwardUs(MS2US(20));
|
||||
eth.executeActions();
|
||||
assertEqualsM("warningCounter#testFuelSchedulerBug299smallAndLarge", 2, unitTestWarningCodeState.recentWarnings.getCount());
|
||||
ASSERT_EQ(CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0));
|
||||
ASSERT_EQ(CUSTOM_OBD_SKIPPED_FUEL, unitTestWarningCodeState.recentWarnings.get(1));
|
||||
}
|
||||
|
||||
void testSparkReverseOrderBug319(void) {
|
||||
TEST(big, testSparkReverseOrderBug319) {
|
||||
printf("*************************************************** testSparkReverseOrderBug319 small to medium\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
|
@ -1237,6 +1243,10 @@ void testSparkReverseOrderBug319(void) {
|
|||
eth.fireFall(20);
|
||||
eth.executeActions();
|
||||
assertEqualsM("out-of-order #8", 0, enginePins.coils[3].outOfOrder);
|
||||
assertEqualsM("warningCounter#SparkReverseOrderBug319", 3, unitTestWarningCodeState.recentWarnings.getCount());
|
||||
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));
|
||||
}
|
||||
|
||||
TEST(big, testMissedSpark299) {
|
||||
|
@ -1250,7 +1260,7 @@ TEST(big, testMissedSpark299) {
|
|||
engineConfiguration->isIgnitionEnabled = true;
|
||||
engineConfiguration->isInjectionEnabled = false;
|
||||
|
||||
assertEqualsM("warningCounter#0", 0, unitTestWarningCodeState.warningCounter);
|
||||
assertEqualsM("warningCounter#0", 0, unitTestWarningCodeState.recentWarnings.getCount());
|
||||
|
||||
|
||||
eth.fireRise(20);
|
||||
|
@ -1320,6 +1330,6 @@ TEST(big, testMissedSpark299) {
|
|||
eth.fireFall(20);
|
||||
eth.executeActions();
|
||||
|
||||
assertEqualsM("warningCounter#1", 1, unitTestWarningCodeState.warningCounter);
|
||||
assertEqualsM("warningCounter code", CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarning.get(0));
|
||||
assertEqualsM("warningCounter#1", 1, unitTestWarningCodeState.recentWarnings.getCount());
|
||||
assertEqualsM("warningCounter code", CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0));
|
||||
}
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
#include "engine_test_helper.h"
|
||||
|
||||
void testTriggerDecoder(void);
|
||||
void testFuelSchedulerBug299smallAndMedium(void);
|
||||
void testFuelSchedulerBug299smallAndLarge(void);
|
||||
void testDifferentInjectionModes(void);
|
||||
void testSparkReverseOrderBug319(void);
|
||||
void testRpmCalculator(void);
|
||||
void testStartupFuelPumping(void);
|
||||
void test1995FordInline6TriggerDecoder(void);
|
||||
|
|
Loading…
Reference in New Issue