Author Topic: Timer Code Help  (Read 3558 times)

mk11174

  • Contributor
  • Hero Member
  • *****
  • Posts: 809
Timer Code Help
« 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.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12290
  • Emergencies only
Re: Timer Code Help
« Reply #1 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.

mk11174

  • Contributor
  • Hero Member
  • *****
  • Posts: 809
Re: Timer Code Help
« Reply #2 on: July 31, 2013, 11:29:33 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!
500D/T1i  550D/T2i  600D/T3i  700D/T5i

mk11174

  • Contributor
  • Hero Member
  • *****
  • Posts: 809
Re: Timer Code Help
« Reply #3 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!
500D/T1i  550D/T2i  600D/T3i  700D/T5i