Author Topic: Custom Bracket for Time Lapse  (Read 1894 times)

yonespro

  • New to the forum
  • *
  • Posts: 2
Custom Bracket for Time Lapse
« on: April 22, 2020, 10:36:42 PM »
Hi All,
First timer scripting and could really use some help.  I have t5i/700D, using lua_fix.2019Mar20.700D115

Thanks for any help or pointing to resources in advance.

My intention is to be able to script a custom exposure bracket that I can then trigger from my external intervalometer.

Here's a version of the script that doesn't have the expected result of running every time the intervalometer triggers but does cause the script to loop from an initial fullshutter trigger (I couldn't figure out how to get a while loop to work for this scenario):

lua
Code: [Select]
bracket_menu = menu.new
{
    name    = "Yones",
    choices = { "OFF", "ON" },
    value   = "OFF",
    help    = "8 exposure bracket",
}

function event.keypress(key)
    while key == KEY.FULLSHUTTER and bracket_menu.value == "ON" do
      camera.shutter.value = 1/4000
camera.shoot(64,false)
 
  camera.shutter.value = 1/1000
  camera.shoot(64,false)
 
  camera.shutter.value = 1/250
  camera.shoot(64,false)
 
  camera.shutter.value = 1/60
  camera.shoot(64,false)

  camera.shutter.value = 1/15
  camera.shoot(100,false)
 
  camera.shutter.value = 1/4
  camera.shoot(300,false)
 
  camera.shutter.value = 1.0
camera.shoot(1100,false)

  camera.shutter.value = 4.0
  camera.shoot(4200,false)

      camera.shutter.value = 1/4000

    end
end

After inconsistent amount of times running it crashes, here are the two crash reports:

Code: [Select]
ASSERT: err == SUCCESS
at GUI.c:679, PropMgr:ff0d6a04
lv:0 mode:3

PropMgr stack: 14ce18 [14cf68-14bf68]
0xUNKNOWN  @ bba0:14cf60
0xUNKNOWN  @ 16aac:14cf38
0x000167A4 @ ff11f0d4:14cf20
0xUNKNOWN  @ 167d4:14cf10
0xUNKNOWN  @ 1685c:14cef0
0xFF31B1DC @ ff31e034:14cec0
0xUNKNOWN  @ ff31b320:14ce98
0xFF0D69A0 @ ff1c6f8c:14ce70
0x00001900 @ ff0d6a00:14ce50
0x0007EF78 @ 7f280:14ce18

Magic Lantern version : lua_fix.2019Mar20.700D115
Mercurial changeset   : e98cf272a50b (lua_fix) tip
Built on 2019-03-20 09:35:13 UTC by jenkins@nightly.
Free Memory  : 135K + 2772K



and


Code: [Select]
ASSERT: err == SUCCESS
at GUI.c:679, GuiMainTask:ff0d6a04
lv:0 mode:3

GuiMainTask stack: 1a3750 [1a3998-1a1998]
0xUNKNOWN  @ fffffffd:1a390c
0x00B1B05C @ b19cec:1a38e4
0x00B1B790 @ b1b070:1a38d8
0x00B1B870 @ b1b7a4:1a38c8
0xUNKNOWN  @ b1b8e4:1a37f0
0x00B1ADE0 @ b1b784:1a37e8
0x00AEF094 @ b1ae6c:1a37c8
0x000C4FC4 @ aef0d0:1a37a8
0x00001900 @ ff0d6a00:1a3788
0x0007EF78 @ 7f280:1a3750

Magic Lantern version : lua_fix.2019Mar20.700D115
Mercurial changeset   : e98cf272a50b (lua_fix) tip
Built on 2019-03-20 09:35:13 UTC by jenkins@nightly.
Free Memory  : 137K + 2818K


Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 8432
Re: Custom Bracket for Time Lapse
« Reply #1 on: April 23, 2020, 09:40:26 AM »
Will try to reproduce with my 650D.
EDIT: Reproduceable with 650D, no other lua scripts loaded.

One question: You renamed/deleted all other lua scripts in scripts folder so no other script is loaded?

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Custom Bracket for Time Lapse
« Reply #2 on: April 23, 2020, 11:13:12 AM »
One question: You renamed/deleted all other lua scripts in scripts folder so no other script is loaded?

In lua_fix versions, no script is loaded by default. You need to explicitly enable autorun on each script you want to be loaded/executed at startup.

ASSERT: err == SUCCESS
at GUI.c:679, GuiMainTask:ff0d6a04

Short answer: the keypress event handler runs in GuiMainTask, and it has to return quickly. Photo capture also requires GUI events, so it can't be completed in a keypress handler; you need to offload it to some other task. The shoot_task hook is suitable for this purpose.

Long answers:
https://www.magiclantern.fm/forum/index.php?topic=16614.msg161978#msg161978
https://www.magiclantern.fm/forum/index.php?topic=21590.msg197093#msg197093
https://www.magiclantern.fm/forum/index.php?topic=24319.msg218556#msg218556
https://www.magiclantern.fm/forum/index.php?topic=4997.msg179155#msg179155
https://www.magiclantern.fm/forum/index.php?topic=14309.msg198217#msg198217

yonespro

  • New to the forum
  • *
  • Posts: 2
Re: Custom Bracket for Time Lapse
« Reply #3 on: April 30, 2020, 10:09:39 PM »
a1ex, thanks for your response.

I've looked into your "Long Answers" and seems I need to study a lot. 

I will be looking into shoot_task and what a hook and task are.  I believe I understand the idea of having the complete capture process outside of the keypress triggered function.  The approach to coding this is beyond me at the moment.

I will continue to research and will post back with questions at some point.

Thanks again for pointing.

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 2218
Re: Custom Bracket for Time Lapse
« Reply #4 on: May 01, 2020, 07:21:04 AM »
@yonespro

You may wish to look at my scripts that make use of what @a1ex said, for example this one https://gist.github.com/pigeonhill/2c799711e1a774b4ebe1ef09d2d95749

Or my others scripts at photography.grayheron.net

As @a1ex says, keep the keypress event handler lean, i.e. just tracking that a key press has occurred and handling it, and use the shoot_task to do 'other stuff', triggered/controlled by flags set in the keypress handler.