giving unit tests a chance to use tdcMarkCallback

This commit is contained in:
Andrey 2021-06-25 01:31:53 -04:00
parent c0aeb39301
commit 71fdfe6756
8 changed files with 13 additions and 3 deletions

View File

@ -185,6 +185,9 @@ public:
* this is based on isEngineChartEnabled and engineSnifferRpmThreshold settings
*/
bool isEngineChartEnabled = false;
bool tdcMarkEnabled = true; // used by unit tests only
/**
* this is based on sensorChartMode and sensorSnifferRpmThreshold settings
*/

View File

@ -352,7 +352,7 @@ static void onTdcCallback(Engine *engine) {
void tdcMarkCallback(
uint32_t index0, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
bool isTriggerSynchronizationPoint = index0 == 0;
if (isTriggerSynchronizationPoint && ENGINE(isEngineChartEnabled)) {
if (isTriggerSynchronizationPoint && ENGINE(isEngineChartEnabled) && ENGINE(tdcMarkEnabled)) {
// two instances of scheduling_s are needed to properly handle event overlap
int revIndex2 = getRevolutionCounter() % 2;
int rpm = GET_RPM();

View File

@ -548,9 +548,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
rpmShaftPositionCallback(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
#if !EFI_UNIT_TEST
tdcMarkCallback(triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
#endif
#if !EFI_UNIT_TEST
#if EFI_MAP_AVERAGING

View File

@ -29,6 +29,7 @@ static void doRevolution(EngineTestHelper& eth, int periodMs) {
// https://github.com/rusefi/rusefi/issues/1592
TEST(fuelControl, transitionIssue1592) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
ENGINE(tdcMarkEnabled) = false;
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth, IM_SEQUENTIAL);
EXPECT_CALL(eth.mockAirmass, getAirmass(400))

View File

@ -8,6 +8,7 @@
TEST(issues, issueOneCylinderSpecialCase968) {
WITH_ENGINE_TEST_HELPER(GY6_139QMB);
ENGINE(tdcMarkEnabled) = false;
// set injection_mode 1
engineConfiguration->injectionMode = IM_SEQUENTIAL;

View File

@ -10,6 +10,7 @@
TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
ENGINE(tdcMarkEnabled) = false;
engineConfiguration->cranking.baseFuel = 12;
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth);

View File

@ -9,6 +9,7 @@
TEST(cranking, testFasterEngineSpinningUp) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
ENGINE(tdcMarkEnabled) = false;
// turn on FasterEngineSpinUp mode
engineConfiguration->isFasterEngineSpinUpEnabled = true;
engineConfiguration->cranking.baseFuel = 12;

View File

@ -298,6 +298,8 @@ extern bool_t debugSignalExecutor;
TEST(misc, testRpmCalculator) {
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
ENGINE(tdcMarkEnabled) = false;
// These tests were written when the default target AFR was 14.0, so replicate that
engineConfiguration->stoichRatioPrimary = 140;
@ -689,6 +691,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
printf("*************************************************** testFuelSchedulerBug299 small to medium\r\n");
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
ENGINE(tdcMarkEnabled) = false;
eth.moveTimeForwardMs(startUpDelayMs); // nice to know that same test works the same with different anount of idle time on start
setTestBug299(&eth);
@ -987,6 +990,7 @@ TEST(big, testSequential) {
TEST(big, testFuelSchedulerBug299smallAndLarge) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
ENGINE(tdcMarkEnabled) = false;
setTestBug299(&eth);
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#0";
@ -1101,6 +1105,7 @@ TEST(big, testSparkReverseOrderBug319) {
printf("*************************************************** testSparkReverseOrderBug319 small to medium\r\n");
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
ENGINE(tdcMarkEnabled) = false;
engineConfiguration->useOnlyRisingEdgeForTrigger = false;
engineConfiguration->isInjectionEnabled = false;