auto-sync

This commit is contained in:
rusEfi 2014-11-13 15:03:09 -06:00
parent ea237d3b0c
commit e8d9517299
4 changed files with 9 additions and 3 deletions

View File

@ -216,7 +216,9 @@ static void triggerInfo(Engine *engine) {
scheduleMsg(&logger, "expected duty #0=%f/#1=%f", engineConfiguration2->triggerShape.dutyCycle[0],
engineConfiguration2->triggerShape.dutyCycle[1]);
scheduleMsg(&logger, "isError %d", isTriggerDecoderError());
scheduleMsg(&logger, "isError %d, total errors=%d/total revolutions=%d", isTriggerDecoderError(),
triggerCentral.triggerState.totalTriggerErrorCounter,
triggerCentral.triggerState.getTotalRevolutionCounter());
#endif

View File

@ -43,7 +43,6 @@ bool printGapRatio = false;
Logging logger;
#endif
/**
* @return TRUE is something is wrong with trigger decoding
*/
@ -98,7 +97,6 @@ static trigger_value_e eventType[6] = { TV_LOW, TV_HIGH, TV_LOW, TV_HIGH, TV_LOW
#define getCurrentGapDuration(nowUs) \
(isFirstEvent ? 0 : (nowUs) - toothed_previous_time)
/**
* @brief Trigger decoding happens here
* This method changes the state of trigger_state_s data structure according to the trigger event
@ -152,6 +150,10 @@ void TriggerState::decodeTriggerEvent(trigger_shape_s const*triggerShape, trigge
|| eventCount[1] != triggerShape->expectedEventCount[1]
|| eventCount[2] != triggerShape->expectedEventCount[2];
if (isDecodingError) {
totalTriggerErrorCounter++;
}
errorDetection.add(isDecodingError);
if (isTriggerDecoderError()) {

View File

@ -47,6 +47,7 @@ public:
*/
uint32_t prevTotalTime[PWM_PHASE_MAX_WAVE_PER_PWM];
int expectedTotalTime[PWM_PHASE_MAX_WAVE_PER_PWM];
uint32_t totalTriggerErrorCounter;
private:
void clear();

View File

@ -118,6 +118,7 @@ TriggerState::TriggerState() {
toothed_previous_time = 0;
toothed_previous_duration = 0;
totalRevolutionCounter = 0;
totalTriggerErrorCounter = 0;
clear();
memset(expectedTotalTime, 0, sizeof(expectedTotalTime));
totalEventCountBase = 0;