From 094f45f0416b56b638ed4111877203ce8cd6ebf9 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Thu, 16 Apr 2015 00:04:50 -0400 Subject: [PATCH] auto-sync --- firmware/controllers/map_averaging.cpp | 4 ++-- firmware/controllers/trigger/rpm_calculator.cpp | 4 ++-- firmware/controllers/trigger/rpm_calculator.h | 2 +- firmware/hw_layer/HIP9011.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/firmware/controllers/map_averaging.cpp b/firmware/controllers/map_averaging.cpp index fbe6810f22..a565331f9c 100644 --- a/firmware/controllers/map_averaging.cpp +++ b/firmware/controllers/map_averaging.cpp @@ -185,8 +185,8 @@ static void mapAveragingCallback(trigger_event_e ckpEventType, uint32_t index DE int structIndex = getRevolutionCounter() % 2; // todo: schedule this based on closest trigger event, same as ignition works - scheduleByAngle(rpm, &startTimer[structIndex], samplingStart, startAveraging, NULL); - scheduleByAngle(rpm, &endTimer[structIndex], samplingStart + samplingDuration, endAveraging, NULL); + scheduleByAngle(rpm, &startTimer[structIndex], samplingStart, startAveraging, NULL, &engine->rpmCalculator); + scheduleByAngle(rpm, &endTimer[structIndex], samplingStart + samplingDuration, endAveraging, NULL, &engine->rpmCalculator); engine->m.mapAveragingCbTime = GET_TIMESTAMP() - engine->m.beforeMapAveragingCb; } diff --git a/firmware/controllers/trigger/rpm_calculator.cpp b/firmware/controllers/trigger/rpm_calculator.cpp index 567a9e4a1b..9782aa5c8d 100644 --- a/firmware/controllers/trigger/rpm_calculator.cpp +++ b/firmware/controllers/trigger/rpm_calculator.cpp @@ -205,7 +205,7 @@ static void tdcMarkCallback(trigger_event_e ckpSignalType, uint32_t index0 DECLA int rpm = getRpm(); // todo: use event-based scheduling, not just time-based scheduling scheduleByAngle(rpm, &tdcScheduler[revIndex2], tdcPosition(), - (schfunc_t) onTdcCallback, NULL); + (schfunc_t) onTdcCallback, NULL, &engine->rpmCalculator); } } #endif @@ -248,7 +248,7 @@ void initRpmCalculator(Engine *engine) { * The callback would be executed once after the duration of time which * it takes the crankshaft to rotate to the specified angle. */ -void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param) { +void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param, RpmCalculator *calc) { if (!isValidRpm(rpm)) { /** * this might happen in case of a single trigger event after a pause - this is normal, so no diff --git a/firmware/controllers/trigger/rpm_calculator.h b/firmware/controllers/trigger/rpm_calculator.h index bd14b0ce8e..8858d0b2c9 100644 --- a/firmware/controllers/trigger/rpm_calculator.h +++ b/firmware/controllers/trigger/rpm_calculator.h @@ -103,6 +103,6 @@ bool isCranking(void); #define addWaveChartEvent(n, msg) {} #endif /* EFI_WAVE_CHART */ -void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param); +void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param, RpmCalculator *calc); #endif /* RPM_REPORTER_H_ */ diff --git a/firmware/hw_layer/HIP9011.cpp b/firmware/hw_layer/HIP9011.cpp index 8d18064604..e82f890a23 100644 --- a/firmware/hw_layer/HIP9011.cpp +++ b/firmware/hw_layer/HIP9011.cpp @@ -173,10 +173,10 @@ static void intHoldCallback(trigger_event_e ckpEventType, uint32_t index DECLARE int structIndex = getRevolutionCounter() % 2; // todo: schedule this based on closest trigger event, same as ignition works scheduleByAngle(rpm, &startTimer[structIndex], engineConfiguration->knockDetectionWindowStart, - (schfunc_t) &startIntegration, NULL); + (schfunc_t) &startIntegration, NULL, &engine->rpmCalculator); scheduleByAngle(rpm, &endTimer[structIndex], engineConfiguration->knockDetectionWindowEnd, (schfunc_t) &endIntegration, - NULL); + NULL, &engine->rpmCalculator); engine->m.hipCbTime = GET_TIMESTAMP() - engine->m.beforeHipCb; }