Synchronising two S110's via the AF lamp - page 5 - General Discussion and Assistance - CHDK Forum

Synchronising two S110's via the AF lamp

  • 54 Replies
  • 11943 Views
Re: Synchronising two S110's via the AF lamp
« Reply #40 on: 25 / April / 2014, 11:17:43 »
Advertisements
Thanks, but unfortunately it doesn't seem to do anything. I tried shooting_set_focus(100, SET_NOW); before shooting, before and after AF finished, and even continuously during half-press. Also with SET_LATER . But the camera still just focuses normally (I'm pressing the shutter by hand if it makes any difference)
It's definitely not going to do anything if you press the shutter button by hand.   When you set focus and exposure values within CHDK, most of that is actually managed when CHDK processes the shooting. If you are initiating a shoot with the shutter button, CHDK has no way of knowing what you have done and the camera will simply do its normal focus & set exposure,  ignoring anything CHDK was trying to do.

Incidentally,  you might want to also experiment with using SET_LATER rather than SET_NOW - but my advice above still stands either way.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 13502
Re: Synchronising two S110's via the AF lamp
« Reply #41 on: 25 / April / 2014, 16:12:15 »
It's definitely not going to do anything if you press the shutter button by hand.   When you set focus and exposure values within CHDK, most of that is actually managed when CHDK processes the shooting.
If you are initiating a shoot with the shutter button, CHDK has no way of knowing what you have done and the camera will simply do its normal focus & set exposure,  ignoring anything CHDK was trying to do.
It's not really a matter of CHDK not knowing or managing the shot. The same code is run regardless, CHDK has code to specifically ignore the SET_LATER values unless a script is running or USB remote is active. Remove those checks and it would probably work fine with manual presses (though I won't guarantee this doesn't break somewhere else).

Alternately, you could set the menu override values rather than the script values.

Or use MF or AF lock, in which case the SET_NOW value would be applied immediately and should not change when you shoot.
Don't forget what the H stands for.

Re: Synchronising two S110's via the AF lamp
« Reply #42 on: 25 / April / 2014, 18:03:36 »
It's not really a matter of CHDK not knowing or managing the shot.
Yea - major brain hemorage on my part.  The button press has to end up eventually working through the intercepted code in capt_seq.c in order for menu exposure & focus overrides to work.

Quote
Or use MF or AF lock, in which case the SET_NOW value would be applied immediately and should not change when you shoot.
As stated earlier,  set_aflock() crashes the S110 camera when a set_focus() is used.  But set_mf() should be okay.

Using shooting_set_focus(100, SET_NOW) prior to a manual button press will not work unless AFL or MF is active though.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Synchronising two S110's via the AF lamp
« Reply #43 on: 26 / April / 2014, 07:53:19 »
Thanks, it works now I just needed to have manual focus enabled. And SET_LATER also works when those checks are disabled. In fact, the menu override also requires the camera to be in manual mode aswell.

So how can I put the camera in manual mode? I tried to grep for some definition of set_mf() but even in the lib folder there wasn't really anything much. So I tried shooting_set_prop(6, 4); , which did indeed set that propcase to 4, but the camera didn't seem to pay any attention to the update unfortunately.


Re: Synchronising two S110's via the AF lamp
« Reply #44 on: 26 / April / 2014, 11:04:30 »
Thanks, it works now I just needed to have manual focus enabled. And SET_LATER also works when those checks are disabled. In fact, the menu override also requires the camera to be in manual mode aswell.
We have not cleaned up the menu SD override functions yet so that's not a big surprise.

Quote
So how can I put the camera in manual mode? I tried to grep for some definition of set_mf() but even in the lib folder there wasn't really anything much. So I tried shooting_set_prop(6, 4); , which did indeed set that propcase to 4, but the camera didn't seem to pay any attention to the update unfortunately.
Take a look the DoMFLock() and UnlockMF() functions in the wrappers.c file used by your camera (in platform/s110).  Note that the actual code there varies by camera so you are better off calling those functions rather than reproduce the little bit of code they contain.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Synchronising two S110's via the AF lamp
« Reply #45 on: 04 / May / 2014, 09:45:53 »
Quote
Take a look the DoMFLock() and UnlockMF() functions in the wrappers.c file used by your camera (in platform/s110).  Note that the actual code there varies by camera so you are better off calling those functions rather than reproduce the little bit of code they contain.
Thanks, that worked.

Just a quick update, I haven't posted in a while.

I've finished all the transmission stuff now including reading and setting the propcases (for aperture, ISO, shutter speed, ND filter state, DR correction, shadow correction and white balance mode) as well as focus. Focus goes into it's own 16-bit buffer, and everything else fits into 32 bits with several bits to spare. Everything is sent as one 48 bit packet. I'll probably add a few other things like whether or not a raw file is saved.

So the next thing to do is to tie everything together in a way that won't likely leave the slave in a suspended half-press state if something goes wrong. Then I'll also have to add synchronised zooming.


A quick question though, if I use shooting_in_progress() in order to run a command when shooting is done, will that return false as soon as the shot is taken or after the shot is processed/saved and it's ready for the next one? And what if it's taking a dark-frame subtraction?


