Magic Lantern Forum

Developing Magic Lantern => Reverse Engineering => Topic started by: mk11174 on July 31, 2013, 10:55:36 AM

Title: Timer Code Help
Post by: mk11174 on July 31, 2013, 10:55:36 AM
Hi, I was hoping anyone at all could give me a code example of a ML timer code, msleep just pauses live view if I try to use it, so I am guessing that is not the best option for what I am doing. I am using bolt trigger, and I wanted to add an extra thing to it, I want it to set off a detection every 10 seconds so I can have it capture images for a time lapse while it is waiting for actual bolts. I don't want to take regular pictures, just the RAW buffer captures, so I just want to say something like,

      if(timer==10)
     {
      bolt_raw_recording = 1;
     }
}

But how can I create a simple time code that wont freeze live view like msleep? Anyone that can help I would really be greatful, thanks.
Title: Re: Timer Code Help
Post by: a1ex on July 31, 2013, 11:17:52 AM
You can check the timer value periodically with get_ms_clock_value.

Or, for your case:

int aux = INT_MIN;
if (should_run_polling_action(10000, &aux)) ...

This call is not blocking, so you can use it from vsync without pausing LiveView.
Title: Re: Timer Code Help
Post by: mk11174 on July 31, 2013, 11:29:33 AM
Quote from: a1ex on July 31, 2013, 11:17:52 AM
You can check the timer value periodically with get_ms_clock_value.

Or, for your case:

int aux = INT_MIN;
if (should_run_polling_action(10000, &aux)) ...

This call is not blocking, so you can use it from vsync without pausing LiveView.
OK! Thank you very much!
Title: Re: Timer Code Help
Post by: mk11174 on July 31, 2013, 04:21:13 PM
Hope not asking to much, but I cannot at all get it to loop, it will only go active once, any ideas?

YES!!! Finally figured it out, thanks again Alex!