auto-sync

This commit is contained in:
rusEfi 2014-11-13 15:03:09 -06:00
parent 8767ee3c7d
commit cac7d97683
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], scheduleMsg(&logger, "expected duty #0=%f/#1=%f", engineConfiguration2->triggerShape.dutyCycle[0],
engineConfiguration2->triggerShape.dutyCycle[1]); 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 #endif

View File

@ -43,7 +43,6 @@ bool printGapRatio = false;
Logging logger; Logging logger;
#endif #endif
/** /**
* @return TRUE is something is wrong with trigger decoding * @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) \ #define getCurrentGapDuration(nowUs) \
(isFirstEvent ? 0 : (nowUs) - toothed_previous_time) (isFirstEvent ? 0 : (nowUs) - toothed_previous_time)
/** /**
* @brief Trigger decoding happens here * @brief Trigger decoding happens here
* This method changes the state of trigger_state_s data structure according to the trigger event * 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[1] != triggerShape->expectedEventCount[1]
|| eventCount[2] != triggerShape->expectedEventCount[2]; || eventCount[2] != triggerShape->expectedEventCount[2];
if (isDecodingError) {
totalTriggerErrorCounter++;
}
errorDetection.add(isDecodingError); errorDetection.add(isDecodingError);
if (isTriggerDecoderError()) { if (isTriggerDecoderError()) {

View File

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

View File

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