(Lua) Script to disable lens retract - Script Writing - CHDK Forum  

(Lua) Script to disable lens retract

  • 9 Replies
  • 8560 Views
(Lua) Script to disable lens retract
« on: 12 / December / 2009, 12:53:48 »
Advertisements
Dear All,

I have recently got CHDKcam (i.e. remote capture) working on my a710is, which is wonderful for afocal astrophotography (mainly becuase I no longer need to touch the telescope again, once set up). However, the only outstanding issues (at the moment!) is that when I'm reviewing photos in 'playback' (to choose the sharpest manual focus setting) the lens still retracts after 1 minute. This is frustrating becuase when it reopens it can be slightly out in terms of focus and I need to go through the focusing procedure again.

With this in mind, would anybody know how to write a script that disables the lens retract function, which I could turn on when I go to playback (and turn off, once back in 'record' mode)? RaduP kindly provided me with the following advice but I have to admit, it's past my scritpting skills:

"There is a function called something like: islensout or something. The function references a memory location. Put 0 in that location then the camera will be happy. But remmeber to put 1 back when you want to take the shot."

Finally, it would need to be written in Lua code, as the CHDKcam interface version I have got working doesn't appear to use uBasic.

Thanks in advance for any help or advice,

Nick
a710is

*

Offline whoever

  • ****
  • 280
  • IXUS950
Re: (Lua) Script to disable lens retract
« Reply #1 on: 12 / December / 2009, 14:41:22 »
RaduP kindly provided me with the following advice but I have to admit, it's past my scritpting skills:
"There is a function called something like: islensout or something. The function references a memory location. Put 0 in that location then the camera will be happy. But remmeber to put 1 back when you want to take the shot."
Someone sufficiently (moderately) fluent in ARM assembler language has to look at the disassembly of your camera's FW and find the address that RaduP mentioned. Once the address is known, you can use Lua's Peek/Poke to read/change the number it points to. There are folks around here that keep disasm databases of pretty much every camera, -- perhaps they can help...

Re: (Lua) Script to disable lens retract
« Reply #2 on: 12 / December / 2009, 19:24:58 »
Thanks again whoever, will see what turns up...

Nick
a710is

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: (Lua) Script to disable lens retract
« Reply #3 on: 12 / December / 2009, 20:11:06 »
@leedsgreen:

your script for a710:

poke(0x7C8BC, 0)

Don't forget call poke(0x7C8BC, 1)  before camera power-off, otherwise camera will be powered off with extended lens :).


*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: (Lua) Script to disable lens retract
« Reply #4 on: 13 / December / 2009, 09:49:51 »
Maybe a small disclaimer is in order after ewavr's advice  ;) 

Try not to typo that command and don't try it on any other camera model unless you know for certain it's ok to do that (other cameras extremely likely have different address for this, no reason to try your luck).

Poking incorrect addresses could potentially be harmful. http://chdk.wikia.com/wiki/LUA/LUA_Reference.

*

Offline whoever

  • ****
  • 280
  • IXUS950
Re: (Lua) Script to disable lens retract
« Reply #5 on: 13 / December / 2009, 11:16:30 »
Poking incorrect addresses could potentially be harmful. http://chdk.wikia.com/wiki/LUA/LUA_Reference.
Absolutely. In other words, if it precipitates a nuclear chain reaction or some other calamity, then... Well, you have been warned, baby!

Re: (Lua) Script to disable lens retract
« Reply #6 on: 13 / December / 2009, 11:53:32 »
Hey guys,

Thanks very much for info and advice. Mmmmm, maybe I will make do with 1 min lens retract time. It's a small price to pay for amazing Remote Capture and the last thing I want to do is fry my (beloved) a710is!

Thanks for all your help over the last few days,

Nick
a710is

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: (Lua) Script to disable lens retract
« Reply #7 on: 13 / December / 2009, 12:09:36 »
You'll need very bad luck to fry your cam doing this...even if it were something other than an a710. The reason I'm warning loudly is that a lot of people with limited knowledge of these cameras, CHDK and the English language are following this forum and may not understand that something meant for a710 100a really should not be tried on anything other than the a710 100a.

What ewavr's poke does is pretty much exactly what CHDK would do for a710 100a in its C code if there were a Lua function such as "disable_lens_retract()".

If you end up using this poke in a script, it would probably be a good idea to have the script check for camera model & fw version before poking (in case you end up distributing your script to others or to other cameras you might purchase)... something like this should work:

bi=get_buildinfo()
if (bi.platform=="a710") and (bi.platsub="100a") then
  poke(0x7C8BC, 0)
end

and to restore:

bi=get_buildinfo()
if (bi.platform=="a710") and (bi.platsub="100a") then
  poke(0x7C8BC, 1)
end


Re: (Lua) Script to disable lens retract
« Reply #8 on: 13 / December / 2009, 12:41:05 »
Wow!

Thanks fudgey, have got that working. Absolutely great. A neat trick. (I haven't properly messed with computers since my old ZX Spectrum days and the code 'poke' certainly brings back memories)!

Cheers,

Nick

a710is

Re: (Lua) Script to disable lens retract
« Reply #9 on: 11 / January / 2013, 18:51:06 »
@leedsgreen:

your script for a710:

poke(0x7C8BC, 0)

Don't forget call poke(0x7C8BC, 1)  before camera power-off, otherwise camera will be powered off with extended lens :).

Ewavr, how can I find those memory address for other cams? I did take your example and tried to find the "7C8BC" on the Strings.txt from the a710's dump file. But there is no that address there. :(

My camera is a s95 and I want to make the same poke to retract/expose the lens.

Cheers!
« Last Edit: 11 / January / 2013, 18:55:08 by Playmobil »

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal