auto-sync

This commit is contained in:
rusEfi 2015-01-18 09:06:08 -06:00
parent 4d2c4258c9
commit 407c2d57b0
6 changed files with 33 additions and 7 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}