Thanks for all the help with the project so far, it's nearly done now  :)


Edit: Looks like I got the 111111th post  :D
Quote
111111 Posts in 10728 Topics by 10161 Members. Latest Member: JMarques
Latest Post: "Re: Synchronising two S1..." ( Today at 22:45:53 )
View the most recent posts on the forum.
[More Stats]

Edit again: to answer my own question, shooting_in_progress() appears to be true untill the image has been processed and saved (tried it with inbuilt raw saving). Which will make things easier.
« Last Edit: 04 / May / 2014, 11:53:14 by Recyclojunk64 »

*

Offline reyalp

  • ******
  • 13502
Re: Synchronising two S110's via the AF lamp
« Reply #46 on: 04 / May / 2014, 16:39:09 »
Edit again: to answer my own question, shooting_in_progress() appears to be true untill the image has been processed and saved (tried it with inbuilt raw saving). Which will make things easier.
It probably won't tell you reliably if the jpeg has finished saving. I don't know about Canon native raw, but I wouldn't bet on that either.

shooting_in_progress just returns the value of PROPCASE_SHOOTING (see core/shooting.c), so the exact behavior isn't specified by CHDK.
Don't forget what the H stands for.

Re: Synchronising two S110's via the AF lamp
« Reply #47 on: 07 / May / 2014, 11:48:58 »
Edit again: to answer my own question, shooting_in_progress() appears to be true untill the image has been processed and saved (tried it with inbuilt raw saving). Which will make things easier.
It probably won't tell you reliably if the jpeg has finished saving. I don't know about Canon native raw, but I wouldn't bet on that either.

shooting_in_progress just returns the value of PROPCASE_SHOOTING (see core/shooting.c), so the exact behavior isn't specified by CHDK.

Well as long as it doesn't return zero until the actual shot itself is taken, it shouldn't be much of a problem.



Another thing of interest, I had some trouble with shooting_set_sv96. It consistently set the slave's iso to about 1 stop higher than what it should have been, but the exif data showed the correct value. I was using shooting_get_prop(347) (347 is PROPCASE_SV) on the master to get the iso, and shooting_set_sv96 was receiving the same value as that put out.

The solution was to modify shooting_set_sv96 by removing the + SV96_MARKET_OFFSET from this line:

short dsv96 = sv96 + SV96_MARKET_OFFSET - canon_sv96_base;

so it now looks like this:
Code: [Select]
void shooting_set_sv96(short sv96, short is_now)
{
    if (!camera_info.state.mode_play)
    {
        if (is_now)
        {
            while ((shooting_is_flash_ready()!=1) || (focus_busy)) msleep(10);

            short iso_mode = shooting_get_canon_iso_mode();
            if (iso_mode >= 50)
                shooting_set_iso_mode(0);   // Force AUTO mode on camera

            short dsv96 = sv96 - canon_sv96_base; //Changed

            set_property_case(PROPCASE_SV_MARKET, &canon_sv96_base, sizeof(canon_sv96_base));
            set_property_case(PROPCASE_SV,        &sv96, sizeof(sv96));
            set_property_case(PROPCASE_DELTA_SV,  &dsv96, sizeof(dsv96));
        }
        else   
            photo_param_put_off.sv96 = sv96;
    }
}

And it now works fine, but I'm not exactly sure why. Isn't PROPCASE_SV_MARKET only for the exif? And if so, why would the exif values be correct while the actual image brightness was not?


Re: Synchronising two S110's via the AF lamp
« Reply #48 on: 09 / May / 2014, 11:16:29 »
Well it now seems to be usable, and is working quite well, except for one thing. The focus is significantly offset.

I was using shooting_get_subject_distance() to read the focus, and shooting_set_focus(distance, SET_NOW) to set it. It worked, but the slave was massively short-sighted (if the master was focused, say 2 metres away, the slave would be focused to about a foot). So I tried using shooting_get_subject_distance() to read the distance the slave was actually focused at, and found it was about 43 units less than the number being put into shooting_set_focus.

I looked into the code behind those functions in shooting.c and found the native(?) functions lens_get_focus_pos_from_lens() and lens_set_focus_pos(distance), which I tried instead, but they gave the same results.


I tried adding 43 to the number before applying it, and that massively improved the slave's focus. But it seems it isn't linear, the number has to be much larger when the subject is further away. I imagine this is from slight variations between the two lenses. I don't particularly want to devise a complicated mathematical function to compensate for this (does it even have a FPU?) so is there any other way I might be able to get around this?


Otherwise I'll just stick to non-synchronised focus, which isn't too bad really. I might even try to move the AF box around on the slave to follow the master's, but it would be nice if I could get this working.

Re: Synchronising two S110's via the AF lamp
« Reply #49 on: 09 / May / 2014, 11:21:36 »
I took lots of photos yesterday with my SX220hs stereo rig.
I used SDM focus-cancel mode with the usb switch.
One click to focus, longer press-and-release to take photos.

They are all in-focus, of course  :)


David

 

Related Topics