tooth_logger.h -> pch

(cherry picked from commit ad3ea57276361b6da69eb920dd056a662f6f5c70)
This commit is contained in:
Matthew Kennedy 2023-05-31 01:41:20 -04:00 committed by rusefillc
parent c50ef201b1
commit 12a29232cc
10 changed files with 13 additions and 27 deletions

@ -1 +1 @@
Subproject commit 284be36d608557fb6f9c58786d9da1d6a9283a9c Subproject commit 30135a2f47677c7cdd24c31b64d7a5218bbca8f3

View File

@ -10,8 +10,6 @@
#include "pch.h" #include "pch.h"
#include "tooth_logger.h"
#if EFI_TOOTH_LOGGER #if EFI_TOOTH_LOGGER
/** /**

View File

@ -73,7 +73,6 @@
#include "console_io.h" #include "console_io.h"
#include "bluetooth.h" #include "bluetooth.h"
#include "tunerstudio_io.h" #include "tunerstudio_io.h"
#include "tooth_logger.h"
#include "trigger_scope.h" #include "trigger_scope.h"
#include "electronic_throttle.h" #include "electronic_throttle.h"
#include "live_data.h" #include "live_data.h"

View File

@ -41,7 +41,6 @@
#include "cyclic_buffer.h" #include "cyclic_buffer.h"
#include "fuel_math.h" #include "fuel_math.h"
#include "cdm_ion_sense.h" #include "cdm_ion_sense.h"
#include "tooth_logger.h"
#include "local_version_holder.h" #include "local_version_holder.h"
#include "event_queue.h" #include "event_queue.h"
#include "injector_model.h" #include "injector_model.h"

View File

@ -15,9 +15,7 @@
#include "pch.h" #include "pch.h"
#include "trigger_central.h" #include "trigger_central.h"
#include "tooth_logger.h"
#if EFI_SENSOR_CHART #if EFI_SENSOR_CHART
#include "sensor_chart.h" #include "sensor_chart.h"

View File

@ -16,7 +16,6 @@
#include "utlist.h" #include "utlist.h"
#include "event_queue.h" #include "event_queue.h"
#include "tooth_logger.h"
#include "knock_logic.h" #include "knock_logic.h"

View File

@ -2,12 +2,7 @@
* injection_gpio.cpp * injection_gpio.cpp
*/ */
#include "injection_gpio.h" #include "pch.h"
#include "engine_state.h"
#include "tooth_logger.h"
#include "tunerstudio_outputs.h"
#include "engine_configuration.h"
#include "efi_gpio.h"
extern bool printFuelDebug; extern bool printFuelDebug;

View File

