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

Fix CMS task rate; correct cmsDeviceCount logic; coding style cleanup

The CMS task was configured to run at 60hz but there was limiting logic in place to restrict it to every 50ms (20hz). Remove the extra logic and simply run the task at 20hz.

There was incorrect logic that checked if `(cmsDeviceCount < 0)` to not run the task. Firstly `cmsDeviceCount` can never be < 0, and secondly the task should not run when it is 0 as that means there are no registered `displayPort` devices. Generally fix the logic to used `unsigned` for `cmsDeviceCount`. It can only ever be increaded (new device registered) and there is no mechanism to "unregister" a device.

Lots of coding style cleanup.
This commit is contained in:
Bruce Luckcuck 2020-04-10 09:51:38 -04:00
parent 04bbaa8590
commit 9fa0c3bb1e
2 changed files with 45 additions and 55 deletions

View file

@ -452,7 +452,7 @@ task_t tasks[TASK_COUNT] = {
#endif
#ifdef USE_CMS
[TASK_CMS] = DEFINE_TASK("CMS", NULL, NULL, cmsHandler, TASK_PERIOD_HZ(60), TASK_PRIORITY_LOW),
[TASK_CMS] = DEFINE_TASK("CMS", NULL, NULL, cmsHandler, TASK_PERIOD_HZ(20), TASK_PRIORITY_LOW),
#endif
#ifdef USE_VTX_CONTROL