auto-sync

This commit is contained in:
rusEfi 2015-03-22 10:14:22 -05:00
parent 572aad3a26
commit 90d4d734f6
4 changed files with 16 additions and 7 deletions

View File

@ -41,7 +41,8 @@
static histogram_s waveChartHisto; static histogram_s waveChartHisto;
#endif #endif
EXTERN_ENGINE; EXTERN_ENGINE
;
extern uint32_t maxLockTime; extern uint32_t maxLockTime;
/** /**
@ -64,14 +65,19 @@ static Logging debugLogging;
static LoggingWithStorage logger("wave info"); 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 #if ! EFI_UNIT_TEST
extern WaveChart waveChart; extern WaveChart waveChart;
static void resetWaveChartNow(void) { static void resetWaveChartNow(void) {
skipUntilEngineCycle = engine->rpmCalculator.getRevolutionCounter() + 3;
waveChart.resetWaveChart(); waveChart.resetWaveChart();
} }
#endif #endif
void WaveChart::resetWaveChart() { void WaveChart::resetWaveChart() {
#if DEBUG_WAVE #if DEBUG_WAVE
scheduleSimpleMsg(&debugLogging, "reset while at ", counter); scheduleSimpleMsg(&debugLogging, "reset while at ", counter);
@ -92,7 +98,7 @@ bool_t WaveChart::isStartedTooLongAgo() {
* *
*/ */
uint64_t chartDurationNt = getTimeNowNt() - startTimeNt; 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() { bool_t WaveChart::isWaveChartFull() {
@ -153,8 +159,10 @@ static char timeBuffer[10];
* @brief Register an event for digital sniffer * @brief Register an event for digital sniffer
*/ */
void WaveChart::addWaveChartEvent3(const char *name, const char * msg) { void WaveChart::addWaveChartEvent3(const char *name, const char * msg) {
if (engine->rpmCalculator.getRevolutionCounter() < skipUntilEngineCycle)
return;
efiAssertVoid(name!=NULL, "WC: NULL name"); efiAssertVoid(name!=NULL, "WC: NULL name");
if(!engineConfiguration->isDigitalChartEnabled) { if (!engineConfiguration->isDigitalChartEnabled) {
return; return;
} }
@ -195,7 +203,6 @@ void WaveChart::addWaveChartEvent3(const char *name, const char * msg) {
uint32_t diffNt = nowNt - startTimeNt; uint32_t diffNt = nowNt - startTimeNt;
uint32_t time100 = NT2US(diffNt / 10); uint32_t time100 = NT2US(diffNt / 10);
if (remainingSize(&logging) > 35) { if (remainingSize(&logging) > 35) {
/** /**
* printf is a heavy method, append is used here as a performance optimization * printf is a heavy method, append is used here as a performance optimization

View File

@ -276,5 +276,5 @@ int getRusEfiVersion(void) {
return 1; // this is here to make the compiler happy about the unused array return 1; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] == 0) if (UNUSED_CCM_SIZE[0] == 0)
return 1; // this is here to make the compiler happy about the unused array return 1; // this is here to make the compiler happy about the unused array
return 20150321; return 20150322;
} }

View File

@ -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) { static void assertWave(boolean rise, String msg, WaveChart chart, String key, double expectedWidth, double angleRatio, double widthRatio, double... expectedAngles) {
if(isRealHardware) if (isRealHardware)
return; return;
RevolutionLog revolutionLog = chart.getRevolutionsLog(); RevolutionLog revolutionLog = chart.getRevolutionsLog();
if (revolutionLog.keySet().isEmpty()) if (revolutionLog.keySet().isEmpty())
@ -111,6 +111,7 @@ public class TestingUtils {
static String getNextWaveChart() { static String getNextWaveChart() {
// we need to skip TWO because spark could have been scheduled a while ago and happen now // we need to skip TWO because spark could have been scheduled a while ago and happen now
// todo: improve this logic, compare times // todo: improve this logic, compare times
IoUtil.sendCommand("reset_wave_chart");
getWaveChart(); getWaveChart();
getWaveChart(); getWaveChart();
// we want to wait for the 2nd chart to see same same RPM across the whole chart // we want to wait for the 2nd chart to see same same RPM across the whole chart

View File

@ -167,6 +167,7 @@ public class WaveReport implements TimeAxisTranslator {
return "UpDown{" + return "UpDown{" +
"upTime=" + upTime + "upTime=" + upTime +
", downTime=" + downTime + ", downTime=" + downTime +
", d=" + getDuration() +
'}'; '}';
} }