From 407c2d57b082f5ec1931deeff5e3646be9e0571b Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sun, 18 Jan 2015 09:06:08 -0600 Subject: [PATCH] auto-sync --- firmware/console/status_loop.cpp | 9 +++++++++ firmware/controllers/algo/rusefi_outputs.h | 7 +++++-- firmware/controllers/trigger/trigger_central.cpp | 6 +++--- firmware/controllers/trigger/trigger_decoder.h | 5 +++++ firmware/controllers/trigger/trigger_structure.cpp | 11 ++++++++++- firmware/rusefi.cpp | 2 +- 6 files changed, 33 insertions(+), 7 deletions(-) diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 3ede86b5eb..611f8b9e7a 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -213,6 +213,15 @@ static void printState(Engine *engine) { if (subscription[(int) RO_RUNNING_REVOLUTION_COUNTER]) debugInt(&logger, "ckp_r", triggerCentral.triggerState.runningRevolutionCounter); + if (subscription[(int) RO_RUNNING_TRIGGER_ERROR]) + debugInt(&logger, "trg_r_errors", triggerCentral.triggerState.runningTriggerErrorCounter); + + if (subscription[(int) RO_RUNNING_ORDERING_TRIGGER_ERROR]) + debugInt(&logger, "trg_r_order_errors", triggerCentral.triggerState.runningOrderingErrorCounter); + + if (subscription[(int) RO_WAVE_CHART_CURRENT_SIZE]) + debugInt(&logger, "wave_chart_current", 0); + // debugInt(&logger, "idl", getIdleSwitch()); // debugFloat(&logger, "table_spark", getAdvance(rpm, getMaf()), 2); diff --git a/firmware/controllers/algo/rusefi_outputs.h b/firmware/controllers/algo/rusefi_outputs.h index f3dbab1536..03afa683e8 100644 --- a/firmware/controllers/algo/rusefi_outputs.h +++ b/firmware/controllers/algo/rusefi_outputs.h @@ -10,7 +10,7 @@ #define CONTROLLERS_ALGO_RUSEFI_OUTPUTS_H_ /** - * this enum is part of the console protocol API, it should be in sync with ...java + * this enum is part of the console protocol API, it should be in sync with com/rusefi/OutputChannel.java */ /** @@ -31,8 +31,11 @@ typedef enum { RO_VBATT = 8, RO_TOTAL_REVOLUTION_COUNTER = 9, RO_RUNNING_REVOLUTION_COUNTER = 10, + RO_WAVE_CHART_CURRENT_SIZE = 11, + RO_RUNNING_TRIGGER_ERROR = 12, + RO_RUNNING_ORDERING_TRIGGER_ERROR = 13, - RO_LAST_ELEMENT = 11 + RO_LAST_ELEMENT = 14 } rusefi_output_e; diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 0dae03d81d..76fa229eca 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -291,8 +291,8 @@ float getTriggerDutyCycle(int index) { return triggerCentral.triggerState.getTriggerDutyCycle(index); } -static void resetRunningTriggerCounter() { - triggerCentral.triggerState.runningRevolutionCounter = 0; +static void resetRunningTriggerCounters() { + triggerCentral.triggerState.resetRunningCounters(); } void initTriggerCentral(Logging *sharedLogger, Engine *engine) { @@ -306,7 +306,7 @@ void initTriggerCentral(Logging *sharedLogger, Engine *engine) { #if EFI_PROD_CODE || EFI_SIMULATOR addConsoleActionP("triggerinfo", (VoidPtr) triggerInfo, engine); addConsoleActionP("triggershapeinfo", (VoidPtr) triggerShapeInfo, engine); - addConsoleAction("reset_running_trigger_counter", resetRunningTriggerCounter); + addConsoleAction("reset_running_counters", resetRunningTriggerCounters); #endif diff --git a/firmware/controllers/trigger/trigger_decoder.h b/firmware/controllers/trigger/trigger_decoder.h index eb41095b91..c928e50798 100644 --- a/firmware/controllers/trigger/trigger_decoder.h +++ b/firmware/controllers/trigger/trigger_decoder.h @@ -49,7 +49,12 @@ public: uint32_t prevTotalTime[PWM_PHASE_MAX_WAVE_PER_PWM]; int expectedTotalTime[PWM_PHASE_MAX_WAVE_PER_PWM]; uint32_t totalTriggerErrorCounter; + uint32_t runningTriggerErrorCounter; uint32_t orderingErrorCounter; + uint32_t runningOrderingErrorCounter; + + void resetRunningCounters(); + /** * index within trigger revolution, from 0 to trigger event count diff --git a/firmware/controllers/trigger/trigger_structure.cpp b/firmware/controllers/trigger/trigger_structure.cpp index e19adb3332..3e53827f88 100644 --- a/firmware/controllers/trigger/trigger_structure.cpp +++ b/firmware/controllers/trigger/trigger_structure.cpp @@ -114,9 +114,12 @@ TriggerState::TriggerState() { shaft_is_synchronized = false; toothed_previous_time = 0; toothed_previous_duration = 0; + totalRevolutionCounter = 0; - runningRevolutionCounter = 0; totalTriggerErrorCounter = 0; + orderingErrorCounter = 0; + + resetRunningCounters(); clear(); memset(expectedTotalTime, 0, sizeof(expectedTotalTime)); totalEventCountBase = 0; @@ -131,6 +134,12 @@ uint64_t TriggerState::getStartOfRevolutionIndex() { return totalEventCountBase; } +void TriggerState::resetRunningCounters() { + runningRevolutionCounter = 0; + runningTriggerErrorCounter = 0; + runningOrderingErrorCounter = 0; +} + uint64_t TriggerState::getTotalEventCounter() { return totalEventCountBase + current_index; } diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 0950a105dc..53a4b00d58 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -262,5 +262,5 @@ int getRusEfiVersion(void) { return 1; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE == 0) return 1; // this is here to make the compiler happy about the unused array - return 20150117; + return 20150118; }