shooting_can_focus() - General Discussion and Assistance - CHDK Forum

shooting_can_focus()

  • 4 Replies
  • 2263 Views
*

Offline funnel

  • ****
  • 349
shooting_can_focus()
« on: 25 / April / 2012, 16:58:47 »
Advertisements
Code: [Select]
short shooting_can_focus()
{
    int m=mode_get()&MODE_SHOOTING_MASK;
#if !CAM_CAN_SD_OVER_NOT_IN_MF && CAM_CAN_SD_OVERRIDE
#if CAM_CAN_SD_OVER_IN_AF_LOCK
    if (shooting_get_prop(PROPCASE_AF_LOCK))
        return 1;
#endif
    return (shooting_get_common_focus_mode()) || MODE_IS_VIDEO(m));
#elif !CAM_CAN_SD_OVERRIDE
    return MODE_IS_VIDEO(m);
#elif defined (CAMERA_ixus800_sd700)
    // TODO whats the reason for this ?!?
    return (shooting_get_zoom()<8) && (m!=MODE_AUTO) && (m!=MODE_SCN_UNDERWATER);
#else
    return 1;
#endif
}

I have this issue when the camera crashes when using SD overrides in video mode. When I switch from MF to AF and halfpress the camera crashes because it tries to override SD in AF.

The problem is in this MODE_IS_VIDEO(m)) check. It returns 1 even when the camera is in AF.

Is this really needed on all cameras?

« Last Edit: 25 / April / 2012, 17:01:07 by funnel »

*

Offline funnel

  • ****
  • 349
Re: shooting_can_focus()
« Reply #1 on: 30 / April / 2012, 04:41:45 »
I wrapped this in CAM_HAS_VIDEO_BUTTON define. Maybe somebody could test it and if it's ok for all cameras with the video button and maybe later could be added to the trunk.

The crash occurs when the camera is set to dial video mode. When switching to MF and using SD overrides and then switching back to AF and pressing half_press.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: shooting_can_focus()
« Reply #2 on: 01 / May / 2012, 07:48:25 »
Did some testing on this:

SX30 & SX40 - crashed without the patch, work ok with the patch (both have a dedicated video button).
G12 - does not have video button so no change; but the SD override does not work in video mode even in MF.
G1X - has video button, did not crash, SD override did not work unless in MF mode so the patch does not effect functionality.

I'd be inclined to add this as another #define rather than tie it CAM_HAS_VIDEO_BUTTON.

Phil.


CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline funnel

  • ****
  • 349
Re: shooting_can_focus()
« Reply #3 on: 02 / May / 2012, 16:04:41 »
Thanks for testing. Please feel free to patch it like seems best to you, I just wanted to point out the bug in the code.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: shooting_can_focus()
« Reply #4 on: 28 / May / 2012, 05:23:21 »
Added in revisions 1868 (trunk) and 1869 (release-1.0).

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

 

SimplePortal © 2008-2014, SimplePortal