Set params command - General Discussion and Assistance - CHDK Forum

Set params command

  • 9 Replies
  • 4348 Views
*

Offline RaduP

  • *****
  • 926
Set params command
« on: 19 / May / 2017, 17:57:58 »
Advertisements
Hi guys
I am trying to make a time lapse camera using my old SX 210. I wrote a script to take pictures every 10 minutes, using the standard power saving tricks (screen off, turn to play mode between shots, etc). I will hack it soon to add an external battery.

Anyway, the camera will retract the lens after 1 minute in play mode, so my script has to constantly switch it to record then back to play mode. This wastes energy and actuates the shutter needlessly, and I was wondering if there is any way to change that 60 second value to something else (like 10K would be a good number). I found the param for my camera, it's 112, but so far I can't set it.

I was wondering, is there a technical reason for the lack of a set_parameter_data() function? Would it be hard to implement?

*

Offline RaduP

  • *****
  • 926
Re: Set params command
« Reply #1 on: 19 / May / 2017, 22:47:50 »
Is there any native function that I can call from Lua that can do that?

*

Offline reyalp

  • ******
  • 14125
Re: Set params command
« Reply #2 on: 19 / May / 2017, 23:32:07 »
Is there any native function that I can call from Lua that can do that?
It might be settable by UI properties https://chdk.setepontos.com/index.php?topic=10624.0

You could also call SetParameterData using call_func_ptr with the address from funcs_by_name.csv. Figuring out the correct parameters is up to you, and incorrect use might lead to bricking.

In either case, setting out of range could be bad. If you manage to get an invalid value stored in flash, it could cause an error every time the camera boots.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: Set params command
« Reply #3 on: 20 / May / 2017, 08:55:13 »
Anyway, the camera will retract the lens after 1 minute in play mode, so my script has to constantly switch it to record then back to play mode. This wastes energy and actuates the shutter needlessly, and I was wondering if there is any way to change that 60 second value to something else
See https://chdk.setepontos.com/index.php?topic=9287.0
The sx210 fw has IsLensOutside.

*

Offline RaduP

  • *****
  • 926
Re: Set params command
« Reply #4 on: 20 / May / 2017, 12:16:45 »
Thanks both, I will look into it :)

*

Offline RaduP

  • *****
  • 926
Re: Set params command
« Reply #5 on: 20 / May / 2017, 14:51:24 »
Well, I tried this:
call_func_ptr(4288272664,112,"\0\0\0\0",4)
That's 0xff99d918,SetParameterData

The prototype is: _SetParameterData(id|PARAMETER_DATA_FLAG, buf, bufsize);

So this should have set the parameter to 0. But instead it stops the camera and the param is not changed :/

Any ideas?

EDIT: I forgot the |PARAMETER_DATA_FLAG part. 112|0x400 is 16496
So now I have: call_func_ptr(4288272664,16496,"\0\0\0\0",4)
Still the same result :/
« Last Edit: 20 / May / 2017, 14:57:52 by RaduP »

*

Offline RaduP

  • *****
  • 926
Re: Set params command
« Reply #6 on: 20 / May / 2017, 16:29:57 »
One more thing, the pointer of SetParameterData also points to 0xff99d918,PTM_BackupUIProperty_FW
Is this normal?

*

Offline reyalp

  • ******
  • 14125
Re: Set params command
« Reply #7 on: 20 / May / 2017, 16:36:32 »
One more thing, the pointer of SetParameterData also points to 0xff99d918,PTM_BackupUIProperty_FW
Is this normal?
Look at other cameras and/or the disassembly.
Don't forget what the H stands for.

*

Offline RaduP

  • *****
  • 926
Re: Set params command
« Reply #8 on: 20 / May / 2017, 16:37:58 »
I already did that, same thing on another camera. Wasn't sure if it's a bug though.

*

Offline RaduP

  • *****
  • 926
Re: Set params command
« Reply #9 on: 20 / May / 2017, 19:56:17 »
Well anyway, I found the magic location (the IsLensOut variable) for my camera.
It's at IsLensOutAddr=0x31b8 for the SX210, in case someone googles it.
It works just fine for my purpose, now the lens stays out without having to switch to/from record mode.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal