I am writing a script that will record videos. It starts with a call to click("video") which starts recording. and the script keeps on recording clips below the 4GB limit. While it is recording it is using the motion detection call.However, I can't work out how to stop it properly. When I press the shoot button to stop the script the script stops as expected but the camera keeps on recording.Is there a way to run some tidy-up script functions after the script is interrupted by the shoot button? This would let me close open files and shut down recording.Dave
:restore clean up stuffend
--[[ @title recordz --]] function restore() if get_movie_status() == 4 then click("video") endendclick("video")restore()
As I remember, the restore() is called automagically when script is interrupted, so there's no need to call it by restore() command. Of course - if not needed:)
--[[ @title restore --]] function restore() print("Restore point 1") click("video") print("Restore point 2")endt_start = get_tick_count()click("video")print("Recording started")repeat sleep(100)until (get_tick_count() - t_start) > 10000print("Script ended itself")restore()
Looks like I am stuck again. I found that when I add some actual code to my simple example above the restore() function don't work.The script below will record a 10s video and then turn itself off by calling restore. This turns off recording and prints Restore point 1 and 2 as expected. However, when I terminate the script by pressing the shoot button I only see Restore point 1 and the recording doesn't stop. I have to come out of ALT mode and then press the video button to stop recording.Any ideas where I am going wrong? I am running 1.2.0-2593 on an A810 version e.Code: [Select]--[[ @title restore --]] function restore() print("Restore point 1") click("video") print("Restore point 2")endt_start = get_tick_count()click("video")print("Recording started")repeat sleep(100)until (get_tick_count() - t_start) > 10000print("Script ended itself")restore()
The current implementation doesn't support this.Calling 'click' suspends the script while the button press and release are done in the the core CHDK code.However this looks like 'restore' has exited to the script engine so it finishes interrupting the script execution (so click never gets a chance to run).Not easy to fix, anything used in 'restore' that causes Lua to yield control back to CHDK will have this effect.
post_levent_to_ui('PressMovieButton')post_levent_to_ui('UnpressMovieButton')
Started by PhyrePhoX « 1 2 » Feature Requests
Started by RaduP General Discussion and Assistance
Started by Microfunguy « 1 2 » General Discussion and Assistance
Started by Microfunguy General Discussion and Assistance
Started by pigeonhill General Help and Assistance on using CHDK stable releases