Fixed overflow bug in CLI tasks command

This commit is contained in:
Martin Budden 2017-01-06 12:40:01 +00:00
parent 93dfbaee8e
commit 32f2ae0d01
1 changed files with 1 additions and 1 deletions

View File

@ -3247,7 +3247,7 @@ static void cliTasks(char *cmdline)
cliPrintf("%02d - (%9s/%3s) ", taskId, taskInfo.subTaskName, taskInfo.taskName); cliPrintf("%02d - (%9s/%3s) ", taskId, taskInfo.subTaskName, taskInfo.taskName);
} }
} else { } else {
taskFrequency = (int)(1000000.0f / ((float)taskInfo.latestDeltaTime)); taskFrequency = taskInfo.latestDeltaTime == 0 ? 0 : (int)(1000000.0f / ((float)taskInfo.latestDeltaTime));
cliPrintf("%02d - (%13s) ", taskId, taskInfo.taskName); cliPrintf("%02d - (%13s) ", taskId, taskInfo.taskName);
} }
const int maxLoad = (taskInfo.maxExecutionTime * taskFrequency + 5000) / 1000; const int maxLoad = (taskInfo.maxExecutionTime * taskFrequency + 5000) / 1000;