Switch to macro mode, then zoom to 10 mm - sx160is - Script Writing - CHDK Forum supplierdeeply

Switch to macro mode, then zoom to 10 mm - sx160is

  • 9 Replies
  • 4212 Views
Switch to macro mode, then zoom to 10 mm - sx160is
« on: 01 / August / 2017, 23:47:23 »
Advertisements
I am looking for a simple script to set the sx160is to macro mode, then set the zoom to about 10 mm.
I always use that setting when shooting macros and it just takes a while to set the zoom manually. I am hoping to speed things up a bit with a simple lua script.



« Last Edit: 02 / August / 2017, 00:04:56 by sequencer »

Re: Switch to macro mode, then zoom to 10 mm - sx160is
« Reply #1 on: 02 / August / 2017, 20:19:58 »

Well, set_zoom(33) works and sets the zoom to about 62 mm.
But set_prop(6, 1) doesn't seem to switch the camera to macro mode.
Any ideas?


set_prop(6, 1)
sleep(100)
set_zoom(33) 
sleep(100)
exit_alt()




Re: Switch to macro mode, then zoom to 10 mm - sx160is
« Reply #2 on: 02 / August / 2017, 21:46:32 »
Many propcase values are "read only".  You might want to try simulating the actual camera button presses necessary to enable macro mode using the click( ) function?
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Switch to macro mode, then zoom to 10 mm - sx160is
« Reply #3 on: 02 / August / 2017, 22:04:36 »

Yes, I'm aware of the Click() function. I was hoping to do it with set_prop() but it doesn't seem to work with the sx160is.
Thanks waterwingz!





*

Offline nafraf

  • *****
  • 1308
Re: Switch to macro mode, then zoom to 10 mm - sx160is
« Reply #4 on: 02 / August / 2017, 22:47:37 »
You can try UI properties (PTM Functions)

I can't test on sx160, but probably the properties are similar to a810.
On a810, to set MACRO you need to set the property 0x8022 to value 1
Try to read before writing the value to the property.

Re: Switch to macro mode, then zoom to 10 mm - sx160is
« Reply #5 on: 03 / August / 2017, 01:11:02 »



Thanks, nafraf  :)


Here is what I've done:


--[[
Set macro mode and zoom to 63 mm, sx160is.
--]]
call_event_proc("UI.CreatePublic")
call_event_proc("PTM_SetCurrentItem",0x8022,1) -- macro mode?
sleep(100)
set_zoom(33)  --  set zoom to 62mm
sleep(100)
press("shoot_half")
set_aflock(1)
set_aelock(1)
exit_alt()


[size=78%]I don't see the flower macro icon on the screen but the camera can focus like on macro mode. I'm not sure if that's how it is done for the sx160is.[/size]
[/size]




Re: Switch to macro mode, then zoom to 10 mm - sx160is
« Reply #6 on: 03 / August / 2017, 01:21:23 »
It's not unusual for camera settings modified by CHDK not to change up the Canon UI.  It's like CHDK is hooked in at lower level in the code where it's expected to issue  separate calls to change the UI.

Props to nafraf for pointing out how to enable macro mode!
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Switch to macro mode, then zoom to 10 mm - sx160is
« Reply #7 on: 03 / August / 2017, 12:21:13 »

Well, I'm not too sure now.
The camera can still focus down to 4 inches without setting it to macro (manually ) and also running the same script without these two lines of code:


call_event_proc("UI.CreatePublic")
call_event_proc("PTM_SetCurrentItem",0x8022,1)


It is doing what I wanted to do, but now I'm curious about using "PTM_SetCurrentItem" and also set_prop(6, 1) to set the camera to macro mode and other settings.


Thanks guys!





*

Offline srsa_4c

  • ******
  • 4451
Re: Switch to macro mode, then zoom to 10 mm - sx160is
« Reply #8 on: 03 / August / 2017, 12:31:54 »
I don't see the flower macro icon on the screen
The camera can still focus down to 4 inches without setting it to macro (manually ) and also running the same script without these two lines of code
It's very likely that the correct ID for your camera is not 0x8022. Finding out the right one is relatively easy - the topic nafraf linked should tell you, how.

Re: Switch to macro mode, then zoom to 10 mm - sx160is
« Reply #9 on: 03 / August / 2017, 14:38:34 »

Thanks  for the tips srsa_4c!


Macro for sx160is is:


call_event_proc("PTM_SetCurrentItem",0x8022,2)


The flower icon shows on the screen now.
I didn't look it up. I only guessed it after trying :)


nafraf thanks for finding this out!






 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal