Magic Lantern Forum

Developing Magic Lantern => General Development => Topic started by: Marsu42 on May 22, 2014, 05:45:28 PM

Title: How to deal with prop set lag?
Post by: Marsu42 on May 22, 2014, 05:45:28 PM
I guess you know the issue as it affects various modules: How do you detect if a user changed a property when the ML code also changes it?

Example: In auto_iso, I want to disable the module when the user changes/overrides the iso value. But since there is a lag between setting a prop and it being actually changed I cannot really tell if it was the code or the user that changed it:
1. current iso: 400 -> code sets it to 200
2. next shoot_task cycle: code detects "still 400" -> is it not yet changed to 200 or has the user set it back to 400?

Question: I recently saw some time detection (I guess it was alex' code?), but I don't quite remember where. Is there some rtos-like max. delay when I can say that the prop should have been changed by then?
Title: Re: How to deal with prop set lag?
Post by: a1ex on May 22, 2014, 06:15:57 PM
There is prop_request_change_wait; if I understand it well, it's exactly for this use case (it will change the property and wait for confirmation or timeout).

Note that you can't call this one from a prop handler (it will lockup, since your handler has to return before property events can processed).
Title: Re: How to deal with prop set lag?
Post by: Marsu42 on May 22, 2014, 07:41:00 PM
There is prop_request_change_wait; if I understand it well, it's exactly for this use case

Great, that's exactly what I'm looking for - thanks!

EDIT: Um, in the core code there are various values for timeout - from 100 to 1000: What would you say is a reasonable timeout setting for an iso change? If the timeout is too long and prop_request_change_wait is called in the (module) shoot task, will that drag down the system?
Title: Re: How to deal with prop set lag?
Post by: Audionut on May 23, 2014, 07:25:59 AM
What would you say is a reasonable timeout setting for an iso change?

I assume you will have to determine this yourself.

I can test 5D3.