CHDK Forum

Using CHDK => General Help and Assistance on using CHDK stable releases => Hello, I'm a NEWBIE - HELP!! (Newbies assistance, User Guides and thank you notes) => Topic started by: acroitor on 19 / March / 2014, 07:47:17

Title: Turn on button
Post by: acroitor on 19 / March / 2014, 07:47:17
Hi,

I installed CHDK on my SX240 as a bootable SD card. The problem is that I ususally take a lot of pictures on vacations, so I turn on/off the camera very often. I did not find how to set the power button to enter directly in "record mode". The solutions of pressing the power button for 2 seconds or to enter first in play mode and half press the shutter button take too much time, and I often miss the "right shot".

So how can I change so the power button will enter record mode (I can enter directly on play mode with the play button).

Thanks and regards,
Andrei
Title: Re: Turn on button
Post by: waterwingz on 19 / March / 2014, 08:04:18
There is no way to do that with CHDK loaded.

You can use a script to switch to shooting mode automatically on startup :
Code: [Select]
--[[
@title Start
@param   d Delay
@default d 1
@range   d 0 10
--]]
sleep(d*1000)
set_record(1)
but it's no faster than holding the On/Off button down.
Title: Re: Turn on button
Post by: acroitor on 19 / March / 2014, 08:26:40
:(. Thanks for the script info.
I don't understand why is this the functionality. If you boot from the sdcard, why would someone want to always enter in play mode, especially when there always is a button that does that...
Title: Re: Turn on button
Post by: acroitor on 19 / March / 2014, 08:49:52
Is there a reason why the sleep value is 1000? Can't it be 10 for example?
Title: Re: Turn on button
Post by: waterwingz on 19 / March / 2014, 09:24:10
I don't understand why is this the functionality. If you boot from the sdcard, why would someone want to always enter in play mode, especially when there always is a button that does that...
There have been several discussions here on the forum about why this is "better".  Mostly along the lines of the lens not extending in your pocket or camera bag if you accidentally push the On/Off button.  However,  what you are seeing is a limitation of the CHDK hack.  CHDK intercepts the camera boot code very early during camera start-up and inserts its code into the process.  Unfortunately, CHDK can't tell if the camera was started with the playback button or On/Off switch at that point so assumes it was the playback button (apparently for the reason I just listed above - no surprises).   But if you hold the On/Off button down long enough so that it's still down when CHDK checks it,  you get moved into shooting mode.

Is there a reason why the sleep value is 1000? Can't it be 10 for example?
You can try that.  If the script executes too quickly,  you'll probably find the set_record(1) function gets ignored.

Note :  there is also a script start delay available in the CHDK Script menu.  In my brief testing,  it did not seem to do anything for script autostart mode.
Title: Re: Turn on button
Post by: acroitor on 19 / March / 2014, 09:39:57
Thanks for your very detailed answer.

I understand now that this is how CHDK works. Maybe it could also be better for some models of cameras to start like this, but not all (SX240 is almost impossible to turn on by accident - I found it pretty hard to turn on on purpose because the button is designed like this).

I will try the solution with the script until I find the minimum delay value that works.

Thanks again for your support.
Title: Re: Turn on button
Post by: waterwingz on 19 / March / 2014, 10:45:13
Maybe it could also be better for some models of cameras to start like this, but not all (SX240 is almost impossible to turn on by accident - I found it pretty hard to turn on on purpose because the button is designed like this).
It has been a while since anyone looked at this.  If it was possible to fix and make the camera work like it would without CHDK loaded,  I think there would be pretty good support to make the change if we figured out how to do it.
Title: Re: Turn on button
Post by: mr.burns on 19 / March / 2014, 11:36:39
Hi waterwingz,

if it can be done by a script then it should be possible to do it directly using CHDK if source code gets modified accordingly or not?
So there could be an option in the config lets call it START_IN_REC_MODE.
So if CHDK boots up it looks for START_IN_REC_MODE and if it is set to true then the command to switch to rec mode could be executed - or do I miss something?

Title: Re: Turn on button
Post by: waterwingz on 19 / March / 2014, 12:09:16
if it can be done by a script then it should be possible to do it directly using CHDK if source code gets modified accordingly or not? .... - or do I miss something?
you missed my closing comment :
but it's no faster than holding the On/Off button down.

Update : 
So there could be an option in the config lets call it START_IN_REC_MODE.
before someone else points it out,  I might as well mention that CHDK has no access to configuration values this early in the boot process.
Title: Re: Turn on button
Post by: reyalp on 19 / March / 2014, 22:39:24
I understand now that this is how CHDK works. Maybe it could also be better for some models of cameras to start like this, but not all (SX240 is almost impossible to turn on by accident - I found it pretty hard to turn on on purpose because the button is designed like this).
My objection to this isn't accidentally pushing the power button, that could happen equally with the Canon firmware. The problem IMO is changing the camera behavior in a way that might lead someone to damage their camera.

If you make the default record mode, this will apply to both the normal power button and the play button, because it's too late for CHDK to tell which was used to start. Since a user won't expect the lens to extend when they press the play button, they might do it with the lens blocked.

You are welcome to invert the logic in your own personal build of course. However, in my experience getting in the habit of holding the power button until the lens starts to open is really not that big a deal.