Accessing the File Number within Modules? - General Discussion and Assistance - CHDK Forum

Accessing the File Number within Modules?

  • 1 Replies
  • 4213 Views
Accessing the File Number within Modules?
« on: 10 / August / 2016, 10:15:49 »
Advertisements
Hi all,

I'm currently working with a mutilated (by me) version of md_motion_detect and I am hoping to get some insight on how the file numbering system works. As of right now, I'm using the module to generate a stream of data from the live view image. I'm using this code to number and name the files:

Code: [Select]
sprintf(file+strlen(file),
TARGET_NAME,
"IMG_",
filenum,
".TIK");

filenum++;

However, this results in file number always being 0000 because "filenum" is instantiated at the top of the module every time md_motion_detect is called. Is there some way to grab the file number in the motion detect module? I know that you can't include platform.h. :(

Alternatively, can I grab the file number in a Lua script and then increment it? The issue with all of this is that the camera is never actually shooting because I'm not storing an actual "image," just the data from the live-view.

I'm totally new here, so I apologize if this post is misplaced and/or totally disorganized!

Re: Accessing the File Number within Modules?
« Reply #1 on: 10 / August / 2016, 12:33:36 »
Is there some way to grab the file number in the motion detect module? I know that you can't include platform.h. :(
What you are looking for is demonstrated in this script function : get_exp_count() which basically just calls this function in core/shooting.c :
Code: [Select]
long get_exposure_counter()
{
    long v = 0;
    get_parameter_data(param_file_counter, &v, 4);
    v = ((v>>4)&0x3FFF);
    return v;
}

Quote
The issue with all of this is that the camera is never actually shooting because I'm not storing an actual "image," just the data from the live-view.
While I understand what you are saying here,  I don't understand the issue.  Or why you want to use the current image number?
« Last Edit: 10 / August / 2016, 12:37:24 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal