Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added call_scheduler #13636

Closed
wants to merge 1 commit into from
Closed

Conversation

limonspb
Copy link
Member

@limonspb limonspb commented May 13, 2024

allows to shcedule any function for a call like that, for example:

#include "common/call_scheduler.h"
....
ScheduleCall(myFunction, 5000000); // 5 seconds

myFunction will be executed by scheduler after 5 seconds or more.
Keep in mind that the execution time is not accurate, task running at 1000hz with TASK_PRIORITY_MEDIUM.

Adds new debug:

    DEBUG_SET(DEBUG_CALL_SCHEDULER, 0, lrintf(scheduledCallsCount));
    DEBUG_SET(DEBUG_CALL_SCHEDULER, 1, lrintf(refusedCalls));
    DEBUG_SET(DEBUG_CALL_SCHEDULER, 2, lrintf(totalCalls));

new functionality could be helpful in many cases, for example:
While saving stats/settings, can check if quad is stable (on the ground) then save, otherwize reschedule saving.
In future OSD menus when need to perform gyro-readings for some period of time.

Copy link

Do you want to test this code? You can flash it directly from Betaflight Configurator:

  • Simply put #13636 (this pull request number) in the Select commit field of the Configurator firmware flasher tab (you need to Enable expert mode, Show release candidates and Development).

WARNING: It may be unstable. Use only for testing!

@limonspb limonspb force-pushed the callScheduler branch 5 times, most recently from 0e5da49 to e177ccb Compare May 14, 2024 00:34
@limonspb
Copy link
Member Author

lol, just found out there is already similar functionality "dispatchAdd" :)
Closing this @haslinghuis

@limonspb limonspb closed this May 14, 2024
@SteveCEvans
Copy link
Member

See https://github.com/betaflight/betaflight/blob/master/src/main/fc/dispatch.c which does this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants