minor refactoring

This commit is contained in:
rusefi 2019-07-06 20:16:14 -04:00
parent 5d2afd2331
commit 5bdb7f7155
1 changed files with 2 additions and 3 deletions

View File

@ -230,9 +230,8 @@ static void periodicSlowCallback(Engine *engine);
static void scheduleNextSlowInvocation(void) {
// schedule next invocation
int periodMs = CONFIGB(generalPeriodicThreadPeriodMs);
if (periodMs == 0)
periodMs = 50; // this might happen while resetting configuration
// we need at least protection from zero value while resetting configuration
int periodMs = maxI(50, CONFIGB(generalPeriodicThreadPeriodMs));
chVTSetAny(&periodicSlowTimer, TIME_MS2I(periodMs), (vtfunc_t) &periodicSlowCallback, engine);
}