auto-sync

This commit is contained in:
rusEfi 2016-10-09 19:03:51 -04:00
parent 34d2576511
commit 6da29c337d
6 changed files with 14 additions and 15 deletions

View File

@ -688,7 +688,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
efitimesec_t now = getTimeNowSeconds(); efitimesec_t now = getTimeNowSeconds();
tsOutputChannels->timeSeconds = now; tsOutputChannels->timeSeconds = now;
tsOutputChannels->isWarnNow = isWarningNow(now); tsOutputChannels->isWarnNow = isWarningNow(now, true);
if (engineConfiguration->debugMode == DBG_TPS_ACCEL) { if (engineConfiguration->debugMode == DBG_TPS_ACCEL) {
tsOutputChannels->debugIntField1 = engine->tpsAccelEnrichment.cb.getSize(); tsOutputChannels->debugIntField1 = engine->tpsAccelEnrichment.cb.getSize();

View File

@ -28,7 +28,7 @@ void assertVtList(void);
* *
*/ */
int warning(obd_code_e code, const char *fmt, ...); int warning(obd_code_e code, const char *fmt, ...);
bool isWarningNow(efitimesec_t now); bool isWarningNow(efitimesec_t now, bool forIndicator);
/** /**
* Something really bad had happened - firmware cannot function * Something really bad had happened - firmware cannot function
* *

View File

@ -1771,7 +1771,7 @@ typedef enum {
CUSTOM_OBD_95 = 6095, CUSTOM_OBD_95 = 6095,
CUSTOM_OBD_96 = 6096, CUSTOM_OBD_96 = 6096,
CUSTOM_OBD_97 = 6097, CUSTOM_OBD_97 = 6097,
CUSTOM_OBD_98 = 6098, CUSTOM_DWELL = 6098,
CUSTOM_TS_OVERFLOW = 6099, CUSTOM_TS_OVERFLOW = 6099,

View File

@ -62,8 +62,12 @@ static char warningBuffer[WARNING_BUFFER_SIZE];
static bool isWarningStreamInitialized = false; static bool isWarningStreamInitialized = false;
static MemoryStream warningStream; static MemoryStream warningStream;
bool isWarningNow(efitimesec_t now) { /**
return absI(now - engine->engineState.timeOfPreviousWarning) < engineConfiguration->warningPeriod; * @param forIndicator if we want to retrieving value for TS indicator, this case a minimal period is applued
*/
bool isWarningNow(efitimesec_t now, bool forIndicator) {
int period = forIndicator ? maxI(3, engineConfiguration->warningPeriod) : engineConfiguration->warningPeriod;
return absI(now - engine->engineState.timeOfPreviousWarning) < period;
} }
/** /**
@ -80,7 +84,7 @@ int warning(obd_code_e code, const char *fmt, ...) {
#endif #endif
efitimesec_t now = getTimeNowSeconds(); efitimesec_t now = getTimeNowSeconds();
if (isWarningNow(now) || !warningEnabled) if (isWarningNow(now, false) || !warningEnabled)
return true; // we just had another warning, let's not spam return true; // we just had another warning, let's not spam
engine->engineState.timeOfPreviousWarning = now; engine->engineState.timeOfPreviousWarning = now;

View File

@ -45,9 +45,9 @@ void turnSparkPinHigh(NamedOutputPin *output) {
static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventIndex, IgnitionEvent *iEvent, static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventIndex, IgnitionEvent *iEvent,
int rpm DECLARE_ENGINE_PARAMETER_S) { int rpm DECLARE_ENGINE_PARAMETER_S) {
float dwellMs = ENGINE(engineState.sparkDwell); const floatms_t dwellMs = ENGINE(engineState.sparkDwell);
if (cisnan(dwellMs) || dwellMs < 0) { if (cisnan(dwellMs) || dwellMs <= 0) {
warning(CUSTOM_OBD_45, "invalid dwell: %f at %d", dwellMs, rpm); warning(CUSTOM_DWELL, "invalid dwell: %f at %d", dwellMs, rpm);
return; return;
} }
@ -62,11 +62,6 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
return; return;
} }
if (cisnan(dwellMs)) {
firmwareError("NaN in scheduleOutput", dwellMs);
return;
}
/** /**
* We are alternating two event lists in order to avoid a potential issue around revolution boundary * We are alternating two event lists in order to avoid a potential issue around revolution boundary
* when an event is scheduled within the next revolution. * when an event is scheduled within the next revolution.

View File

@ -293,5 +293,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 20161003; return 20161009;
} }