Timing problems with "shoot_full_only" - page 2 - General Discussion and Assistance - CHDK Forum

Timing problems with "shoot_full_only"

  • 34 Replies
  • 15538 Views
*

Offline lapser

  • *****
  • 1093
Re: Timing problems with "shoot_full_only"
« Reply #10 on: 06 / December / 2012, 22:24:26 »
Advertisements
Wow, thanks for all that information, I'll check it out.

I think I've solved the timing problems when using shoot_full_only with half_press. I added a new volatile int shot_ready, and 2 new Lua functions to raw.c.

set_shot_wait() stores a 0 in shot_ready (call in Lua right before press("shoot_full_only")

get_shot_ready() returns the value of shot_ready

Right after the call to build_histogram in raw.c, I added:
shot_ready=1;

It seems to work well, I just did a time lapse at 1 frame per second, measuring the exposure after each shot, and adjusting the shutter speed for the next shot. See:
http://chdk.setepontos.com/index.php?topic=8997.msg94214#msg94214

I could eliminate the set_shot_wait() call if I could figure out where the code that handles press("shoot_full_only") is.  That is, press("shoot_full_only") would call set_shot_wait() instead of doing it in Lua.

Can someone tell me where the "shoot_full_only" action is handled? Thanks.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Timing problems with "shoot_full_only"
« Reply #11 on: 06 / December / 2012, 23:23:07 »
Can someone tell me where the "shoot_full_only" action is handled? Thanks.
Its not really "handled".   Its simply a bit mask that allow a script or other code to press or release the "shoot_full" bit in the keymap[] without also pressing or releasing the "shoot_half" bit.  So there is no code that "handles press("shoot_full_only")" in the manner you are hoping for.
« Last Edit: 06 / December / 2012, 23:25:31 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: Timing problems with "shoot_full_only"
« Reply #12 on: 07 / December / 2012, 01:17:50 »
Can someone tell me where the "shoot_full_only" action is handled? Thanks.
Its not really "handled".   Its simply a bit mask that allow a script or other code to press or release the "shoot_full" bit in the keymap[] without also pressing or releasing the "shoot_half" bit.  So there is no code that "handles press("shoot_full_only")" in the manner you are hoping for.
Actually, I just want to set a flag when Lua calls for a press or click of shoot_full_only. I've tracked it down to luascript.c here:
Code: (lua) [Select]
// for press,release and click
static int luaCB_keyfunc( lua_State* L )
{
  void* func = lua_touserdata( L, lua_upvalueindex(1) );
  ((void(*)(long))func)( lua_get_key_arg( L, 1 ) );
  return lua_yield( L, 0 );
}
//I could modify the above to:
static int luaCB_keyfunc( lua_State* L )
{
  void* func = lua_touserdata( L, lua_upvalueindex(1) );
int arg=lua_get_key_arg( L, 1 );
  if(arg==KEY_SHOOT_FULL_ONLY)
  {... and function is press or click, but not release....}
  ((void(*)(long))func)( arg);
  return lua_yield( L, 0 );
}
Func points to either press, click, or release. I know the key is shoot_full_only, but I only want to set my wait flag if it's press or click. The register functions code is above this, but I haven't been able to figure it out.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline reyalp

  • ******
  • 14128
Re: Timing problems with "shoot_full_only"
« Reply #13 on: 07 / December / 2012, 21:40:03 »
Actually, I just want to set a flag when Lua calls for a press or click of shoot_full_only. I've tracked it down to luascript.c here:
Why on earth would you want to do that???

I am *not* in favor of adding more spaghetti and magic special cases to the code.

edit:
If you can give a general description of what you are trying to accomplish and how you would use this flag to do it, we may be able to suggest better approaches.
« Last Edit: 07 / December / 2012, 22:33:32 by reyalp »
Don't forget what the H stands for.

*

Offline lapser

  • *****
  • 1093
Re: Timing problems with "shoot_full_only"
« Reply #14 on: 07 / December / 2012, 23:35:44 »
Actually, I've already accomplished what I was trying to do, which is solve the timing problem with shoot_full_only. The result is that I can take pictures at better than 1 shot per second, with accurate metering (in histogram.c). I added two Lua Functions that do what get_shooting() does for shots that press and release half_shoot.

set_shot_wait() is called right before press("shoot_full_only"). It clears the shot_ready flag to 0.
Then, in raw.c, I set the shot_ready flag to 1 right after the call to build_histogram.
get_shot_ready() tells me the histogram is done, or if it isn't enabled, that I can release "shoot_full_only" and the camera will recognize a new press and initiate a new shot. If you press shoot_full_only while the camera is still taking the last shot, it will ignore it, and slow down the shot rate. You can demonstrate this by pressing the shutter rapidly (with your finger) and only releasing it half way. As you press faster, it starts missing shots. The best time to press is right after you hear the shutter click closed. raw file save is called right at that time.

What I'm trying to do is eliminate the necessity for a Lua call to set_shot_wait() right before press shoot_full_only, which will make less code, and less complexity for using the capability in Lua. This is how simple it is to take metered shots faster that 1 per second with the new functions:
Code: (Lua) [Select]
repeat
  press("shoot_full_only")
  repeat sleep(10)until get_shot_ready()
  release("shoot_full_only")
  tv=tv+get_shot_meter()
  set_prop(pTV,tv)
  set_prop(pTV2,tv)
  sleep(1)
until false
As for the question at hand, I realized that I can just clear the shot_waiting flag to 0 for press, click, or release of shoot_full_only. I don't have to figure out how to tell them apart or add any complexity. Just one call in luascript.c does it, and I know where it goes. I'll let you know if it works.

I just got finished taking some time lapses with my new functions. I'll post them in the other thread by tomorrow. They take a little time to process. You can take a look at yesterday's video results here, created with the get_shot_meter() function:
http://chdk.setepontos.com/index.php?topic=8997.msg94214#msg94214
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Timing problems with "shoot_full_only"
« Reply #15 on: 07 / December / 2012, 23:41:26 »
The result is that I can take pictures at better than 1 shot per second, with accurate metering (in histogram.c).
Doing this from a script has become something of a "quest for the holy grail".   I recall several posts suggesting it is impossible.   So good for you if you have even gotten close.

Can you sustain that rate for more than 5 or 10 seconds ?  What speed SD card are you using ?

I guess the other question will quickly be which cameras can actually shoot that fast.  Time will tell I guess.

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: Timing problems with "shoot_full_only"
« Reply #16 on: 08 / December / 2012, 00:10:17 »
Doing this from a script has become something of a "quest for the holy grail".   I recall several posts suggesting it is impossible.   So good for you if you have even gotten close.

Can you sustain that rate for more than 5 or 10 seconds ?  What speed SD card are you using ?

I guess the other question will quickly be which cameras can actually shoot that fast.  Time will tell I guess.
I've been using the sx260 for all my tests. Yesterday it handled 1 shot per second, which was the rate on the video I posted. Each frame is a different picture, at 30FPS.

Essentially, I'm trying to get the same rate as the camera gets by holding the shutter down in continuous drive mode. Whatever rate the camera can do this way, I think I can get close. But the real breakthrough is the metering, not the speed. I'll post more about that in the other thread after I finished processing the pictures I took tonight.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Timing problems with "shoot_full_only"
« Reply #17 on: 08 / December / 2012, 00:31:18 »
Essentially, I'm trying to get the same rate as the camera gets by holding the shutter down in continuous drive mode. Whatever rate the camera can do this way, I think I can get close. But the real breakthrough is the metering, not the speed.
Very nice !
Quote
I'll post more about that in the other thread after I finished processing the pictures I took tonight.
Other thread ?  Where ?  Six month for now, nobody reading this will know where to go.  Not so nice ..
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: Timing problems with "shoot_full_only"
« Reply #18 on: 08 / December / 2012, 00:40:33 »
Other thread ?  Where ?  Six month for now, nobody reading this will know where to go.  Not so nice ..
Yes, I see what you mean about the thread confusion.
http://chdk.setepontos.com/index.php?topic=8997.msg94214#msg94214
I promised to post everything in the "Shot Histogram Request" thread, except for the timing problems related to shoot_full_only. So the metering stuff will be in that thread, and I'll stop posting to this one except about timing issues, which I think are almost solved now. (But what I think is frequently proven not true!).
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline lapser

  • *****
  • 1093
Re: Timing problems with "shoot_full_only"
« Reply #19 on: 08 / December / 2012, 02:30:17 »
Code: (C) [Select]
// for press,release and click
static int luaCB_keyfunc( lua_State* L )
{
  raw_set_shot_wait(); //clears shot ready flag to 0 - polled by get_shot_ready()
  void* func = lua_touserdata( L, lua_upvalueindex(1) );
  ((void(*)(long))func)( lua_get_key_arg( L, 1 ) );
  return lua_yield( L, 0 );
}
//below is in raw.c
void raw_set_shot_wait() //called when shoot_full or shoot_full_only is clicked or pressed
{
  shot_ready=0;
}
Just adding one call  in luascript.c solved the timing problem without adding another lua function. I realized I don't even have to know anything about the key, or if it was pressed, released, or clicked. As long as pressing shoot_full_only clears the shot_ready flag, it will work.

I could put the shoot_full_only flag itself in raw.h and save the space and time overhead of defining and calling a function in raw.c. The function call would become:  shot_ready=0  Would this be acceptable, and preferable?

I have the new test time lapse video, and a discussion of the new metering method in the other topic here:
http://chdk.setepontos.com/index.php?topic=8997.new#new
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

 

Related Topics


SimplePortal © 2008-2014, SimplePortal