Author Topic: LUA plugin question  (Read 2414 times)

wolf

  • Senior
  • ****
  • Posts: 263
LUA plugin question
« on: December 01, 2012, 01:14:24 PM »
I tried to run a script with the newest ML.
The scripts, that came with the source code for example wb_shoot.lua works fine.
But when I try to run a script which worked before:

Code: [Select]
PROP_REMOTE_SW1 = 0x80020015
msleep(1000)

setbutton = function()
  setprop(PROP_REMOTE_SW1, 1);
  msleep(100)
  setprop(PROP_REMOTE_SW1, 0);
end

msleep(1000)
setbutton()

it should trigger a half button pressed to take a silent pic, but it produces a warning on the screen and a
ASSERT00.LOG file:

ML ASSERT:
PROP_LEN(80020015) correct:2 called:4
at ../../src/property.c:242 (prop_request_change), task TASK
lv:0 mode:3


Magic Lantern version : v2.3.NEXT.2012Dec01.550D109
Mercurial changeset   : a077bad5e286+ (unified) tip
Built on 2012-12-01 00:28:15 by wolf@localhost.
Free Memory  : 305K + 1834K


Does anybody know what this means?

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: LUA plugin question
« Reply #1 on: December 01, 2012, 03:45:07 PM »
Dirty fix:
Code: [Select]
lua-handler.c:
- prop_request_change( id, &data, 4);
+ prop_request_change( id, &data, 0); // 0 = autodetect

Long answer:

Properties are dangerous. We are trying to make sure the call is correct before continuing, and I'm also thinking to add a central place when one can select what properties can be changed, and with what restrictions (valid values, range checking). Canon code does not always validate them, sometimes they just save the bad setting into ROM and brick the camera.

Currently ML has range checks, but not in the Lua implementation.

wolf

  • Senior
  • ****
  • Posts: 263
Re: LUA plugin question
« Reply #2 on: December 01, 2012, 04:36:06 PM »
Thanks for these safety feature, it stopped me bricking my camera eventually.