Allowing scripts to trap full & half press shutter button activations - page 2 - General Discussion and Assistance - CHDK Forum supplierdeeply

Allowing scripts to trap full & half press shutter button activations

  • 57 Replies
  • 9229 Views
*

Offline msl

  • *****
  • 1263
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Allowing scripts to trap full & half press shutter button activations
« Reply #10 on: 24 / August / 2013, 17:18:05 »
Advertisements
I'm wary of having scripts that don't allow you to terminate them via the keyboard, at least without some notification to the user.

I definitely understand the use case, but the potential for frustration of users who download the script is high. Especially if they enable autostart, which seems to happen occasionally.

Thanks for these important notes!

'shoot_full' as a script feature that is a very good but also dangerous plan. I think, a menu option for this feature is not the best way. It would be better to use only a script function to activate the shutter as a 'script button'. Also the problem autostart should be clarified.

msl
CHDK-DE:  CHDK-DE links

Re: Allowing scripts to trap full & half press shutter button activations
« Reply #11 on: 24 / August / 2013, 18:02:43 »
'shoot_full' as a script feature that is a very good but also dangerous plan.
Can you share why you think its dangerous?  If it's just because the user could no longer stop his script with the shutter key, then my idea of having a "long press"  of more than 1 second to stop the script should be enough to mitigate that risk?  And there is always the On/Off button as a backup.

Quote
I think, a menu option for this feature is not the best way. It would be better to use only a script function to activate the shutter as a 'script button'.
Again,  why ?  I suppose because the menu option would only be useful with a script that is going to map the shutter button - so you might as well just have the script set that mode?

Quote
Also the problem autostart should be clarified.
I think he means that if you autostart a script and the shutter button cannot stop it then you can never get back to regular <ALT> mode.  But the "long press" option I suggested above solves that.

Update :  being able to trap the shutter key in a script would also be a big help with those "stolen camera" scripts that autostart.
« Last Edit: 24 / August / 2013, 18:22:49 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: Allowing scripts to trap full & half press shutter button activations
« Reply #12 on: 24 / August / 2013, 18:36:55 »
Can you share why you think its dangerous?  If it's just because the user could no longer stop his script with the shutter key, then my idea of having a "long press"  of more than 1 second to stop the script should be enough to mitigate that risk?  And there is always the On/Off button as a backup.
You might want to use a long shutter press in the script. For example, the script could do its own, custom exposure bracketing in continuous mode as long as the shutter is pressed, like the CHDK feature.
Quote
Quote
I think, a menu option for this feature is not the best way. It would be better to use only a script function to activate the shutter as a 'script button'.
Again,  why ?  I suppose because the menu option would only be useful with a script that is going to map the shutter button - so you might as well just have the script set that mode?
Yes, and it throws the burden on the script writer to provide a safety exit. If you do want a safety exit, though, rather than a long shutter press, how about pressing and holding the <alt> key, and then pressing the shutter? CHDK currently doesn't pass through the <alt> key. I could live with that, despite my previous comment.

So <alt>+shutter exits all scripts would work for me.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Allowing scripts to trap full & half press shutter button activations
« Reply #13 on: 24 / August / 2013, 18:49:33 »
So here's a much simpler solution.  This patch simply requires a full one second press on the shutter button to abort a running script.  Shorter presses are passed through.   There are no menu changes and no special script function calls to enable it.

But please,  before everyone dog-piles on this one too,  I'd ask you to at least download and try it.   I've run several of my scripts with it and I believe that one second to abort is quite a satisfactory solution.  Shorter presses to actually take a picture under script control feel natural too.

Self Edit :  the problem with the "long press" to abort solution is that is does not allow you to script "continuous shooting" situations where the user holds the shutter button down and the script keeps shooting until it's released ..  drat.
« Last Edit: 24 / August / 2013, 19:01:45 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline lapser

  • *****
  • 1093
Re: Allowing scripts to trap full & half press shutter button activations
« Reply #14 on: 24 / August / 2013, 19:20:26 »
Self Edit :  the problem with the "long press" to abort solution is that is does not allow you to script "continuous shooting" situations where the user holds the shutter button down and the script keeps shooting until it's released ..  drat.
How about the <alt>+<shutter> idea? The script can't see <alt> anyway, so it would never use that combo.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Allowing scripts to trap full & half press shutter button activations
« Reply #15 on: 24 / August / 2013, 19:33:57 »
Self Edit :  the problem with the "long press" to abort solution is that is does not allow you to script "continuous shooting" situations where the user holds the shutter button down and the script keeps shooting until it's released ..  drat.
How about the <alt>+<shutter> idea? The script can't see <alt> anyway, so it would never use that combo.
I think the concern is that the average user will not know the "special combination of magic keys" necessary to abort a script.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 12217
Re: Allowing scripts to trap full & half press shutter button activations
« Reply #16 on: 24 / August / 2013, 19:38:52 »
Self Edit :  the problem with the "long press" to abort solution is that is does not allow you to script "continuous shooting" situations where the user holds the shutter button down and the script keeps shooting until it's released ..  drat.
Also, there are times when you'd like to interrupt the script RIGHT NOW, so a long press is undesirable.

One idle thought:
The script can call set_abort_key("keyname")
whatever the key is will never be seen by script. All non-abort keys will be passed to script, so if you set it to something other than shutter, you get shutter. If we add the ability to detect what keys are valid for the camera, we can enforce that too. The abort key could even be displayed in the ui, if you wanted. This would mean scripts would always have to sacrifice one key.
It could potentially be allowable to set it to the alt key, so the first alt press ends the script, and subsequent would allow you to leave alt.
I'm not sure this is a good idea, just a thought...
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 12217
Re: Allowing scripts to trap full & half press shutter button activations
« Reply #17 on: 24 / August / 2013, 19:42:02 »
How about the <alt>+<shutter> idea? The script can't see <alt> anyway, so it would never use that combo.
Holding alt causes additional complications, because holding alt for more than a certain time is defined to pass it on to the canon firmware. This current works whether or not you are currently in alt mode.

Incidentally, the reminds me of another issue: on the cameras where the print button is assignable, some functions distinguish between long and short presses, and it is impossible to generate a long press through CHDK.
Don't forget what the H stands for.


Re: Allowing scripts to trap full & half press shutter button activations
« Reply #18 on: 24 / August / 2013, 19:50:20 »
Also, there are times when you'd like to interrupt the script RIGHT NOW, so a long press is undesirable.
Probably better off pressing the power button then?  The long press is not really that long - try the patch and see if you don't agree.  Its more a "press & hold" rather than a "click".

Quote
One idle thought:
The script can call set_abort_key("keyname")
whatever the key is will never be seen by script. All non-abort keys will be passed to script, so if you set it to something other than shutter, you get shutter. If we add the ability to detect what keys are valid for the camera, we can enforce that too. The abort key could even be displayed in the ui, if you wanted. This would mean scripts would always have to sacrifice one key.
It could potentially be allowable to set it to the alt key, so the first alt press ends the script, and subsequent would allow you to leave alt.
I'm not sure this is a good idea, just a thought...
This is proving to be way too hard.  If we provide a mechanism for an advanced script to capture the shutter button at full press,  it seems reasonable that such a script would also provide a mechanism to exit the script.  You're always pushing back against adding functionality to the C core that can be done in the script. This feels the same.  After all,  there is always the power button.  The extremely special case of autostart can be handled by deleting the script from the SD card if that ever happens.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 12217
Re: Allowing scripts to trap full & half press shutter button activations
« Reply #19 on: 24 / August / 2013, 20:14:36 »
This is proving to be way too hard.
I'm not saying we shouldn't use your solution in the end, but IMO this presents some usability issues that should be thought through.
Quote
If we provide a mechanism for an advanced script to capture the shutter button at full press,  it seems reasonable that such a script would also provide a mechanism to exit the script.  You're always pushing back against adding functionality to the C core that can be done in the script. This feels the same.  After all,  there is always the power button.  The extremely special case of autostart can be handled by deleting the script from the SD card if that ever happens.
I probably wouldn't worry about this autostart case, except that a number of people have showed up on the forum with a script stuck on autostart. The script providing a way to exit is ok in theory, but it seems quite likely some published scripts would pick a button that doesn't exist on every camera.

Again, I'm not rejecting your idea. I just think it's worth exploring the options and issues.
Don't forget what the H stands for.

 

Related Topics