refactoring: extracting DEEP_IN_THE_PAST_SECONDS contant
This commit is contained in:
parent
5bb778381a
commit
1735529a6b
|
@ -41,7 +41,7 @@ WarningCodeState::WarningCodeState() {
|
||||||
void WarningCodeState::clear() {
|
void WarningCodeState::clear() {
|
||||||
warningCounter = 0;
|
warningCounter = 0;
|
||||||
lastErrorCode = 0;
|
lastErrorCode = 0;
|
||||||
timeOfPreviousWarning = -10;
|
timeOfPreviousWarning = DEEP_IN_THE_PAST_SECONDS;
|
||||||
recentWarnings.clear();
|
recentWarnings.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ RpmCalculator::RpmCalculator() {
|
||||||
// which we cannot provide inside this parameter-less constructor. need a solution for this minor mess
|
// which we cannot provide inside this parameter-less constructor. need a solution for this minor mess
|
||||||
|
|
||||||
// we need this initial to have not_running at first invocation
|
// we need this initial to have not_running at first invocation
|
||||||
lastRpmEventTimeNt = (efitick_t) -10 * NT_PER_SECOND;
|
lastRpmEventTimeNt = (efitick_t) DEEP_IN_THE_PAST_SECONDS * NT_PER_SECOND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
|
|
||||||
TriggerWaveform triggerShape;
|
TriggerWaveform triggerShape;
|
||||||
|
|
||||||
efitick_t previousVvtCamTime = 0;
|
efitick_t previousVvtCamTime = DEEP_IN_THE_PAST_SECONDS * NT_PER_SECOND;
|
||||||
efitick_t previousVvtCamDuration = 0;
|
efitick_t previousVvtCamDuration = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -22,6 +22,12 @@
|
||||||
// milliseconds to ticks
|
// milliseconds to ticks
|
||||||
#define MS2NT(msTime) US2NT(MS2US(msTime))
|
#define MS2NT(msTime) US2NT(MS2US(msTime))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We use this 'deep in past, before ECU has ever started' value as a way to unify
|
||||||
|
* handling of first ever event and an event which has happened after a large pause in engine activity
|
||||||
|
*/
|
||||||
|
#define DEEP_IN_THE_PAST_SECONDS -10
|
||||||
|
|
||||||
// todo: implement a function to work with times considering counter overflow
|
// todo: implement a function to work with times considering counter overflow
|
||||||
#define overflowDiff(now, time) ((now) - (time))
|
#define overflowDiff(now, time) ((now) - (time))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue