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 method to retrieve time to next time critical job #641

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

oseiler2
Copy link

In the context of the discussion here #640 I thought it's useful to get the time to the next critical job to help determine idle/sleep time on the node without having to guess using os_queryTimeCriticalJobs()

@cnmicha
Copy link

cnmicha commented Jun 16, 2021

Awesome idea!

I think it would make sense to also query OS.runnablejobs, making the function look like this:

ostime_t os_timeToNextTimeCriticalJob() {
    if(OS.runnablejobs) return 0;
    
    if (!OS.scheduledjobs) return 0x7FFFFFFFl; //ostime_t_max;
    return OS.scheduledjobs->deadline - os_getTime();
}

See the OS loop function, it checks OS.runnablejobs as well: https://github.com/mcci-catena/arduino-lmic/blob/master/src/lmic/oslmic.c#L146-L154

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.

2 participants