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

Setting focus from scripts or menus

  • 601 Replies
  • 192874 Views
*

Offline Mlapse

  • *****
  • 583
  • S95 S110
Re: Setting focus from scripts or menus
« Reply #580 on: 06 / February / 2022, 17:09:14 »
Advertisements

You may need to call System.Create first - call_event_proc('System.Create')


i placed it between the variables at the beginning of the script.
and it generated the system clock for a few seconds after starting the script.
never seen that happen before :o
but the return value of 

call_event_proc('GetFocusLensCurrentPosition') is still -1.

is something wrong with my cam or should the call_event_proc('System.Create') be made everytime i do this call?

Quote
I don't think there is any way to control the wheels or simulate wheel rotations from scripts.

yes, thought so, only a few models have wheels.
« Last Edit: 06 / February / 2022, 17:17:52 by Mlapse »
frustration is a key ingredient in progress

*

Offline reyalp

  • ******
  • 14082
Re: Setting focus from scripts or menus
« Reply #581 on: 06 / February / 2022, 18:43:11 »
I don't think there is any way to control the wheels or simulate wheel rotations from scripts.
I would expect it should be triggerable with levents like we do for the jogdial. On G7 X, the front ring can be controlled using
Code: [Select]
=post_levent_to_ui(0x1132) post_levent_to_ui('RotateRingFuncLeft',1)
=post_levent_to_ui(0x1132) post_levent_to_ui('RotateRingFuncRight',1)
The meaning of the 0x1132 event is unclear, it doesn't seem to do anything on its own, but was sometimes required when using the ring func to control aperture or shutter. The parameter for the RotateRingFunc* is the number of clicks.  For zoom, 0 goes to the limits post_levent_to_ui('RotateRingFuncRight',0) goes to full wide, and left goes to full tele. Aperture seemed to go to full wide with left or right  :-[

I found the 0x1132 event using the usual chdkptp camera log approach
Code: [Select]
!require'extras/devutil'.init_cli()
dlstart
# manipulate dial
dlgetcam
dbg.log
Code: [Select]
00137050: UI:Button:0x00001132:
00137050: UI:Button:0x000008AB:RotateRingFuncRight

Not sure what event would control the G1 X front dial, there are a few with suggestive names, but probably easiest to just look at the camera log.

is something wrong with my cam or should the call_event_proc('System.Create') be made everytime i do this call?
You only need to call System.Create once (per camera boot). I very much doubt this is a problem with your camera, more likely a typo somewhere. You should check the return value of System.Create too.
Don't forget what the H stands for.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Setting focus from scripts or menus
« Reply #582 on: 06 / February / 2022, 22:12:48 »
call_event_proc('GetFocusLensCurrentPosition') is still -1.


I tried this on my G1X and you need to add call_event_proc('Mecha.Create') instead of call_event_proc('System.Create').
This only needs to be done once at the start of the script.

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 c_joerg

  • *****
  • 1248
Re: Setting focus from scripts or menus
« Reply #583 on: 07 / February / 2022, 04:26:36 »
i am testing set focus on the G1X in Av mode, but it doesn't seem to work as I expected.

Do you know that Landscape Focus Bracketing Script from pigeonhill for G1x?
Maybe that will help

https://chdk.setepontos.com/index.php?topic=13638.0
https://chdk.fandom.com/wiki/Landscape_Focus_Bracketing_:_perfect_near_to_far_focus_brackets


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


*

Offline Caefix

  • *****
  • 945
  • Sorry, busy deleting test shots...
Re: Setting focus from scripts or menus
« Reply #584 on: 07 / February / 2022, 10:18:56 »
Quote
and, second question, is there a key for the rear dial on the G1X, something i could use to test setting the focus 'manually', like click"wheel_left" (or right :) that would probably be very helpfull in creating some more tests.
;) ... Needs to replace lua.flt ...
Code: [Select]
--[[--
@title jogdial.Lua
@chdk_version 1.4
@param J Use Jogdial
@default J 1
@range J 0 1
--]]--

repeat
print(-is_wheel_left(),is_wheel_right())
sleep( 111)
print("", is_wheel_right(),-is_wheel_left())
sleep( 222)
until is_key "set"

c=0; j=0
repeat
if J==1 then
   j=get_wheel(); c=c+j;
   if j==-1 then print( j, "wheel_left",c) end
   if j==1  then print( j, "wheel_right",c) end
   sleep(111) end
until 1>2
i am testing set focus on the G1X in Av mode, but it doesn't seem to work as I expected.
In modes, that use jogdial for own settings, these options are limited.

... ;) ... This menu setting does not affect the behavior of scripts ... :-[
Quote
   This applies to both the "set_focus()" command in CHDK scripts, 
or the "Override Subject Distance" menu item in the CHDK's Enhanced Photo Operations menu.
Quote
further test with the CHDK setting "Override Subject Distance" revealed that it would also not set correctly or hold the focus between shots.

another log:
first run MF without CHDK override(focus as saved in canon menu and used in earlyer log), next 2: MF with CHDK override active.(set at 49500) (focus @ infinity in script = false)
« Last Edit: 07 / February / 2022, 12:46:40 by Caefix »
All lifetime is a loan from eternity.

*

Offline Caefix

  • *****
  • 945
  • Sorry, busy deleting test shots...
Re: Setting focus from scripts or menus
« Reply #585 on: 07 / February / 2022, 15:19:32 »
Quote
The following error or errors occurred while posting this message:
The message exceeds the maximum allowed length (7500 characters).
... :o   ::)
Code: [Select]
if %~x1?==? (cmd /T:4E/Kdir/b/ad/s/on %1) else (cmd /T:1F/K type %0 %*|find "Lens">G1X100g_LensSoup.txt)
0xff3710ec,CancelFocusLensMaxSpeedLimit_FW
0xff3720ac,ChangeZoomLensMagnificationToPoint_FW
0xff3720a4,ChangeZoomLensPointToMagnification_FW
0xff371148,DisableFocusLens_FW
0xff3711c0,DisableFocusLensGainLock_FW
0xff3711ec,DisableFocusLensWaveLock_FW
0xff37189c,DisableLensError_FW
0xff372080,DisableZoomLensElectricControl_FW
0xff371d44,DisableZoomLensEncoderPowerControl_FW
0xff372058,DisableZoomLensSpeedControl_FW
0xff3710fc,EnableFocusLens_FW
0xff371194,EnableFocusLensGainLockWithVoltage_FW
0xff3711d0,EnableFocusLensWaveLock_FW
0xff37188c,EnableLensError_FW
0xff37206c,EnableZoomLensElectricControl_FW
0xff371d34,EnableZoomLensEncoderPowerControl_FW
0xff372044,EnableZoomLensSpeedControl_FW
0xff370710,EscapeFocusLens_FW
0xff1be168,GetCurrentFocusLensPosition_FW
0xff403144,GetCurrentZoomLensDirection_FW
0xff1c3cdc,GetCurrentZoomLensPoint_FW
0xff1c3c2c,GetCurrentZoomLensPosition_FW
0xff35a8ec,GetFocusLensCurrentPosition_FW
0xff35a918,GetFocusLensDriveVoltage_FW
0xff35a9f0,GetFocusLensHoldVoltage_FW
0xff3712b0,GetFocusLensLoadCamTable_FW
0xff371234,GetFocusLensLoadSubjectDistance_FW
0xff371394,GetFocusLensMoveMaxPosition_FW
0xff3713ac,GetFocusLensMoveMinPosition_FW
0xff3713c8,GetFocusLensMoveRangeOfTelePoint_FW
0xff37122c,GetFocusLensPositionRatio_FW
0xff1bdde0,GetFocusLensPullInMaxSpeed_FW
0xff35a0c8,GetFocusLensResetDefaultPosition_FW
0xff35a0b8,GetFocusLensResetPosition_FW
0xff426618,GetFocusLensResetVoltage_FW
0xff35a9a4,GetFocusLensSettingWaitVoltage_FW
0xff1be100,GetFocusLensSubjectDistance
0xff371208,GetFocusLensSubjectDistance_FW
0xff1be550,GetFocusLensSubjectDistanceFromLens
0xff371224,GetFocusLensSubjectDistanceNumber_FW
0xff077d04,GetISLensCorrectedEViAaxis_FW
0xff077d20,GetISLensCorrectedEViBaxis_FW
0xff077c3c,GetISLensDampAaxis_FW
0xff077c48,GetISLensDampBaxis_FW
0xff077c6c,GetISLensEViAaxis_FW
0xff077ce8,GetISLensEViBaxis_FW
0xff076df0,GetISShiftLensPitchPosition_FW
0xff076dfc,GetISShiftLensYawPosition_FW
0xff1c0810,GetLensErrorStatus_FW
0xff1c3cdc,GetZoomLensCurrentPoint
0xff1c3cdc,GetZoomLensCurrentPoint_FW
0xff3612b8,GetZoomLensCurrentPosition
0xff1c3c2c,GetZoomLensCurrentPosition_FW
0xff372024,GetZoomLensDriveAmpereDac_FW
0xff1c4910,GetZoomLensMechaEdgePosition_FW
0xff402f68,GetZoomLensResetPlus_FW
0xff1c413c,GetZoomLensTelePoint_FW
0xff40c55c,HitISLensAgainstBottomEdge_FW
0xff40c548,HitISLensAgainstLeftEdge_FW
0xff40c534,HitISLensAgainstRightEdge_FW
0xff40c570,HitISLensAgainstTopEdge_FW
0xff1be5fc,IsFocusLensOutSidePosition_FW
0xff073fc4,IsLensOutside_FW
0xff1c4514,IsZoomLensOutSidePosition_FW
0xff403ef8,j_GetCurrentFocusLensPosition_FW
0xff403140,j_GetCurrentZoomLensPoint_FW
0xff40313c,j_GetCurrentZoomLensPosition_FW
0xff3711fc,j_GetFocusLensCurrentPosition_FW
0xff3712dc,j_GetFocusLensDriveVoltage_FW
0xff371354,j_GetFocusLensHoldVoltage_FW
0xff3713c4,j_GetFocusLensPullInMaxSpeed_FW
0xff371204,j_GetFocusLensResetDefaultPosition_FW
0xff371200,j_GetFocusLensResetPosition_FW
0xff371390,j_GetFocusLensResetVoltage_FW
0xff371318,j_GetFocusLensSettingWaitVoltage_FW
0xff40c940,j_GetISLensCorrectedEViAaxis_FW
0xff40c944,j_GetISLensCorrectedEViBaxis_FW
0xff40c948,j_GetISLensDampAaxis_FW
0xff40c94c,j_GetISLensDampBaxis_FW
0xff40c938,j_GetISLensEViAaxis_FW
0xff40c93c,j_GetISLensEViBaxis_FW
0xff40c930,j_GetISShiftLensPitchPosition_FW
0xff40c934,j_GetISShiftLensYawPosition_FW
0xff371884,j_GetLensErrorStatus_FW
0xff372094,j_GetZoomLensCurrentPoint_FW
0xff372098,j_GetZoomLensCurrentPosition_FW
0xff3720a0,j_GetZoomLensMechaEdgePosition_FW
0xff37209c,j_GetZoomLensTelePoint_FW
0xff404470,j_IsFocusLensOutSidePosition_FW
0xff371880,j_IsLensOutside_FW
0xff403538,j_IsZoomLensOutSidePosition_FW
0xff40c92c,j_MoveISLensToCentralPosition_FW
0xff403e94,j_ReloadFocusLensAdjustment_FW
0xff40c928,j_SearchISLensCentralPosition_FW
0xff1ccfc4,j_UIFS_CancelStoreLensTimer_FW
0xff404238,MoveFocusLensToDistance
0xff404238,MoveFocusLensToDistance_FW
0xff404124,MoveFocusLensToPosition_FW
0xff40400c,MoveFocusLensToPositionWithMaxSpeed_FW
0xff404050,MoveFocusLensToPositionWithSpeed_FW
0xff370788,MoveFocusLensToTerminate_FW
0xff403f28,MoveFocusLensToTerminatePosition_FW
0xff3707e4,MoveFocusLensWithDistance_FW
0xff3708ec,MoveFocusLensWithPosition_FW
0xff370a04,MoveFocusLensWithPositionImmediateReturn_FW
0xff370ac0,MoveFocusLensWithPositionWithoutBacklash_FW
0xff40c5bc,MoveISLensToBottomLimitPosition_FW
0xff076bc0,MoveISLensToCentralPosition_FW
0xff40c5a8,MoveISLensToLeftLimitPosition_FW
0xff40c594,MoveISLensToRightLimitPosition_FW
0xff40c5d0,MoveISLensToTopLimitPosition_FW
0xff371800,MoveLensToFirstPoint_FW
0xff371848,MoveLensToTerminatePoint_FW
0xff371f74,MoveZoomLensToMechaEdge_FW
0xff403c1c,MoveZoomLensToMechaEnd_FW
0xff40365c,MoveZoomLensToPoint_FW
0xff403620,MoveZoomLensToPosition_FW
0xff403cf8,MoveZoomLensToPositionByManual_FW
0xff371f34,MoveZoomLensToTerminatePosition_FW
0xff371e64,MoveZoomLensWithPoint
0xff371e64,MoveZoomLensWithPoint_FW
0xff371ea8,MoveZoomLensWithPointImmediateReturn_FW
0xff371ef0,MoveZoomLensWithPosition_FW
0xff077f4c,PT_CompleteStoreLens_FW
0xff1be6f8,ReloadFocusLensAdjustment_FW
0xff3706b4,ResetFocusLens
0xff3706b4,ResetFocusLens_FW
0xff371db8,ResetZoomLens
0xff371db8,ResetZoomLens_FW
0xff371de4,ResetZoomLensToFirst_FW
0xff371e24,ResetZoomLensToTermiante_FW
0xff076b58,SearchISLensCentralPosition_FW
0xff370dfc,SetFocusLensAccelerationTable_FW
0xff370f88,SetFocusLensCondition_FW
0xff370f74,SetFocusLensDefaultPullOutTable_FW
0xff3712e0,SetFocusLensDriveVoltage_FW
0xff371358,SetFocusLensHoldVoltage_FW
0xff3710dc,SetFocusLensMaxSpeedLimit_FW
0xff37131c,SetFocusLensSettingWaitVoltage_FW
0xff370f00,SetFocusLensSlowdownTable_FW
0xff370ccc,SetFocusLensSpeed_FW
0xff370d48,SetFocusLensSpeedTable_FW
0xff372d30,SetISFocusLensDistance_FW
0xff40ce10,SetISLensPWMMode_FW
0xff3718ac,SetLensOutsideFlag_FW
0xff404e88,SetScanLensIndex_FW
0xff37202c,SetZoomLensDriveAmpereDac_FW
0xff4037fc,SetZoomLensEncoderPowerControl_FW
0xff372010,SetZoomLensSpeedMode_FW
0xff371078,ShowFocusLensCurrentSpeedTable_FW
0xff07402c,task_LensController
0xff074b28,task_LensController
0xff099ef8,UIFS_CancelStoreLensTimer_FW
0xff371ec4,WaitMoveZoomLensComplete_FW
All lifetime is a loan from eternity.

*

Offline reyalp

  • ******
  • 14082
Re: Setting focus from scripts or menus
« Reply #586 on: 07 / February / 2022, 15:39:18 »
;) ... Needs to replace lua.flt ...
Once again, it would be helpful if you could explain, in simple terms what you changed and how it relates to the thing you are replying to.

It looks like you implemented functions allow script to know if the jogdial was used. This is potentially useful, but my impression was mlapse was asking for how to simulate using the front dial from script, like wheel_left() and wheel_right() already do for the jogdial. This is a totally different thing, though I may have misunderstood mlapse request.

Quote
The following error or errors occurred while posting this message:
The message exceeds the maximum allowed length (7500 characters).
...
If you want to post something like this, you can use an attachment. But what is the point of this? Yes, there are lots of eventprocs with "lens" in the name. Anyone who wants to investigate can look at the CSVs in SVN, that's why they are there. Actually learning anything from them requires testing or reverse engineering.

Don't forget what the H stands for.

*

Offline Caefix

  • *****
  • 945
  • Sorry, busy deleting test shots...
Re: Setting focus from scripts or menus
« Reply #587 on: 07 / February / 2022, 16:14:45 »
;) ... Needs to replace lua.flt ...
Once again, it would be helpful if you could explain, ...

 :( Thanks for optimism.

Just saw, source was readen in German forum >220 times, never reclamated. Seems an other download culture. Here the .flts are included, Copy, Paste, Use ...
All lifetime is a loan from eternity.


*

Offline Mlapse

  • *****
  • 583
  • S95 S110
Re: Setting focus from scripts or menus
« Reply #588 on: 08 / February / 2022, 14:38:45 »
while testing i see i missed a lot :)
i'll catch up in an hour or so.
and yes, i wanted to simulate the jog dial since that is used for setting zoom manually...maybe add it to mfvals so i can easaly use that for some other tests.

i'm not done testing with what i've got so no worry. this has to do with some inconsistant results.
however, i've already captured a few changing results...i'll post one dataset of a short and long G1X run.....often a dawn moment, also with a reboot at 9am.

that made me wonder about a few things...
the get_focus fomulae seems particulary troubled with the G1X.
i haven't seen the code, but is it based on a 3 lens varifocal/zoom formulae that would probably fit all a models cams.
and i haven't guttet any lenses of canon :) but could it be that the g1x (maybe all s / g cams ) have a master group that is not considered in the calculation?
just a thought...
the other is, is GetFocusLensCurrentPosition actually a value that is Canon uses in the bar that is visible if in manual focus?


thanks for the landscape focus script, i'll try some of that tomorrow after finishing what is running now.

for now, my best visible result at this moment is from the S110 that is set in manual mode, set_focus(might change between shots)....shocking isn't it? :)
« Last Edit: 08 / February / 2022, 15:05:26 by Mlapse »
frustration is a key ingredient in progress

*

Offline reyalp

  • ******
  • 14082
Re: Setting focus from scripts or menus
« Reply #589 on: 08 / February / 2022, 15:33:13 »
and yes, i wanted to simulate the jog dial since that is used for setting zoom manually...
The regular jogdial (around the func button) can already be simulated from script, use wheel_left() and wheel_right(). If you need to control the other wheel, that can probably be done, but the specific events need to be identified.

Don't forget what the H stands for.

 

Related Topics