Scripting in CHDKptp - page 2 - Script Writing - CHDK Forum

Scripting in CHDKptp

  • 15 Replies
  • 4831 Views
Re: Scripting in CHDKptp
« Reply #10 on: 04 / May / 2020, 03:38:03 »
Advertisements
1. This sound command always worked for me. The crushing used to happen mid recording.

2. I always start in rec mode, moving to it manually.

3. When I keep only set_aflock(1) before shooting in autofocus mode this works. (If I want the camera to refocus before another recording should I use "set_aflock(0)  sleep(400) set_aflock(1)" or just another "set_aflock(1)"?)

4. So can I simply replace the half_shoot press/release procedure by "set_aflock(1) set_aelock(1)"?

I have so many versions by now that I can't pinpoint when the crushing happend. So I'll keep experimenting with the working version and update in case there are any problems.

Edit:
I've noticed two things - if I use set_focus() outside MF mode the camera crashes.
And somehow in extreme zoom set_focus(50) will result in get_focus()=100.
« Last Edit: 04 / May / 2020, 06:17:22 by nubicon »

*

Offline reyalp

  • ******
  • 14121
Re: Scripting in CHDKptp
« Reply #11 on: 05 / May / 2020, 02:50:48 »
1. This sound command always worked for me. The crushing used to happen mid recording.
I'm confident the romlog you posted was somehow connected to the sound command. PT_PlaySound is in the stack trace.

However, it's possible for crashes to happen without generating a romlog, so it's possible the playsound related crash was from a different one. The romlog does have a datestamp in it, so you can tell if it's from a recent crash. The one you posted was "2020:05:03 13:00:14"
Quote
2. I always start in rec mode, moving to it manually.
You should probably not use set_record(true) if the camera is already in rec. Protect it with an if, like
Code: [Select]
if not get_mode() then
 set_record(true)
end
Quote
3. When I keep only set_aflock(1) before shooting in autofocus mode this works. (If I want the camera to refocus before another recording should I use "set_aflock(0)  sleep(400) set_aflock(1)" or just another "set_aflock(1)"?)
set_aflock behavior may vary between cameras , but I'd suggest set_aflock(0) before calling set_aflock(1) again. I suggested using the Canon keyboard shortcut because I'm not sure set_aflock does an AF scan on every camera. You can check by running it with the camera aimed at something that's not in focus.
Quote
4. So can I simply replace the half_shoot press/release procedure by "set_aflock(1) set_aelock(1)"?
Try it and observe whether the camera does what you want.

Quote
I've noticed two things - if I use set_focus() outside MF mode the camera crashes.
Do you have the camera in movie mode?
Quote
And somehow in extreme zoom set_focus(50) will result in get_focus()=100.
The minimum focus distance is larger at high zoom levels.
Don't forget what the H stands for.

Re: Scripting in CHDKptp
« Reply #12 on: 05 / May / 2020, 05:48:29 »
Thanks for the corrections!
Indeed set_aflock(1) refocuses every time even without set_aflock(0) (I use it now in movie mode and it works smoothly).
The only peculiar thing is that get_focus() returns close but exactly the same readings some time later. I guess it's b/c it's physically measured everytime.

*

Offline reyalp

  • ******
  • 14121
Re: Scripting in CHDKptp
« Reply #13 on: 05 / May / 2020, 14:21:04 »
The only peculiar thing is that get_focus() returns close but exactly the same readings some time later. I guess it's b/c it's physically measured everytime.
Yes, it's normal for get_focus() to not return exactly the same value. Even if you do set_focus with exactly the same value, it can vary.
Don't forget what the H stands for.


Re: Scripting in CHDKptp
« Reply #14 on: 10 / May / 2020, 04:23:43 »

Yes, it's normal for get_focus() to not return exactly the same value. Even if you do set_focus with exactly the same value, it can vary.

I've checked again what you wrote about the crash log and indeed skipping the sound command (which usually causes no problems) solved the problem.

Could it be that using 'play_sound(1) click "video" ' will crash the camera b/c of two consecutive sound commands (with the standard recording sound)?

BTW can I use CHDK to print message on a photo or a video like a date is printed? That would be cool!
« Last Edit: 10 / May / 2020, 08:09:32 by nubicon »

*

Offline reyalp

  • ******
  • 14121
Re: Scripting in CHDKptp
« Reply #15 on: 10 / May / 2020, 15:54:09 »
Could it be that using 'play_sound(1) click "video" ' will crash the camera b/c of two consecutive sound commands (with the standard recording sound)?
Yes, that seems possible.

Quote
BTW can I use CHDK to print message on a photo or a video like a date is printed? That would be cool!
Definitely not on video. You can draw pixels on an image using https://chdk.fandom.com/wiki/Lua/Raw_Hook_Operations but you'd need to render the text yourself.
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal