diff --git a/firmware/controllers/trigger/trigger_bmw.cpp b/firmware/controllers/trigger/trigger_bmw.cpp index 7401b78118..68109a2b66 100644 --- a/firmware/controllers/trigger/trigger_bmw.cpp +++ b/firmware/controllers/trigger/trigger_bmw.cpp @@ -69,5 +69,5 @@ void configureMiniCooperTriggerShape(trigger_shape_s *s) { /** * With just one tooth on camshaft synchronization is not needed */ - s->isSynchronizationNeeded = FALSE; + s->isSynchronizationNeeded = false; } diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index f34523ebbf..2975674052 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -190,15 +190,20 @@ static void triggerShapeInfo(Engine *engine) { static void triggerInfo(Engine *engine) { #if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) + + trigger_shape_s *ts = &engineConfiguration2->triggerShape; + scheduleMsg(&logger, "Template %s/%d trigger %d", getConfigurationName(engineConfiguration->engineType), engineConfiguration->engineType, engineConfiguration->triggerConfig.triggerType); + scheduleMsg(&logger, "sn=%d", ts->isSynchronizationNeeded); + scheduleMsg(&logger, "trigger event counters %d/%d/%d/%d", triggerCentral.getHwEventCounter(0), triggerCentral.getHwEventCounter(1), triggerCentral.getHwEventCounter(2), triggerCentral.getHwEventCounter(3)); scheduleMsg(&logger, "expected cycle events %d/%d/%d", engineConfiguration2->triggerShape.expectedEventCount[0], engineConfiguration2->triggerShape.expectedEventCount[1], - engineConfiguration2->triggerShape.expectedEventCount[2]); + ts->expectedEventCount[2]); scheduleMsg(&logger, "trigger type=%d/need2ndChannel=%s", engineConfiguration->triggerConfig.triggerType, boolToString(engineConfiguration->needSecondTriggerInput)); @@ -245,5 +250,4 @@ void initTriggerCentral(Engine *engine) { #if EFI_HISTOGRAMS initHistogram(&triggerCallback, "all callbacks"); #endif /* EFI_HISTOGRAMS */ - initTriggerDecoder(); } diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index fc694a4044..4a9c18d998 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -39,6 +39,9 @@ static cyclic_buffer errorDetection; bool printGapRatio = false; +#else + Logging logger; + #endif /* ! EFI_PROD_CODE */ /** @@ -60,6 +63,9 @@ static inline bool isSynchronizationGap(TriggerState const *shaftPositionState, float gap = 1.0 * currentDuration / shaftPositionState->toothed_previous_duration; print("current gap %f\r\n", gap); } +#else +// float gap = 1.0 * currentDuration / shaftPositionState->toothed_previous_duration; +// scheduleMsg(&logger, "gap=%f", gap); #endif /* ! EFI_PROD_CODE */ @@ -390,7 +396,7 @@ uint32_t findTriggerZeroEventIndex(trigger_shape_s * shape, trigger_config_s con void initTriggerDecoder(void) { #if EFI_PROD_CODE || EFI_SIMULATOR -// initLogging(&logger, "trigger decoder"); + initLogging(&logger, "trigger decoder"); #endif } diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index 8dbd1ffa0e..d656695057 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -158,6 +158,14 @@ void initHardware(Logging *logger, Engine *engine) { initHistogramsModule(); #endif /* EFI_HISTOGRAMS */ + /** + * This is so early because we want to init logger + * which would be used while finding trigger synch index + * while config read + */ + initTriggerDecoder(); + + /** * We need the LED_ERROR pin even before we read configuration */