From 90d4d734f6d468eb7b1fda3178ff16bba82a7dc5 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sun, 22 Mar 2015 10:14:22 -0500 Subject: [PATCH] auto-sync --- firmware/development/wave_chart.cpp | 17 ++++++++++++----- firmware/rusefi.cpp | 2 +- .../autotest/src/com/rusefi/TestingUtils.java | 3 ++- .../models/src/com/rusefi/waves/WaveReport.java | 1 + 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/firmware/development/wave_chart.cpp b/firmware/development/wave_chart.cpp index 5636721321..65655f5162 100644 --- a/firmware/development/wave_chart.cpp +++ b/firmware/development/wave_chart.cpp @@ -41,7 +41,8 @@ static histogram_s waveChartHisto; #endif -EXTERN_ENGINE; +EXTERN_ENGINE +; extern uint32_t maxLockTime; /** @@ -64,14 +65,19 @@ static Logging debugLogging; static LoggingWithStorage logger("wave info"); +/** + * We want to skip some engine cycles to skip what was scheduled before parameters were changed + */ +uint32_t skipUntilEngineCycle = 0; + #if ! EFI_UNIT_TEST extern WaveChart waveChart; static void resetWaveChartNow(void) { + skipUntilEngineCycle = engine->rpmCalculator.getRevolutionCounter() + 3; waveChart.resetWaveChart(); } #endif - void WaveChart::resetWaveChart() { #if DEBUG_WAVE scheduleSimpleMsg(&debugLogging, "reset while at ", counter); @@ -92,7 +98,7 @@ bool_t WaveChart::isStartedTooLongAgo() { * */ uint64_t chartDurationNt = getTimeNowNt() - startTimeNt; - return startTimeNt!= 0 && NT2US(chartDurationNt) > engineConfiguration->digitalChartSize * 1000000 / 20; + return startTimeNt != 0 && NT2US(chartDurationNt) > engineConfiguration->digitalChartSize * 1000000 / 20; } bool_t WaveChart::isWaveChartFull() { @@ -153,8 +159,10 @@ static char timeBuffer[10]; * @brief Register an event for digital sniffer */ void WaveChart::addWaveChartEvent3(const char *name, const char * msg) { + if (engine->rpmCalculator.getRevolutionCounter() < skipUntilEngineCycle) + return; efiAssertVoid(name!=NULL, "WC: NULL name"); - if(!engineConfiguration->isDigitalChartEnabled) { + if (!engineConfiguration->isDigitalChartEnabled) { return; } @@ -195,7 +203,6 @@ void WaveChart::addWaveChartEvent3(const char *name, const char * msg) { uint32_t diffNt = nowNt - startTimeNt; uint32_t time100 = NT2US(diffNt / 10); - if (remainingSize(&logging) > 35) { /** * printf is a heavy method, append is used here as a performance optimization diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 7fed271bf1..15d017c530 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -276,5 +276,5 @@ int getRusEfiVersion(void) { return 1; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE[0] == 0) return 1; // this is here to make the compiler happy about the unused array - return 20150321; + return 20150322; } diff --git a/java_console/autotest/src/com/rusefi/TestingUtils.java b/java_console/autotest/src/com/rusefi/TestingUtils.java index 9ed0d09381..168e3e2063 100644 --- a/java_console/autotest/src/com/rusefi/TestingUtils.java +++ b/java_console/autotest/src/com/rusefi/TestingUtils.java @@ -75,7 +75,7 @@ public class TestingUtils { } static void assertWave(boolean rise, String msg, WaveChart chart, String key, double expectedWidth, double angleRatio, double widthRatio, double... expectedAngles) { - if(isRealHardware) + if (isRealHardware) return; RevolutionLog revolutionLog = chart.getRevolutionsLog(); if (revolutionLog.keySet().isEmpty()) @@ -111,6 +111,7 @@ public class TestingUtils { static String getNextWaveChart() { // we need to skip TWO because spark could have been scheduled a while ago and happen now // todo: improve this logic, compare times + IoUtil.sendCommand("reset_wave_chart"); getWaveChart(); getWaveChart(); // we want to wait for the 2nd chart to see same same RPM across the whole chart diff --git a/java_console/models/src/com/rusefi/waves/WaveReport.java b/java_console/models/src/com/rusefi/waves/WaveReport.java index 64f20d1a28..ab605db158 100644 --- a/java_console/models/src/com/rusefi/waves/WaveReport.java +++ b/java_console/models/src/com/rusefi/waves/WaveReport.java @@ -167,6 +167,7 @@ public class WaveReport implements TimeAxisTranslator { return "UpDown{" + "upTime=" + upTime + ", downTime=" + downTime + + ", d=" + getDuration() + '}'; }