@ -12,7 +12,6 @@
#include "trigger_decoder.h" #include "trigger_decoder.h"
#include "main_trigger_callback.h" #include "main_trigger_callback.h"
#include "listener_array.h" #include "listener_array.h"
#include "tooth_logger.h"
#include "hip9011.h" #include "hip9011.h"
#include "logic_analyzer.h" #include "logic_analyzer.h"
@ -20,7 +19,6 @@
#include "trigger_simulator.h" #include "trigger_simulator.h"
#include "trigger_emulator_algo.h" #include "trigger_emulator_algo.h"
#include "tooth_logger.h"
#include "map_averaging.h" #include "map_averaging.h"
#include "main_trigger_callback.h" #include "main_trigger_callback.h"
#include "status_loop.h" #include "status_loop.h"
@ -491,7 +489,7 @@ void handleShaftSignal(int signalIndex, bool isRising, efitick_t timestamp) {
#endif /* EFI_TOOTH_LOGGER */ #endif /* EFI_TOOTH_LOGGER */
// for effective noise filtering, we need both signal edges, // for effective noise filtering, we need both signal edges,
// so we pass them to handleShaftSignal() and defer this test // so we pass them to handleShaftSignal() and defer this test
if (!engineConfiguration->useNoiselessTriggerDecoder) { if (!engineConfiguration->useNoiselessTriggerDecoder) {
if (!isUsefulSignal(signal, getTriggerCentral()->triggerShape)) { if (!isUsefulSignal(signal, getTriggerCentral()->triggerShape)) {
@ -558,9 +556,9 @@ static void reportEventToWaveChart(trigger_event_e ckpSignalType, int triggerEve
} }
/** /**
* This is used to filter noise spikes (interference) in trigger signal. See * This is used to filter noise spikes (interference) in trigger signal. See
* The basic idea is to use not just edges, but the average amount of time the signal stays in '0' or '1'. * The basic idea is to use not just edges, but the average amount of time the signal stays in '0' or '1'.
* So we update 'accumulated periods' to track where the signal is. * So we update 'accumulated periods' to track where the signal is.
* And then compare between the current period and previous, with some tolerance (allowing for the wheel speed change). * And then compare between the current period and previous, with some tolerance (allowing for the wheel speed change).
* @return true if the signal is passed through. * @return true if the signal is passed through.
*/ */
@ -574,18 +572,18 @@ bool TriggerNoiseFilter::noiseFilter(efitick_t nowNt,
TriggerWheel ti = triggerIdx[signal]; TriggerWheel ti = triggerIdx[signal];
// falling is opposite to rising, and vise versa // falling is opposite to rising, and vise versa
trigger_event_e os = opposite[signal]; trigger_event_e os = opposite[signal];
// todo: currently only primary channel is filtered, because there are some weird trigger types on other channels // todo: currently only primary channel is filtered, because there are some weird trigger types on other channels
if (ti != TriggerWheel::T_PRIMARY) if (ti != TriggerWheel::T_PRIMARY)
return true; return true;
// update period accumulator: for rising signal, we update '0' accumulator, and for falling - '1' // update period accumulator: for rising signal, we update '0' accumulator, and for falling - '1'
if (lastSignalTimes[signal] != -1) if (lastSignalTimes[signal] != -1)
accumSignalPeriods[signal] += nowNt - lastSignalTimes[signal]; accumSignalPeriods[signal] += nowNt - lastSignalTimes[signal];
// save current time for this trigger channel // save current time for this trigger channel
lastSignalTimes[signal] = nowNt; lastSignalTimes[signal] = nowNt;
// now we want to compare current accumulated period to the stored one // now we want to compare current accumulated period to the stored one
efitick_t currentPeriod = accumSignalPeriods[signal]; efitick_t currentPeriod = accumSignalPeriods[signal];
// the trick is to compare between different // the trick is to compare between different
efitick_t allowedPeriod = accumSignalPrevPeriods[os]; efitick_t allowedPeriod = accumSignalPrevPeriods[os];
@ -593,18 +591,18 @@ bool TriggerNoiseFilter::noiseFilter(efitick_t nowNt,
// but first check if we're expecting a gap // but first check if we're expecting a gap
bool isGapExpected = TRIGGER_WAVEFORM(isSynchronizationNeeded) && triggerState->getShaftSynchronized() && bool isGapExpected = TRIGGER_WAVEFORM(isSynchronizationNeeded) && triggerState->getShaftSynchronized() &&
(triggerState->currentCycle.eventCount[(int)ti] + 1) == TRIGGER_WAVEFORM(getExpectedEventCount(ti)); (triggerState->currentCycle.eventCount[(int)ti] + 1) == TRIGGER_WAVEFORM(getExpectedEventCount(ti));
if (isGapExpected) { if (isGapExpected) {
// usually we need to extend the period for gaps, based on the trigger info // usually we need to extend the period for gaps, based on the trigger info
allowedPeriod *= TRIGGER_WAVEFORM(syncRatioAvg); allowedPeriod *= TRIGGER_WAVEFORM(syncRatioAvg);
} }
// also we need some margin for rapidly changing trigger-wheel speed, // also we need some margin for rapidly changing trigger-wheel speed,
// that's why we expect the period to be no less than 2/3 of the previous period (this is just an empirical 'magic' coef.) // that's why we expect the period to be no less than 2/3 of the previous period (this is just an empirical 'magic' coef.)
efitick_t minAllowedPeriod = 2 * allowedPeriod / 3; efitick_t minAllowedPeriod = 2 * allowedPeriod / 3;
// but no longer than 5/4 of the previous 'normal' period // but no longer than 5/4 of the previous 'normal' period
efitick_t maxAllowedPeriod = 5 * allowedPeriod / 4; efitick_t maxAllowedPeriod = 5 * allowedPeriod / 4;
// above all, check if the signal comes not too early // above all, check if the signal comes not too early
if (currentPeriod >= minAllowedPeriod) { if (currentPeriod >= minAllowedPeriod) {
// now we store this period as a reference for the next time, // now we store this period as a reference for the next time,

View File

@ -19,7 +19,6 @@
#include "buffered_writer.h" #include "buffered_writer.h"
#include "status_loop.h" #include "status_loop.h"
#include "binary_logging.h" #include "binary_logging.h"
#include "tooth_logger.h"
static bool fs_ready = false; static bool fs_ready = false;

View File

@ -36,6 +36,7 @@
#include "perf_trace.h" #include "perf_trace.h"
#include "hardware.h" #include "hardware.h"
#include "thread_priority.h" #include "thread_priority.h"
#include "tooth_logger.h"
#if EFI_UNIT_TEST #if EFI_UNIT_TEST
#include <gtest/gtest.h> #include <gtest/gtest.h>