Check cam ready and stable - General Help and Assistance on using CHDK stable releases - CHDK Forum

Check cam ready and stable

  • 4 Replies
  • 1431 Views
Check cam ready and stable
« on: 14 / April / 2021, 05:01:44 »
Advertisements
@reyalp

Hope you can help...again  ;)

I'm trying to find a way to pause my script, after I've captured an image outside on ALT mode, and ensure the camera is 'stable', eg not writing to the card and finished doing whatever Canon does after taking a shot.

I'm currently working with this:

Code: [Select]
repeat sleep(50) until ecnt ~= get_exp_count()
The trouble with just using this is approach is that the camera seems to be doing other stuff, ie led flashing, after the condition is met. Resulting in the Canon side refreshing the screen, thus removing my drawing.

Any ideas?

Cheers

Garry

*

Offline reyalp

  • ******
  • 14117
Re: Check cam ready and stable
« Reply #1 on: 14 / April / 2021, 13:25:32 »
Generally, there isn't way to detect when the Canon firmware is fully done saving a shot.

You can use the very hacky hack ckdhptp does for shoot and and download: Figure out the file path from image number and directory, and wait for it to stop growing.
That's in 'wait_file' around line 1122 https://app.assembla.com/spaces/chdkptp/subversion/source/HEAD/trunk/lua/rlibs.lua?_format=raw&disposition=inline but it's mixed in with some other cruft.

The image file name should be some thing like
img=string.format('%s/IMG_%04d.JPG',get_image_dir(),get_exp_count())

You'll obviously want to wait for exp_count to update before you do that ;)

For cameras with Canon raw support, you'll also want to use get_canon_image_format() to figure out if the extension should be JPG or CR2. If both raw and jpeg are enabled, you should be able to just wait for the jpeg.

Looks like I neglected to add get_canon_image_format to scripting docs. It return a bitmask with bit 1 set if canon jpeg is enabled, and bit 2 set if raw is enabled.
Don't forget what the H stands for.

Re: Check cam ready and stable
« Reply #2 on: 14 / April / 2021, 13:53:12 »
@reyalp

Many thanks for the insight.

In the end I decided to be pragmatic and add a manual refresh, ie by doing a half shutter press, and running a 3 sec background refresh.

Switch between LCD and EVF also refreshes.

So, my M3 Bracketing script is in a reasonable place now, other than being limited to EF-M lenses, ie I can’t get focus from my Sigma 10-20mm, ie via an electronic adapter. CHDK sees the lens OK, but, the focus is obtained via this function, which isn’t any good for the Sigma:

Code: [Select]
function get_focus_distance_lower() -- returns focus distance in mm, but note 'accuracy' is 1cm from Canon
    local x = -1
    if (bi.platsub == "101a") then
        x = peek(0x00244918, 2)
    elseif (bi.platsub == "120f") then
        x = peek(0x0024495C, 2)
    else
        error('Not 101a or 120f')
    end
    if x == -1 then return -1 else return x*10 end
end

*

Offline c_joerg

  • *****
  • 1251
Re: Check cam ready and stable
« Reply #3 on: 14 / April / 2021, 16:09:02 »
So, my M3 Bracketing script is in a reasonable place now, other than being limited to EF-M lenses, ie I can’t get focus from my Sigma 10-20mm, ie via an electronic adapter. CHDK sees the lens OK, but, the focus is obtained via this function, which isn’t any good for the Sigma:

Have you tried that in AF and MF?
Did you read this about the Sigma lens?
https://chdk.setepontos.com/index.php?topic=13756.msg145330#msg145330
M100 100a, M3 121a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd


Re: Check cam ready and stable
« Reply #4 on: 14 / April / 2021, 16:30:57 »
@c_joerg

I'd forgotten about that conversation  ::)

I'm not trying to drive the lens, only read focus position in manual focus mode.

Looks like I’ll stick with using EF-M lenses when using my M3 Bracketing script  ;)
« Last Edit: 15 / April / 2021, 03:33:37 by pigeonhill »

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal