rusefi-1/firmware/development/engine_sniffer.h

54 lines
1.1 KiB
C
Raw Normal View History

/**
* @file engine_sniffer.h
2019-05-02 14:52:48 -07:00
* @brief rusEfi console wave sniffer
*
* @date Jun 23, 2013
2020-01-13 18:57:43 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
*/
2020-04-01 16:00:56 -07:00
#pragma once
#include "global.h"
2019-04-12 19:10:57 -07:00
#if EFI_ENGINE_SNIFFER
#include "datalogging.h"
/**
2019-05-02 14:52:48 -07:00
* @brief rusEfi console sniffer data buffer
*/
class WaveChart {
public:
2021-04-04 19:01:04 -07:00
DECLARE_ENGINE_PTR;
WaveChart();
void init();
void addEvent3(const char *name, const char *msg);
void reset();
void startDataCollection();
void publishIfFull();
void publish();
bool isFull() const;
bool isStartedTooLongAgo() const;
2020-05-25 20:38:15 -07:00
// looks like this is only used by functional tests on real hardware
efitick_t pauseEngineSnifferUntilNt = 0;
2021-04-04 19:48:48 -07:00
int getSize();
private:
Logging logging;
char timeBuffer[_MAX_FILLER + 2];
uint32_t counter = 0;
/**
* We want to avoid visual jitter thus we want the left edge to be aligned
* https://github.com/rusefi/rusefi/issues/780
*/
bool collectingData = false;
efitick_t startTimeNt = 0;
volatile int isInitialized = false;
};
void initWaveChart(WaveChart *chart);
void setChartSize(int newSize);
#endif /* EFI_ENGINE_SNIFFER */