engine sniffer into unit tests

This commit is contained in:
rusefillc 2021-04-04 22:01:04 -04:00
parent 9a1ad49e7b
commit cb1f9b4b61
2 changed files with 8 additions and 5 deletions

View File

@ -75,7 +75,7 @@ static void resetNow(void) {
skipUntilEngineCycle = getRevolutionCounter() + 3;
waveChart.reset();
}
#endif
#endif // EFI_UNIT_TEST
WaveChart::WaveChart() : logging("wave chart", WAVE_LOGGING_BUFFER, sizeof(WAVE_LOGGING_BUFFER)) {
}
@ -115,6 +115,7 @@ bool WaveChart::isFull() const {
return counter >= CONFIG(engineChartSize);
}
#if ! EFI_UNIT_TEST
static void printStatus(void) {
scheduleMsg(&logger, "engine chart: %s", boolToString(engineConfiguration->isEngineChartEnabled));
scheduleMsg(&logger, "engine chart size=%d", engineConfiguration->engineChartSize);
@ -135,6 +136,7 @@ void setChartSize(int newSize) {
engineConfiguration->engineChartSize = newSize;
printStatus();
}
#endif // EFI_UNIT_TEST
void WaveChart::publishIfFull() {
if (isFull() || isStartedTooLongAgo()) {
@ -236,17 +238,16 @@ void initWaveChart(WaveChart *chart) {
*/
chart->init();
printStatus();
#if EFI_HISTOGRAMS
initHistogram(&engineSnifferHisto, "wave chart");
#endif /* EFI_HISTOGRAMS */
#if ! EFI_UNIT_TEST
printStatus();
addConsoleActionI("chartsize", setChartSize);
addConsoleActionI("chart", setChartActive);
#if ! EFI_UNIT_TEST
addConsoleAction(CMD_RESET_ENGINE_SNIFFER, resetNow);
#endif
#endif // EFI_UNIT_TEST
}
#endif /* EFI_ENGINE_SNIFFER */

View File

@ -18,6 +18,8 @@
*/
class WaveChart {
public:
DECLARE_ENGINE_PTR;
WaveChart();
void init();
void addEvent3(const char *name, const char *msg);