hopefully useful macro?
This commit is contained in:
parent
fde9a449cf
commit
609865da0f
|
@ -596,7 +596,7 @@ static void initStatusLeds(void) {
|
|||
|
||||
static bool isTriggerErrorNow() {
|
||||
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||
bool justHadError = (getTimeNowNt() - engine->triggerCentral.triggerState.lastDecodingErrorTime) < US2NT(MS2US(200));
|
||||
bool justHadError = (getTimeNowNt() - engine->triggerCentral.triggerState.lastDecodingErrorTime) < MS2NT(200);
|
||||
return justHadError || isTriggerDecoderError();
|
||||
#else
|
||||
return false;
|
||||
|
|
|
@ -87,7 +87,7 @@ private:
|
|||
void PeriodicTask(efitick_t nowNt) override {
|
||||
UNUSED(nowNt);
|
||||
|
||||
if (nowNt - engine->triggerCentral.triggerState.mostRecentSyncTime < US2NT(MS2US(500))) {
|
||||
if (nowNt - engine->triggerCentral.triggerState.mostRecentSyncTime < MS2NT(500)) {
|
||||
enginePins.checkEnginePin.setValue(1);
|
||||
chThdSleepMilliseconds(500);
|
||||
enginePins.checkEnginePin.setValue(0);
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
#define MS2US(MS_TIME) ((MS_TIME) * 1000)
|
||||
|
||||
// milliseconds to ticks
|
||||
#define MS2NT(msTime) US2NT(MS2US(msTime))
|
||||
|
||||
// todo: implement a function to work with times considering counter overflow
|
||||
#define overflowDiff(now, time) ((now) - (time))
|
||||
|
||||
|
|
Loading…
Reference in New Issue