1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

Minor performance optimisations

This commit is contained in:
Martin Budden 2016-12-15 15:04:47 +00:00
parent 013312f90f
commit 0b6ff0de10
2 changed files with 10 additions and 7 deletions

View file

@ -290,7 +290,7 @@ void updateRcCommands(void)
tmp = 0; tmp = 0;
} }
rcCommand[axis] = tmp; rcCommand[axis] = tmp;
} else if (axis == YAW) { } else {
if (tmp > rcControlsConfig()->yaw_deadband) { if (tmp > rcControlsConfig()->yaw_deadband) {
tmp -= rcControlsConfig()->yaw_deadband; tmp -= rcControlsConfig()->yaw_deadband;
} else { } else {
@ -778,9 +778,11 @@ void subTaskMotorUpdate(void)
#ifdef USE_SERVOS #ifdef USE_SERVOS
// motor outputs are used as sources for servo mixing, so motors must be calculated using mixTable() before servos. // motor outputs are used as sources for servo mixing, so motors must be calculated using mixTable() before servos.
servoTable(); if (isMixerUsingServos()) {
filterServos(); servoTable();
writeServos(); filterServos();
writeServos();
}
#endif #endif
if (motorControlEnable) { if (motorControlEnable) {

View file

@ -176,9 +176,10 @@ void setTaskEnabled(cfTaskId_e taskId, bool enabled)
uint32_t getTaskDeltaTime(cfTaskId_e taskId) uint32_t getTaskDeltaTime(cfTaskId_e taskId)
{ {
if (taskId == TASK_SELF || taskId < TASK_COUNT) { if (taskId == TASK_SELF) {
cfTask_t *task = taskId == TASK_SELF ? currentTask : &cfTasks[taskId]; return currentTask->taskLatestDeltaTime;
return task->taskLatestDeltaTime; } else if (taskId < TASK_COUNT) {
return cfTasks[taskId].taskLatestDeltaTime;
} else { } else {
return 0; return 0;
} }