Setting focus from scripts or menus - page 26 - General Discussion and Assistance - CHDK Forum

Setting focus from scripts or menus

  • 601 Replies
  • 190860 Views
*

Offline srsa_4c

  • ******
  • 4451
Re: Setting focus from scripts or menus : changes to shooting.c
« Reply #250 on: 22 / February / 2014, 14:58:08 »
Advertisements
Unfortunately, the test results tell us a lot, but not everything. For example, when a crash occurs, is it because of the method being used to enable SD override crashes or because _MoveFocusLensToDistance() crashes?
It's most likely the latter. The crash occurs because _MoveFocusLensToDistance() is called from a part of the fw code where it was not meant to be called. I think that most cameras that crash on half-shoot can use _MoveFocusLensToDistance(), if the call precedes half-shoot.
I have mentioned the following 3 times in this thread, let's make it 4.
Could we have the option, not to call _MoveFocusLensToDistance() in shooting_expo_param_override() ?

Using native manual focus is like this:
- enable it
- set the focus
- shoot (focus is not touched here, unless safety MF is on / servo AF is on / focus bracketing is on)

CHDK, on the other hand, currently enforces setting the focus prior to shooting, whether or not it's needed.

Re: Setting focus from scripts or menus : changes to shooting.c
« Reply #251 on: 22 / February / 2014, 15:20:35 »
I have mentioned the following 3 times in this thread, let's make it 4.
Sorry,  I'm guess that I'm not getting what you are trying to tell me. Are you suggesting that this is possibly the only issue with the whole set_focus() mess?  Fix this and the problem goes away and all the #defines and mess in shooting_can_focus() are not needed?

Quote
Could we have the option, not to call _MoveFocusLensToDistance() in shooting_expo_param_override() ?
Is the option something invoked at compile time via a #define?  How do cams with this enabled do SD override?

Quote
Using native manual focus is like this:
- enable it
- set the focus
- shoot (focus is not touched here, unless safety MF is on / servo AF is on / focus bracketing is on)
How would this work with cams that don't seem to support MF modes then ?  ( A2300, A3400, A4000, D20, SX500 etc)
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14080
Re: Setting focus from scripts or menus : changes to shooting.c
« Reply #252 on: 22 / February / 2014, 15:32:29 »
It's most likely the latter. The crash occurs because _MoveFocusLensToDistance() is called from a part of the fw code where it was not meant to be called. I think that most cameras that crash on half-shoot can use _MoveFocusLensToDistance(), if the call precedes half-shoot.
I have mentioned the following 3 times in this thread, let's make it 4.
Could we have the option, not to call _MoveFocusLensToDistance() in shooting_expo_param_override() ?

Using native manual focus is like this:
- enable it
- set the focus
- shoot (focus is not touched here, unless safety MF is on / servo AF is on / focus bracketing is on)

CHDK, on the other hand, currently enforces setting the focus prior to shooting, whether or not it's needed.
I'm a bit confused by this. In cameras with true MF and the defines set up correctly, set_focus should take effect immediately. Are you saying it gets set *again* in the override code?

Note this *probably* should work in AF lock too, but I haven't tested it.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: Setting focus from scripts or menus : changes to shooting.c
« Reply #253 on: 22 / February / 2014, 15:43:57 »
Using native manual focus is like this:
- enable it
- set the focus
- shoot (focus is not touched here, unless safety MF is on / servo AF is on / focus bracketing is on)
I'm a bit confused by this. In cameras with true MF and the defines set up correctly, set_focus should take effect immediately.
The above is how MF mode works on cameras that have it, without CHDK.

Are you suggesting that this is possibly the only issue with the whole set_focus() mess?
Probably not. This scenario should have been part of the test, now it's a bit late.

Quote
Quote
Could we have the option, not to call _MoveFocusLensToDistance() in shooting_expo_param_override() ?
Is the option something invoked at compile time via a #define?  How do cams with this enabled do SD override?
Could be compile time option or runtime option. Setting the focus would be a separate step then. I'm not sure about the actual implementation.


*

Offline reyalp

  • ******
  • 14080
