From 9474781a465db7b8d220e3fcd289571c9b1b3fcc Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Fri, 3 Nov 2023 15:50:39 -0700 Subject: [PATCH] small can board --- firmware/console/status_loop.cpp | 9 ++++----- firmware/development/engine_sniffer.cpp | 14 +++++++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 9a1a04dc2e..877d96bf30 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -98,8 +98,6 @@ static int packEngineMode() { engineConfiguration->ignitionMode; } -static int prevCkpEventCounter = -1; - /** * Time when the firmware version was last reported * TODO: implement a request/response instead of just constantly sending this out @@ -184,8 +182,6 @@ void printOverallStatus() { } } -static systime_t timeOfPreviousReport = (systime_t) -1; - #if !defined(LOGIC_ANALYZER_BUFFER_SIZE) // TODO: how small can this be? #define LOGIC_ANALYZER_BUFFER_SIZE 1000 @@ -215,9 +211,12 @@ void updateDevConsoleState() { printFullAdcReportIfNeeded(); #endif /* HAL_USE_ADC */ +#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT systime_t nowSeconds = getTimeNowS(); -#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT + static systime_t timeOfPreviousReport = (systime_t) -1; + static int prevCkpEventCounter = -1; + int currentCkpEventCounter = engine->triggerCentral.triggerState.getTotalEventCounter(); if (prevCkpEventCounter == currentCkpEventCounter && timeOfPreviousReport == nowSeconds) { return; diff --git a/firmware/development/engine_sniffer.cpp b/firmware/development/engine_sniffer.cpp index 9b602e6959..8ebc4d908b 100644 --- a/firmware/development/engine_sniffer.cpp +++ b/firmware/development/engine_sniffer.cpp @@ -28,9 +28,6 @@ #include "engine_sniffer.h" -// a bit weird because of conditional compilation -static char shaft_signal_msg_index[15]; - #if EFI_ENGINE_SNIFFER #define addEngineSnifferEvent(name, msg) { if (getTriggerCentral()->isEngineSnifferEnabled) { waveChart.addEvent3((name), (msg)); } } #else @@ -45,6 +42,8 @@ static char shaft_signal_msg_index[15]; #define CHART_DELIMETER '!' extern WaveChart waveChart; +static char shaft_signal_msg_index[15]; + /** * This is the number of events in the digital chart which would be displayed * on the 'digital sniffer' pane @@ -242,8 +241,6 @@ void initWaveChart(WaveChart *chart) { #endif // EFI_UNIT_TEST } -#endif /* EFI_ENGINE_SNIFFER */ - void addEngineSnifferOutputPinEvent(NamedOutputPin *pin, bool isRise) { if (!engineConfiguration->engineSnifferFocusOnInputs) { addEngineSnifferEvent(pin->getShortName(), isRise ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN); @@ -253,9 +250,9 @@ void addEngineSnifferOutputPinEvent(NamedOutputPin *pin, bool isRise) { 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); } @@ -282,3 +279,6 @@ void addEngineSnifferVvtEvent(int vvtIndex, bool isRise) { addEngineSnifferEvent(vvtName, isRise ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN); } + +#endif /* EFI_ENGINE_SNIFFER */ +