diff --git a/firmware/controllers/engine_cycle/rpm_calculator.cpp b/firmware/controllers/engine_cycle/rpm_calculator.cpp index 9416147f90..32662c9a31 100644 --- a/firmware/controllers/engine_cycle/rpm_calculator.cpp +++ b/firmware/controllers/engine_cycle/rpm_calculator.cpp @@ -308,7 +308,6 @@ float RpmCalculator::getSecondsSinceEngineStart(efitick_t nowNt) const { return engineStartTimer.getElapsedSeconds(nowNt); } -static char rpmBuffer[_MAX_FILLER]; /** * This callback has nothing to do with actual engine control, it just sends a Top Dead Center mark to the rusEfi console @@ -321,11 +320,8 @@ static void onTdcCallback(void *) { } #endif /* EFI_UNIT_TEST */ - itoa10(rpmBuffer, Sensor::getOrZero(SensorType::Rpm)); -#if EFI_ENGINE_SNIFFER - waveChart.startDataCollection(); -#endif - addEngineSnifferEvent(TOP_DEAD_CENTER_MESSAGE, (char* ) rpmBuffer); + int rpm = Sensor::getOrZero(SensorType::Rpm); + addEngineSnifferTdcEvent(rpm); #if EFI_TOOTH_LOGGER LogTriggerTopDeadCenter(getTimeNowNt()); #endif /* EFI_TOOTH_LOGGER */ diff --git a/firmware/development/engine_sniffer.cpp b/firmware/development/engine_sniffer.cpp index f2d5bb2cdb..d822128381 100644 --- a/firmware/development/engine_sniffer.cpp +++ b/firmware/development/engine_sniffer.cpp @@ -34,6 +34,7 @@ #include "status_loop.h" #define CHART_DELIMETER '!' +extern WaveChart waveChart; extern uint32_t maxLockedDuration; @@ -142,6 +143,15 @@ void WaveChart::publish() { } } +void addEngineSnifferTdcEvent(int rpm) { + static char rpmBuffer[_MAX_FILLER]; + itoa10(rpmBuffer, rpm); +#if EFI_ENGINE_SNIFFER + waveChart.startDataCollection(); +#endif + addEngineSnifferEvent(TOP_DEAD_CENTER_MESSAGE, (char* ) rpmBuffer); +} + /** * @brief Register an event for digital sniffer */ diff --git a/firmware/development/engine_sniffer.h b/firmware/development/engine_sniffer.h index c7204063ec..430b4f1f33 100644 --- a/firmware/development/engine_sniffer.h +++ b/firmware/development/engine_sniffer.h @@ -13,6 +13,11 @@ #if EFI_ENGINE_SNIFFER #include "datalogging.h" +void addEngineSnifferTdcEvent(int rpm); +void addEngineSnifferCrankEvent(int signalType, int index, int isUp); +void addEngineSnifferVvtEvent(int vvtType, int isUp); +void addEngineSnifferOutputPinEvent(int outputPinType, int isUp); + /** * @brief rusEfi console sniffer data buffer */