auto-sync

This commit is contained in:
rusEfi 2015-04-18 18:04:27 -04:00
parent 70b8402e23
commit 68aa284427
3 changed files with 11 additions and 7 deletions

View File

@ -473,6 +473,9 @@ static void setBlinkingPeriod(int value) {
} }
#if EFI_PROD_CODE || defined(__DOXYGEN__) #if EFI_PROD_CODE || defined(__DOXYGEN__)
extern efitick_t lastDecodingErrorTime;
/** /**
* this thread has a lower-then-usual stack size so we cannot afford *print* methods here * this thread has a lower-then-usual stack size so we cannot afford *print* methods here
*/ */
@ -483,24 +486,25 @@ static void blinkingThread(void *arg) {
initialLedsBlink(); initialLedsBlink();
while (true) { while (true) {
int delay = isConsoleReady() ? 3 * blinkingPeriod : blinkingPeriod; int delayMs = isConsoleReady() ? 3 * blinkingPeriod : blinkingPeriod;
#if EFI_INTERNAL_FLASH || defined(__DOXYGEN__) #if EFI_INTERNAL_FLASH || defined(__DOXYGEN__)
if (getNeedToWriteConfiguration()) { if (getNeedToWriteConfiguration()) {
delay = 2 * delay; delayMs = 2 * delayMs;
} }
#endif #endif
communicationPin.setValue(0); communicationPin.setValue(0);
warningPin.setValue(0); warningPin.setValue(0);
chThdSleepMilliseconds(delay); chThdSleepMilliseconds(delayMs);
communicationPin.setValue(1); communicationPin.setValue(1);
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) #if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
if (isTriggerDecoderError() || isIgnitionTimingError()) bool_t justHadError = (getTimeNowNt() - lastDecodingErrorTime) < US2NT(2 * 1000 * delayMs);
if (justHadError || isTriggerDecoderError() || isIgnitionTimingError())
warningPin.setValue(1); warningPin.setValue(1);
#endif #endif
chThdSleepMilliseconds(delay); chThdSleepMilliseconds(delayMs);
} }
} }

View File

@ -55,7 +55,7 @@ float actualSynchGap;
static Logging * logger; static Logging * logger;
efitick_t lastDecodingErrorTime = 0; efitick_t lastDecodingErrorTime = US2NT(-10000000LL);
/** /**
* @return TRUE is something is wrong with trigger decoding * @return TRUE is something is wrong with trigger decoding

View File

@ -290,5 +290,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0) if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array return 3211; // this is here to make the compiler happy about the unused array
return 20150417; return 20150418;
} }