Script - Generic Underwater Housing - Script Writing - CHDK Forum

Script - Generic Underwater Housing

  • 8 Replies
  • 7762 Views
Script - Generic Underwater Housing
« on: 10 / June / 2014, 05:05:57 »
Advertisements
Hi there,

I consider to buy a generic underwater housing from Rollei: http://www.testberichte.de/p/rollei-tests/rolleimarin-uw2-testbericht.html

Pro: Cheap and fits multiple cameras (in my case S95, S100, S110, S120).
Cons: Only two buttons (turning the cam on/off and taking a picture).

My question is: Is it possible to write a script which allows to access different features (like video mode, zoom in/out, ...) just by different combinations of these two buttons?

Example: Holding both buttons simultaneously down: Zoom in. Holding both buttons down (but starting with the on/off button): Zoom out. Pressing the on/off button three times in a row: Toggle to video mode, ...

The idea is to first activate the script before putting the camera into the underwater case.

So what do you think?

Thx a lot, Merlin.

Re: Script - Generic Underwater Housing
« Reply #1 on: 10 / June / 2014, 09:02:54 »
My question is: Is it possible to write a script which allows to access different features (like video mode, zoom in/out, ...) just by different combinations of these two buttons?
Sort of. 

CHDK release 1.3.0 lets you monitor the status of the shutter button and take action in your script based on its status. Prior versions of CHDK don't allow that - the shutter button is only for starting and stopping scripts when CHDK is in <ALT> mode.

There is currently nothing similar for utilizing the power button unfortunately.   AFAIK, the button starts the camera electronically but stops the camera through software (i.e. the Canon firmware monitors the button state and shuts things down gracefully if it's pressed.)   So it should be quite possible to also "trap" the power button with CHDK and allow a script to monitor its state and take action (including camera shutdown if desired).  I think it's a case of nobody having a need for this behind why it has not been implemented yet.

Quote
The idea is to first activate the script before putting the camera into the underwater case.
That would be hard on the battery life and not necessary.  You could still start the camera with the power button once underwater.   If CHDK is installed on the SD card, it can be configured to automatically activate the script at start-up.  You could even initiate a button sequence to power the camera off when you are done.

Still,  trying to do funky button press sequences underwater might be a frustrating experience.  But that's up to you relative to the cost of a better enclosure.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Script - Generic Underwater Housing
« Reply #2 on: 11 / June / 2014, 00:42:46 »
Well the price difference is factor x10.  :o

Let's keep the requirements to a minimum:

Using the power on/off button just for what it's normally intended: Starting the camera using the script.

Shutter button: LogFocus > take picture.

Holding down the shutter button for 1 or 2 seconds -> toggle photo and video mode.

Video mode always automatically uses wide angle while picture mode uses a predefined zoom.

Would that be possible? Is it possible to check for how long a button has been pushed? Is there something like a Timer / SysTime that you can querry?

Thx, Merlin.

Re: Script - Generic Underwater Housing
« Reply #3 on: 11 / June / 2014, 08:45:31 »
That would be very possible and not difficult to code.  I'd suggest using a big font to display the current state ( still vs video ) on the display to make it essy to read underwater. 

When I get a few minute in the next couple of days I'll code & test something for you
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Script - Generic Underwater Housing
« Reply #4 on: 11 / June / 2014, 22:38:08 »
Here you go - tested (not underwater) and everything.  Works exactly like you described too.



The little box a the bottom is hopefully easy to read underwater as it tells you three things :
  • Line 1 says either "ready", "short press" or "*long press*" telling you how long the shutter button has been held down
  • Line 2 says either "photo mode" or "video mode" so you know what will happen the next time you short press
  • Line 3 gives the current shot count in photo mode, or tells you if the camera is currently recording in video mode

There's a bunch of stuff you can set in the script parameter - mostly self explanatory.  You can change the colors of the text box there too - set the background transparent for example if you find the box too obstrusive.  It's up to you to figure out what looks good underwater.

Edit : deleted script - newer version attached to later post in this thread
« Last Edit: 14 / June / 2014, 13:59:51 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Script - Generic Underwater Housing
« Reply #5 on: 12 / June / 2014, 07:42:19 »
A very nice script for cheap underwater housing. Maybe the handling is a little bit slow for underwater actions.

A note: We have different screens (360 and 480 px). I think the following line is better than an absolute value.

Code: [Select]
xpos = get_gui_screen_width()==480 and 140 or 80
msl
CHDK-DE:  CHDK-DE links

Re: Script - Generic Underwater Housing
« Reply #6 on: 12 / June / 2014, 08:33:02 »
Maybe the handling is a little bit slow for underwater actions.
I think that's at least partially a consequence of waiting for the shutter button to be released prior to shooting.  A different algorithm might be to shoot() when the shutter button is pressed and then time how long it is held down for.   This would mean an extra image / video seqment each time you changed modes but SD card space is almost free so that might be a good improvement?

Also, its been a very long time since I've been diving,  but I seem to recall that visibility of more than 5m was not common (even less in northern lakes).  Perhaps a fixed focus distance of 2m would be a good idea so that the camera does not spend a lot of precious time trying to focus as the fish swims away ?

Quote
A note: We have different screens (360 and 480 px). I think the following line is better than an absolute value.
Code: [Select]
xpos = get_gui_screen_width()==480 and 140 or 80
Thanks (again) for that.  I remembered that you had posted it before but could not find it quickly.  For a sample script that may never be used, I was only willing to invest so much time looking for it.

Edit :  another speed-up option might be to a "shoot_half" when the shutter button is pressed and "shoot_full" when it is release.
« Last Edit: 12 / June / 2014, 11:27:55 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Script - Generic Underwater Housing
« Reply #7 on: 13 / June / 2014, 01:02:49 »
Hey guys,

that's amazing! Can't wait until I can play around with it. :D

Thx!

Re: Script - Generic Underwater Housing
« Reply #8 on: 14 / June / 2014, 13:42:40 »
that's amazing! Can't wait until I can play around with it.
Three changes to try out.
  • Added msl's fix for centering the GUI in different cameras.
  • Added the ability to pick a fixed focus distance to speed up shooting (sorry - did it in feet to make the @param easier to set in integer increments)
  • Added two new shooting modes.

The shooting modes are now :
  • Full - takes a shot after you press and release the shutter (and don't hold the shutter down long enough to trigger a change between video and still mode)
  • Half - does a "half press" when the shutter is pressed (to lock focus / exposure) and then shoots when the shutter is released.  If the shutter is held down long enough, will also cause a mode change (video/still)
  • Instant  - shoots as soon as the shutter is pressed.  If the shutter is held down long enough, will also cause a mode change (video/still)

Try them out and see what you think?  This script is a bit more complicated so "bumps" are possible despite the little bit of testing I have done.
« Last Edit: 14 / June / 2014, 13:59:14 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal