Script for video users but I need help - Script Writing - CHDK Forum

Script for video users but I need help

  • 1 Replies
  • 3536 Views
Script for video users but I need help
« on: 26 / April / 2011, 01:26:51 »
Advertisements
Hi there.

I own a Powershot A1100IS which is a massive battery hog and you can't turn off the LCD screen in Video mode. To counter this, I am trying to make a script which will not just turn off the LCD backlight, but will function as if it were in normal video mode (not alt mode). i.e. User just goes to alt mode and loads the script. Thereafter, everything else is as per normal except that the display button will toggle the LCD backlight and the LCD backlight will automatically turn off if a video recording has been started.

To that end I have a few questions. Important make-or-break questions prefixed with "!".

1) How do I detect if a video is already shooting? As in not started by my script (L16) Fixed with get_movie_status
!2) The camera appears to crash when using gosub. Had to move it to actual lines (L18-21,L24-31,L39-42)
3) The while loop only iterates a certain number of times before the script "finishes". I originally used a goto statement and thought maybe CHDK had some cool new anti infinite-loop mechanism (L25-34) Fixed in line 33 with an endif
!4) Hitting the display button does nothing (L38-43)
!5) Hitting the shutter button (physically shoot_full) neither stops the camera nor stops the script! Even the Alt button will not work Fixed wiht a ":restore" marker because this is what I wanted to do in the first place. Had no idea this was there.
6) I've determined that set_led does not work on my build+camera but if anyone has any clues on fixing this I would appreciate your helping me to help...

Would appreciate any help or general pointers.

Code: [Select]
@title NOLCDVIDEO

rem todo: set_led for recording, battery low, card almost full and maybe a sound alert. Detect if already shooting.
rem Original values: A = focus mode

rem Init
b=get_mode
if b=1 then goto "dorecmodeerror"
if b=0 then goto "dosceneerror"

rem get_prop 12 A
rem if A=0 then set_prop 12 1

rem Main
print "Starting..."

if get_movie_status=4 then
  rem set the led
  print "Recording already started..."
  print "Turning off LCD in 1 sec"
  sleep 1000
  set_backlight(0)
else
  press "shoot_half"
  sleep 1000
  click "shoot_full"
  rem set the led
  print "Started recording..."
  print "Turning off LCD in 1 sec"
  sleep 1000
  set_backlight(0)
endif

c=0

:loop
  wait_click 1000
  if is_key "display" then
    print "toggle display"
    if c=0 then set_backlight(1)
    else set_backlight(0)
    endif
  endif 
  if is_key "no_key" then
    print "todo: check battery and"
    print "sd card state and alert"
    print "if necessary."
  endif
goto "loop"

rem Func
:dosceneerror
  print "Not in Video mode, exiting."
  sleep 1000
end

:dorecmodeerror
  print "Not in REC mode, exiting."
  sleep 1000
end

:restore
  set_backlight(1)
  print "Stopping recording"
  rem unset the led
  click "shoot_full"
  rem set_prop 12 A
« Last Edit: 26 / April / 2011, 02:41:01 by fusionstream »

Re: Script for video users but I need help
« Reply #1 on: 26 / April / 2011, 03:04:43 »
Mods

Please delete. Will be releasing "completed" code shortly in scripts subforum.

Cheers.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal