refactoring: extracting DEEP_IN_THE_PAST_SECONDS contant
This commit is contained in:
parent
b6fe6555e0
commit
d48a57d599
|
@ -41,7 +41,7 @@ WarningCodeState::WarningCodeState() {
|
|||
void WarningCodeState::clear() {
|
||||
warningCounter = 0;
|
||||
lastErrorCode = 0;
|
||||
timeOfPreviousWarning = -10;
|
||||
timeOfPreviousWarning = DEEP_IN_THE_PAST_SECONDS;
|
||||
recentWarnings.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ RpmCalculator::RpmCalculator() {
|
|||
// 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
|
||||
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;
|
||||
|
||||
efitick_t previousVvtCamTime = 0;
|
||||
efitick_t previousVvtCamTime = DEEP_IN_THE_PAST_SECONDS * NT_PER_SECOND;
|
||||
efitick_t previousVvtCamDuration = 0;
|
||||
|
||||
private:
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
// milliseconds to ticks
|
||||
#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
|
||||
#define overflowDiff(now, time) ((now) - (time))
|
||||
|
||||
|
|
Loading…
Reference in New Issue