rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
engine_sniffer.cpp File Reference

Detailed Description

rusEfi console wave sniffer logic

Here we have our own build-in logic analyzer. The data we aggregate here is sent to the java UI rusEfi Console so that it can be displayed nicely in the Sniffer tab.

Both external events (see logic_analyzer.cpp) and internal (see signal executors) are supported

Date
Jun 23, 2013
Author
Andrey Belomutskiy, (c) 2012-2020

This file is part of rusEfi - see http://rusefi.com

rusEfi is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file engine_sniffer.cpp.

Functions

static void resetNow ()
 
static void printStatus ()
 
void setChartSize (int newSize)
 
void initWaveChart (WaveChart *chart)
 
void addEngineSnifferOutputPinEvent (NamedOutputPin *pin, FrontDirection frontDirection)
 
void addEngineSnifferTdcEvent (int rpm)
 
void addEngineSnifferLogicAnalyzerEvent (int laIndex, FrontDirection frontDirection)
 
void addEngineSnifferCrankEvent (int wheelIndex, int triggerEventIndex, FrontDirection frontDirection)
 
void addEngineSnifferVvtEvent (int vvtIndex, FrontDirection frontDirection)
 

Variables

static char shaft_signal_msg_index [15]
 
WaveChart waveChart
 
static char WAVE_LOGGING_BUFFER[WAVE_LOGGING_SIZE] CCM_OPTIONAL
 
int waveChartUsedSize
 
static uint32_t skipUntilEngineCycle = 0
 

Function Documentation

◆ addEngineSnifferCrankEvent()

void addEngineSnifferCrankEvent ( int  wheelIndex,
int  triggerEventIndex,
FrontDirection  frontDirection 
)
Parameters
wheelIndex0 or 1 @triggerEventIndex index from sync point, from 0 to number of teeth in engine cycle

Definition at line 261 of file engine_sniffer.cpp.

261 {
262 static const char *crankName[2] = { PROTOCOL_CRANK1, PROTOCOL_CRANK2 };
263
264 shaft_signal_msg_index[0] = frontDirection == FrontDirection::UP ? 'u' : 'd';
265 // shaft_signal_msg_index[1] is assigned once and forever in the init method below
266 itoa10(&shaft_signal_msg_index[2], triggerEventIndex);
267
268 addEngineSnifferEvent(crankName[wheelIndex], (char* ) shaft_signal_msg_index);
269}
char * itoa10(char *p, int num)
Definition efilib.cpp:107
static char shaft_signal_msg_index[15]

Referenced by reportEventToWaveChart().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addEngineSnifferLogicAnalyzerEvent()

void addEngineSnifferLogicAnalyzerEvent ( int  laIndex,
FrontDirection  frontDirection 
)

Definition at line 254 of file engine_sniffer.cpp.

254 {
255 extern const char *laNames[];
256 const char *name = laNames[laIndex];
257
258 addEngineSnifferEvent(name, frontDirection == FrontDirection::UP ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN);
259}
const char * laNames[]
Definition efi_gpio.cpp:40

Referenced by riseCallback().

Here is the caller graph for this function:

◆ addEngineSnifferOutputPinEvent()

void addEngineSnifferOutputPinEvent ( NamedOutputPin pin,
FrontDirection  frontDirection 
)

Definition at line 239 of file engine_sniffer.cpp.

239 {
241 addEngineSnifferEvent(pin->getShortName(), frontDirection == FrontDirection::UP ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN);
242 }
243}
static constexpr engine_configuration_s * engineConfiguration
brain_pin_e pin
Definition stm32_adc.cpp:15

Referenced by NamedOutputPin::setHigh(), and NamedOutputPin::setLow().

Here is the caller graph for this function:

◆ addEngineSnifferTdcEvent()

void addEngineSnifferTdcEvent ( int  rpm)

Definition at line 245 of file engine_sniffer.cpp.

245 {
246 static char rpmBuffer[_MAX_FILLER];
247 itoa10(rpmBuffer, rpm);
248#if EFI_ENGINE_SNIFFER
250#endif
251 addEngineSnifferEvent(TOP_DEAD_CENTER_MESSAGE, (char* ) rpmBuffer);
252}
void startDataCollection()
WaveChart waveChart

Referenced by onTdcCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addEngineSnifferVvtEvent()

void addEngineSnifferVvtEvent ( int  vvtIndex,
FrontDirection  frontDirection 
)

Definition at line 271 of file engine_sniffer.cpp.

271 {
272 extern const char *vvtNames[];
273 const char *vvtName = vvtNames[vvtIndex];
274
275 addEngineSnifferEvent(vvtName, frontDirection == FrontDirection::UP ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN);
276}
const char * vvtNames[]
Definition efi_gpio.cpp:34

Referenced by logVvtFront().

Here is the caller graph for this function:

◆ initWaveChart()

void initWaveChart ( WaveChart chart)

constructor does not work because we need specific initialization order

Definition at line 218 of file engine_sniffer.cpp.

218 {
219 strcpy((char*) shaft_signal_msg_index, "x_");
220 /**
221 * constructor does not work because we need specific initialization order
222 */
223 chart->init();
224
225#if EFI_HISTOGRAMS
226 initHistogram(&engineSnifferHisto, "engine sniffer");
227#endif /* EFI_HISTOGRAMS */
228
229#if ! EFI_UNIT_TEST
230 printStatus();
231 addConsoleActionI("chartsize", setChartSize);
232 // this is used by HW CI
233 addConsoleAction(CMD_RESET_ENGINE_SNIFFER, resetNow);
234#endif // EFI_UNIT_TEST
235}
void addConsoleAction(const char *token, Void callback)
Register console action without parameters.
void addConsoleActionI(const char *token, VoidInt callback)
Register a console command with one Integer parameter.
void setChartSize(int newSize)
static void printStatus()
static void resetNow()
void initHistogram(histogram_s *h, const char *name)
Reset histogram_s to orignal state.
Definition histogram.cpp:89

Referenced by initTriggerCentral().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printStatus()

static void printStatus ( )
static

Definition at line 115 of file engine_sniffer.cpp.

115 {
116 efiPrintf("engine sniffer: %s", boolToString(getTriggerCentral()->isEngineSnifferEnabled));
117 efiPrintf("engine sniffer size=%lu", engineConfiguration->engineChartSize);
118}
const char * boolToString(bool value)
Definition efilib.cpp:19
TriggerCentral * getTriggerCentral()
Definition engine.cpp:590

Referenced by initWaveChart(), and setChartSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetNow()

static void resetNow ( )
static

Definition at line 69 of file engine_sniffer.cpp.

69 {
70 skipUntilEngineCycle = getRevolutionCounter() + 3;
72}
static uint32_t skipUntilEngineCycle

Referenced by initWaveChart().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setChartSize()

void setChartSize ( int  newSize)

Definition at line 120 of file engine_sniffer.cpp.

120 {
121 if (newSize < 5) {
122 return;
123 }
125 printStatus();
126}

Referenced by initWaveChart().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ CCM_OPTIONAL

char WAVE_LOGGING_BUFFER [WAVE_LOGGING_SIZE] CCM_OPTIONAL
static

Definition at line 58 of file engine_sniffer.cpp.

◆ shaft_signal_msg_index

char shaft_signal_msg_index[15]
static

Definition at line 32 of file engine_sniffer.cpp.

Referenced by addEngineSnifferCrankEvent(), and initWaveChart().

◆ skipUntilEngineCycle

uint32_t skipUntilEngineCycle = 0
static

We want to skip some engine cycles to skip what was scheduled before parameters were changed

Definition at line 65 of file engine_sniffer.cpp.

Referenced by WaveChart::addEvent3(), and resetNow().

◆ waveChart

WaveChart waveChart
extern

◆ waveChartUsedSize

int waveChartUsedSize

Definition at line 60 of file engine_sniffer.cpp.

Referenced by WaveChart::publish().

Go to the source code of this file.