rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
engine_sniffer.h
Go to the documentation of this file.
1/**
2 * @file engine_sniffer.h
3 * @brief rusEfi console wave sniffer
4 *
5 * @date Jun 23, 2013
6 * @author Andrey Belomutskiy, (c) 2012-2020
7 */
8
9#pragma once
10
11#include "rusefi_enums.h"
12
13#include "datalogging.h"
14
15enum class FrontDirection : uint8_t {
16 UP,
17 DOWN
18};
19
20void addEngineSnifferTdcEvent(int rpm);
21void addEngineSnifferLogicAnalyzerEvent(int laIndex, FrontDirection frontDirection);
22/**
23 * @param wheelIndex 0 or 1
24 * @triggerEventIndex index from sync point, from 0 to number of teeth in engine cycle
25 */
26void addEngineSnifferCrankEvent(int wheelIndex, int triggerEventIndex, FrontDirection frontDirection);
27void addEngineSnifferVvtEvent(int vvtIndex, FrontDirection frontDirection);
29
30#if EFI_ENGINE_SNIFFER
31
32/**
33 * @brief rusEfi console sniffer data buffer
34 */
35class WaveChart {
36public:
37 WaveChart();
38 void init();
39 void addEvent3(const char *name, const char *msg);
40 void reset();
42 void publishIfFull();
43 void publish();
44 bool isFull() const;
45 bool isStartedTooLongAgo() const;
46 // looks like this is only used by functional tests on real hardware
48 int getSize();
49
50private:
52 char timeBuffer[_MAX_FILLER + 2];
53 // current number of events in buffer, see getSize()
54 uint32_t counter = 0;
55 /**
56 * We want to avoid visual jitter thus we want the left edge to be aligned
57 * https://github.com/rusefi/rusefi/issues/780
58 */
59 bool collectingData = false;
60 efitick_t startTimeNt = 0;
61 volatile int isInitialized = false;
62};
63
64void initWaveChart(WaveChart *chart);
65void setChartSize(int newSize);
66
67#endif /* EFI_ENGINE_SNIFFER */
68
rusEfi console sniffer data buffer
volatile int isInitialized
efitick_t startTimeNt
void startDataCollection()
void addEvent3(const char *name, const char *msg)
Register an event for digital sniffer.
bool isFull() const
bool isStartedTooLongAgo() const
char timeBuffer[_MAX_FILLER+2]
Logging logging
void publishIfFull()
efitick_t pauseEngineSnifferUntilNt
uint32_t counter
bool collectingData
Buffered console output stream header.
void setChartSize(int newSize)
void addEngineSnifferOutputPinEvent(NamedOutputPin *pin, FrontDirection frontDirection)
void addEngineSnifferVvtEvent(int vvtIndex, FrontDirection frontDirection)
void addEngineSnifferCrankEvent(int wheelIndex, int triggerEventIndex, FrontDirection frontDirection)
void addEngineSnifferTdcEvent(int rpm)
FrontDirection
void addEngineSnifferLogicAnalyzerEvent(int laIndex, FrontDirection frontDirection)
void initWaveChart(WaveChart *chart)
Fundamental rusEFI enumerable types live here.
brain_pin_e pin
Definition stm32_adc.cpp:15