shooting.c : To be candid, I don't know the best way to fix this. I've attached the relevant code with comments added.
I think the goal is to check whether camera is in a mode where the underlying function
_MoveFocusLensToDistance() will actually move the lens. However, a simpler goal might be to only allow that call when the camera will not crash as a result, regardless of whether the lens moves or not.
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?
The current #defines involved are :
CAM_CAN_SD_OVERRIDE // Camera allows subject distance override
CAM_CAN_SD_OVER_IN_AF_LOCK // Camera allows subject distance override when in AF Lock mode
CAM_CAN_SD_OVER_IN_AF_LOCK_ONLY // Camera allows subject distance override only when in AF Lock mode OR in movie mode
CAM_HAS_MANUAL_FOCUS // Camera allows manual focus in Canon menus
CAM_CAN_SD_OVER_NOT_IN_MF // Camera allows subject distance override when not in manual focus mode
I'm starting with the assumption that these need to be scrapped and new #defines created. What those need to be and then how to add to 1.3.0 is the question?
So, the following questions come to mind :
- Should shooting_can_focus() return true only if the camera can actually move the lens?
- Should shooting_can_focus() return true if calling _MoveFocusLensToDistance() will not crash the camera, regardless of whether it focuses or not?
- What is needed for video modes?
- Does the code need to check for CONTINUOUS_FOCUS or SERVO_AF enabled?
I believe that this all hangs on the following conditions :
- Camera can call _MoveFocusLensToDistance() without AFL or MF enabled
- Camera needs AFL enabled before calling _MoveFocusLensToDistance()
- Camera needs MF enabled before calling _MoveFocusLensToDistance()
where AFL is PROPCASE_AF_LOCK==1 and MF is PROPCASE_FOCUS_MODE==1
This seems simple enough, but only if you assume that reported crashes during testing when AFL or MF are enabled ( e.g. A3400 or sx50hs) are due to setting AFL or MF and not from calling
_MoveFocusLensToDistance().
I find myself going in circles here so I'm going to stop and hope someone else has a more clear vision about what to do with this.