Re: Setting focus from scripts or menus : changes to shooting.c
« Reply #254 on: 22 / February / 2014, 15:53:38 »
Quote
I'm a bit confused by this. In cameras with true MF and the defines set up correctly, set_focus should take effect immediately.
The above is how MF mode works on cameras that have it, without CHDK.
It's also how sd override is supposed to work in MF mode *with* chdk to, for script at least. It uses SET_NOW if the camera is in MF.

Are you saying we should do the same if the camera is in AF lock, at least for the cameras that crash when trying to sd over in af lock?
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: Setting focus from scripts or menus : changes to shooting.c
« Reply #255 on: 22 / February / 2014, 16:02:12 »
Are you saying we should do the same if the camera is in AF lock, at least for the cameras that crash when trying to sd over in af lock?
We could at least try. Either in AF lock or in enforced MF mode (PT_MFOn), whichever is working. Problem is that making this work may involve a bigger rewrite of override related code, and can potentially be non-backwards compatible with older scripts...

*

Offline reyalp

  • ******
  • 14080
Re: Setting focus from scripts or menus : changes to shooting.c
« Reply #256 on: 22 / February / 2014, 16:10:23 »
Are you saying we should do the same if the camera is in AF lock, at least for the cameras that crash when trying to sd over in af lock?
We could at least try. Either in AF lock or in enforced MF mode (PT_MFOn), whichever is working. Problem is that making this work may involve a bigger rewrite of override related code, and can potentially be non-backwards compatible with older scripts...
I think it would definitely be good to try.

The existing code is so complicated and broken on some many cameras, I think backward compatibility should be quite low in our priority list. Lets make it work is much as can.
Don't forget what the H stands for.

Re: Setting focus from scripts or menus : changes to shooting.c
« Reply #257 on: 22 / February / 2014, 16:19:32 »
Probably not. This scenario should have been part of the test, now it's a bit late.
I think it would definitely be good to try.
There are several other things I wish I could have added to the test suite ( bypass crashes only at the set_focus() command,  check with TRACKING_AF and CONTINUOUS_AF on & off, etc) and I'm sure there will be more.

Its been a lot of work to get to 70% test coverage.  I wonder if we can reduce things to a smaller set of cams that the core CHDK members own,  test and make changes,  and then fix up the others as the complaints come in?
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 14080
Re: Setting focus from scripts or menus : changes to shooting.c
« Reply #258 on: 22 / February / 2014, 16:27:59 »
Does the code need to check for CONTINUOUS_FOCUS or SERVO_AF enabled?
I would say yes. These modes crash on most (all?) cameras, and don't really make sense in combination with SD override.

Quote
I wonder if we can reduce things to a smaller set of cams that the core CHDK members own,  test and make changes,  and then fix up the others as the complaints come in?
If it works on all the cameras we (developers / active participants) have, I would be fine with that. If the results are mixed (some cameras crash when you try to do it outside of shooting, some crash inside etc...) then it would probably need it's own define and be enabled on a case by case basis.
Don't forget what the H stands for.

Re: Setting focus from scripts or menus : please run this script and report back
« Reply #259 on: 22 / February / 2014, 17:23:32 »
To capture today's IRC discussion about changes to shooting.c,  the proposal is to replace the #defines mentioned above with these four :

Code: [Select]
CAM_SD_OVER_IN_AF                   // Camera allows SD override if MF & AFL not set
CAM_SD_OVER_IN_AFL                  // Camera allows SD override when AFL is set
CAM_SD_OVER_IN_MF                   // Camera allows SD override when MF is set         
CAM_SD_OVER_ENABLE_METHOD           // Method used to enable camera SD override.
and rewrite shooting_can_focus() to use them.

By default,  the camera is in AF (autofocus) mode. Otherwise, the camera is in AFL mode if PROPCASE_AF_LOCK==1 and in MF when PROPCASE_FOCUS_MODE==1.

The values for CAM_SD_OVER_ENABLE_METHOD are :

Code: [Select]
   0=none
   1=set_aflock() 
   2=Press_SW1_and_MF 
   3=SS.Create&SS.MFOn 
   4=SS.Create&PT_MFOn 
   5=RegisterShootSeqEvent&PT_MFOn
   6=RegisterShootSeqEvent&MFOn

The special case for the CAMERA_ixus800_sd700 in shooting_can_focus() gets removed and shooting_can_focus() returns false if PROPCASE_CONTINUOUS_AF==1 or PROPCASE_SERVO_AF==1.


Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics