auto-sync

This commit is contained in:
rusEfi 2015-02-12 14:04:02 -06:00
parent 555110df43
commit 192c439f0b
3 changed files with 17 additions and 5 deletions

View File

@ -21,9 +21,7 @@
#include "main.h" #include "main.h"
#include "advance_map.h" #include "advance_map.h"
#include "interpolation.h" #include "interpolation.h"
// that's for 'max' function #include "efilib2.h"
#include "idle_controller.h"
#include "engine_configuration.h" #include "engine_configuration.h"
#include "engine_math.h" #include "engine_math.h"
@ -38,8 +36,14 @@ float getBaseAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S) {
} }
efiAssert(!cisnan(engineLoad), "invalid el", NAN); efiAssert(!cisnan(engineLoad), "invalid el", NAN);
efiAssert(!cisnan(engineLoad), "invalid rpm", NAN); efiAssert(!cisnan(engineLoad), "invalid rpm", NAN);
return advanceMap.getValue(engineLoad, engineConfiguration->ignitionLoadBins, (float) rpm, engine->m.beforeZeroTest = GET_TIMESTAMP();
engine->m.zeroTestTime = GET_TIMESTAMP() - engine->m.beforeZeroTest;
engine->m.beforeAdvance = GET_TIMESTAMP();
float result = advanceMap.getValue(engineLoad, engineConfiguration->ignitionLoadBins, (float) rpm,
engineConfiguration->ignitionRpmBins); engineConfiguration->ignitionRpmBins);
engine->m.advanceTime = GET_TIMESTAMP() - engine->m.beforeAdvance;
return result;
} }
float getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S) { float getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_S) {

View File

@ -100,6 +100,12 @@ typedef struct {
uint32_t beforeInjectonSch; uint32_t beforeInjectonSch;
uint32_t injectonSchTime; uint32_t injectonSchTime;
uint32_t beforeZeroTest;
uint32_t zeroTestTime;
uint32_t beforeAdvance;
uint32_t advanceTime;
} monitoring_timestamps_s; } monitoring_timestamps_s;
class Engine { class Engine {

View File

@ -265,11 +265,13 @@ void triggerInfo(Engine *engine) {
#endif #endif
#if EFI_PROD_CODE #if EFI_PROD_CODE
scheduleMsg(logger, "sn=%s ignitionMathTime=%d schTime=%d injectonSchTime=%d triggerMaxDuration=%d", scheduleMsg(logger, "sn=%s ignitionMathTime=%d schTime=%d injectonSchTime=%d zeroTestTime=%d advanceTime=%d triggerMaxDuration=%d",
boolToString(ts->isSynchronizationNeeded), boolToString(ts->isSynchronizationNeeded),
engine->m.ignitionMathTime, engine->m.ignitionMathTime,
engine->m.ignitionSchTime, engine->m.ignitionSchTime,
engine->m.injectonSchTime, engine->m.injectonSchTime,
engine->m.zeroTestTime,
engine->m.advanceTime,
triggerMaxDuration); triggerMaxDuration);
triggerMaxDuration = 0; triggerMaxDuration = 0;